Skip to content

feat(create,push): look up template by name OR aliases#1209

Draft
DaveHanns wants to merge 1 commit into
masterfrom
feat/support-template-aliases
Draft

feat(create,push): look up template by name OR aliases#1209
DaveHanns wants to merge 1 commit into
masterfrom
feat/support-template-aliases

Conversation

@DaveHanns

Copy link
Copy Markdown
Contributor

Summary

Allow apify create -t <id> and apify push to resolve templates by their aliases array in addition to name. The Template type at @apify/actor-templates already declares aliases?: string[] and the manifest supports it (python-crawlee-beautifulsoup already uses it), but two consumer call sites in this repo were checking only t.name === input:

  • src/lib/create-utils.tsgetTemplateDefinition() (used by apify create -t <name>)
  • src/commands/actors/push.ts — Actor-create lookup when name not on platform yet (uses actorConfig.template from .actor/actor.json)

Both call sites now mirror the same predicate:

templates.find((t) => t.name === input || t.aliases?.includes(input))

Why now

Coordinated with apify/actor-templates#818 (DRAFT) which renames 19 JS/TS template name fields to match their id and adds the old name to aliases for backward compatibility (e.g. id: "js-empty" was name: "project_empty", will become name: "js-empty" with aliases: ["project_empty"]). Without this PR, apify create -t js-empty would fail after the rename. With this PR, both apify create -t project_empty (existing users) and apify create -t js-empty (canonical) work.

Test plan

Refs: apify/actor-templates#818 (DRAFT — coordinated rename PR), chocholous/apify-evals F37.

🤖 Generated with Claude Code

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-dx Issues owned by the DX team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants