Skip to content

feat: add --template-version flag#7925

Merged
y-lakhdar merged 32 commits into
mainfrom
KIT-5854-specific-version
Jul 9, 2026
Merged

feat: add --template-version flag#7925
y-lakhdar merged 32 commits into
mainfrom
KIT-5854-specific-version

Conversation

@y-lakhdar

@y-lakhdar y-lakhdar commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

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 resolving latest.

What it does

  • Accepts an exact semver (e.g. 3.2.1) or an npm dist-tag (e.g. next, latest).
  • Defaults to latest when omitted — existing behavior is unchanged.
  • Validates the version against the package's published packument before extracting, and fails with a clear, actionable error if the version does not exist.

Usage

npm create @coveo/ui my-app --template headless-search-react --template-version 3.2.1

@changeset-bot

changeset-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 6339d08

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/create-ui/src/index.ts
Comment thread packages/create-ui/src/index.ts Outdated
@y-lakhdar y-lakhdar added this pull request to the merge queue Jul 9, 2026
Merged via the queue into main with commit 5b010c2 Jul 9, 2026
81 checks passed
@y-lakhdar y-lakhdar deleted the KIT-5854-specific-version branch July 9, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants