feat(create,push): look up template by name OR aliases#1209
Draft
DaveHanns wants to merge 1 commit into
Draft
Conversation
Allow `apify create -t <id>` and `apify push` to resolve templates by their `aliases` array in addition to `name`. The Template type already declares `aliases?: string[]` and the manifest already supports it (python-crawlee-beautifulsoup uses it), but two consumer call sites were checking only `t.name === input`. This enables coordinated rename work in apify/actor-templates where 19 templates have legacy `name` values (e.g. `project_empty`) that will be replaced with hyphenated ids matching their directory layout (e.g. `js-empty`), with the old name retained as an alias. After this change AND apify/actor-templates#XXXX both land: `apify create -t project_empty` keeps working (via alias) `apify create -t js-empty` starts working (via canonical name) Changed: src/lib/create-utils.ts — getTemplateDefinition() src/commands/actors/push.ts — Actor-create lookup when name not on platform Both changes mirror the same predicate: templates.find((t) => t.name === input || t.aliases?.includes(input)) Refs: apify/actor-templates#XXXX, chocholous/apify-evals F37.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Allow
apify create -t <id>andapify pushto resolve templates by theiraliasesarray in addition toname. TheTemplatetype at@apify/actor-templatesalready declaresaliases?: string[]and the manifest supports it (python-crawlee-beautifulsoupalready uses it), but two consumer call sites in this repo were checking onlyt.name === input:src/lib/create-utils.ts—getTemplateDefinition()(used byapify create -t <name>)src/commands/actors/push.ts— Actor-create lookup when name not on platform yet (usesactorConfig.templatefrom.actor/actor.json)Both call sites now mirror the same predicate:
Why now
Coordinated with apify/actor-templates#818 (DRAFT) which renames 19 JS/TS template
namefields to match theiridand adds the old name toaliasesfor backward compatibility (e.g.id: "js-empty"wasname: "project_empty", will becomename: "js-empty"withaliases: ["project_empty"]). Without this PR,apify create -t js-emptywould fail after the rename. With this PR, bothapify create -t project_empty(existing users) andapify create -t js-empty(canonical) work.Test plan
apify create -t python-crawlee-beautifulsoupcontinues to work (canonical name)apify create -t getting_started_crawlee_beautifulsoupcontinues to work (existing alias — proves alias path works pre-rename)apify create -t js-emptyworks (new canonical name)apify create -t project_emptycontinues to work (legacy alias)Refs: apify/actor-templates#818 (DRAFT — coordinated rename PR), chocholous/apify-evals F37.
🤖 Generated with Claude Code