feat: add --template-version flag#7925
Conversation
Adds interactive template + project-name selection when args are omitted, graceful Ctrl-C handling, a gated end-to-end test (scaffold -> install -> build), the README, and the release changeset.
…eat/create-ui-3-cli
…eat/create-ui-3-cli
…eat/create-ui-3-cli
…eat/create-ui-3-cli
|
There was a problem hiding this comment.
Pull request overview
Adds support in @coveo/create-ui for pinning a scaffolded sample template to a specific published npm version or dist-tag via a new --template-version flag, while keeping the default behavior (latest) when omitted.
Changes:
- Added
--template-version <version>CLI option, threaded through parsing → scaffolding → template download. - Implemented packument-based validation for requested versions/dist-tags and a dedicated
TemplateVersionUnavailableError. - Updated docs/ADRs and tests to cover the new flag and behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/create-ui/src/index.ts | Adds CLI flag parsing/help text, threads version into scaffold, and formats a version-aware “template unavailable” error. |
| packages/create-ui/src/index.test.ts | Adds unit tests for arg parsing, help text, version threading, and version-aware error messaging. |
| packages/create-ui/src/fs-utils.ts | Removes now-unused pathExists helper. |
| packages/create-ui/src/download.ts | Adds optional version support with packument validation and TemplateVersionUnavailableError. |
| packages/create-ui/src/download.test.ts | Adds tests for versioned extraction, dist-tag support, and rejection of unpublished versions. |
| packages/create-ui/README.md | Documents --template-version and explains how to pin sample versions. |
| packages/create-ui/docs/adr/002-sample-publishing.md | Updates ADR to reflect the new version pinning mechanism. |
| packages/create-ui/docs/adr/001-sample-consumption.md | Updates ADR to reflect default latest behavior plus optional version override. |
| .cspell.json | Adds “packument” to the dictionary. |
Summary
Adds an optional
--template-version <version>flag to@coveo/create-ui, allowing users to scaffold a specific version of a sample template instead of always resolvinglatest.What it does
3.2.1) or an npm dist-tag (e.g.next,latest).latestwhen omitted — existing behavior is unchanged.Usage