Skip to content

fix(cloudflare): pass the Preview name with --preview-name like cf - #4572

Open
james-elicx wants to merge 1 commit into
mainfrom
james/preview-name-flag
Open

james-elicx wants to merge 1 commit into
mainfrom
james/preview-name-flag

Conversation

@james-elicx

@james-elicx james-elicx commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Follows cloudflare/cf#519, which replaces the positional Preview name in cf previews deploy with --preview-name.

Changes

  • vinext-cloudflare previews deploy now takes --preview-name <name> instead of a positional name. Leaving it out still makes cf use the CI or Git branch. A positional argument now throws Unexpected argument: <arg>. Pass the Preview name with --preview-name <name>.
  • buildCfDeployArgs passes the name to cf as --preview-name <name>.
  • Updated the help text, the Worker Preview docs, the deploy-examples workflow, and the tests.

This is a breaking CLI change: vinext-cloudflare previews deploy pr-123 becomes vinext-cloudflare previews deploy --preview-name pr-123.

Status: draft until cf releases

cf is yargs-strict, so the cf version we pin now (1.0.0-beta.1) rejects --preview-name, and cf versions that include #519 reject a positional name. Before this can land, the cloudflare-vite-v2 catalog needs to move to the cf release that ships #519, after that release clears the 24h minimumReleaseAge gate. Until then, the static-assets-cache Worker Preview deploy in CI is expected to fail.

@pkg-pr-new

pkg-pr-new Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vinext/cloudflare

npm i https://pkg.pr.new/@vinext/cloudflare@4572

create-vinext-app

npm i https://pkg.pr.new/create-vinext-app@4572

@vinext/types

npm i https://pkg.pr.new/@vinext/types@4572

vinext

npm i https://pkg.pr.new/vinext@4572

@cloudflare/workers-response-store

npm i https://pkg.pr.new/@cloudflare/workers-response-store@4572

commit: 3cfc8fe

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared 3cfc8fe against base 313bc5f using alternating same-runner rounds. Next.js was unchanged and skipped.

0 improved · 0 regressed · 7 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 153.6 KB 153.6 KB ⚫ +0.0%
Client entry size (gzip) vinext 141.8 KB 141.8 KB ⚫ -0.0%
Dev server cold start vinext 2.76 s 2.76 s ⚫ -0.2%
Dev server cold start (large Pages Router app) vinext 24.44 s 24.33 s ⚫ -0.4%
Production build time vinext 3.75 s 3.73 s ⚫ -0.5%
RSC entry closure size (gzip) vinext 141.4 KB 141.4 KB ⚫ +0.0%
Server bundle size (gzip) vinext 250.7 KB 250.7 KB ⚫ +0.0%

View detailed results and traces

🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor
Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original
response-store-demo preview production
workers-cache preview production
kv preview production
static-assets-cache preview production
static-assets-pages preview production
static-assets-pages-i18n preview production
static-export preview production
web preview production

@james-elicx james-elicx changed the title feat(cloudflare)!: pass the Preview name with --preview-name like cf fix(cloudflare): pass the Preview name with --preview-name like cf Nov 6, 2026
@james-elicx
james-elicx marked this pull request as ready for review November 6, 2026 10:38

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Superseded by the review of 7df47e46.

This review, of 7e024b87

💬 Approved with comments — The implementation is correct and well tested. One WARNING: the pinned cf version and the open "*" peer range still allow cf versions that reject the new --preview-name flag.

Findings: 1 warning (1 is an inline comment on the diff)

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.

🔧 Fix with your agent

Paste the following into your coding agent to investigate and fix these issues.

Fix the following code review issues found in pull request #4572.

Before making changes, review each issue and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g., the fix would require disproportionate changes
  for minimal ROI, or the finding is factually incorrect), explain why
- If you need to clarify something before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order

## WARNING (1)

### [Code Quality] The pinned cf (`1.0.0-beta.1`) and the open `cf: "*"` peer range still allow cf versions that reject `--preview-name`, so named Preview deploys fail with a raw yargs error.
- **File:** packages/cloudflare/src/deploy.ts:726

📋 Code Quality: ⚠️ 1 warning

The change is correct and well tested. The cf version pin and peer range don't yet require a cf release that accepts --preview-name.

Recommendation: 📝 Minor Comments

  • [WARNING] The pinned cf (1.0.0-beta.1) and the open cf: "*" peer range still allow cf versions that reject --preview-name, so named Preview deploys fail with a raw yargs error. (packages/cloudflare/src/deploy.ts:726)
View full review

The parser, validation, CLI wiring and tests are consistent:

  • parsePreviewsDeployArgs declares preview-name as a string option and rejects every positional argument with a clear message.
  • A missing value is still rejected by strict parseArgs.
  • The empty-name and null-byte checks are kept.

One issue remains. buildCfDeployArgs now always sends --preview-name when a name is given, but no version requirement stops it from running against a cf that rejects the flag:

  • The workspace catalog pins cf: 1.0.0-beta.1 (pnpm-workspace.yaml:117).
  • The package's cf peer range is "*".

✅ All other checks passed

📝 Documentation: ✅ LGTM

The Worker Preview docs and the CLI help text consistently describe --preview-name <name>. They also say that leaving it out makes cf use the CI or Git branch name.


Reviewed commit: 7e024b87

const isPreviewDeploy = options.target?.type === "preview";
const args = isPreviewDeploy ? ["previews", "deploy"] : ["deploy"];
if (isPreviewDeploy && options.target?.name) args.push(options.target.name);
if (isPreviewDeploy && options.target?.name) args.push("--preview-name", options.target.name);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ WARNING · Code Quality

The pinned cf (1.0.0-beta.1) and the open cf: "*" peer range still allow cf versions that reject --preview-name, so named Preview deploys fail with a raw yargs error.

cf is yargs-strict, so cf versions before cloudflare/cf#519 fail on this flag with Unknown argument: preview-name. That includes the catalog pin cf: 1.0.0-beta.1 (pnpm-workspace.yaml:117). Today that breaks the Worker Preview deploy in CI. After release, it breaks previews deploy --preview-name for any user on an older cf, because the cf peer range in packages/cloudflare/package.json is "*". Before merging, bump the cloudflare-vite-v2 catalog to the cf release that includes #519, and raise the peer range minimum to that release so incompatible installs are caught at install time.

cf previews deploy replaced its positional Preview name with --preview-name
(cloudflare/cf#519). Mirror that in vinext-cloudflare previews deploy and pass
the name to cf with the flag.
@james-elicx
james-elicx force-pushed the james/preview-name-flag branch from 7e024b8 to 7df47e4 Compare November 6, 2026 11:35

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Superseded by the review of 3cfc8fef.

This review, of 7df47e46

💬 Approved with comments — The --preview-name change and the empty SHA-named changeset are correct. One WARNING is still open: the pinned cf and the open peer range still allow cf versions that reject the new flag.

Findings: 1 warning

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.

🔧 Fix with your agent

Paste the following into your coding agent to investigate and fix these issues.

Fix the following code review issues found in pull request #4572.

Before making changes, review each issue and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g., the fix would require disproportionate changes
  for minimal ROI, or the finding is factually incorrect), explain why
- If you need to clarify something before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order

## WARNING (1)

### [Code Quality] The pinned cf (`1.0.0-beta.1`) and the open `cf: "*"` peer range still allow cf versions that reject `--preview-name`, so named Preview deploys fail with a raw yargs error.
- **File:** packages/cloudflare/src/deploy.ts:726

📋 Code Quality: ⚠️ 1 warning

Parsing, validation, help text and tests are consistent. The cf version requirement is still open.

Recommendation: 📝 Minor Comments

  • [WARNING] The pinned cf (1.0.0-beta.1) and the open cf: "*" peer range still allow cf versions that reject --preview-name, so named Preview deploys fail with a raw yargs error. (packages/cloudflare/src/deploy.ts:726)
View full review

Since the last review, the only new file is .changeset/2ceb012aaa75a1223ed2b16d511abed939abf1db.md. It is empty, and an empty, SHA-named changeset is the repository's way to drop a commit from the next release, so it does what the description says.

One issue from the last review is still open:

  • buildCfDeployArgs (packages/cloudflare/src/deploy.ts:726) always sends --preview-name when a name is given.
  • The workspace catalog still pins cf: 1.0.0-beta.1 (pnpm-workspace.yaml:117).
  • The package's cf peer range is still "*".

Any cf release from before the flag existed therefore fails a named Preview deploy with a raw argument error.


✅ All other checks passed

📝 Documentation: ✅ LGTM

The Worker Preview docs and the CLI help text both describe --preview-name <name>. Both also say that leaving it out makes cf use the CI or Git branch name.


Reviewed commit: 7df47e46

@james-elicx
james-elicx force-pushed the james/preview-name-flag branch from 7df47e4 to 3cfc8fe Compare November 6, 2026 16:50

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💬 Approved with comments — The --preview-name change is correct and consistent across code, docs and tests. One WARNING is still open: the pinned cf and the * peer range still allow cf versions that reject the new flag.

Findings: 1 warning

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.

🔧 Fix with your agent

Paste the following into your coding agent to investigate and fix these issues.

Fix the following code review issues found in pull request #4572.

Before making changes, review each issue and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g., the fix would require disproportionate changes
  for minimal ROI, or the finding is factually incorrect), explain why
- If you need to clarify something before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order

## WARNING (1)

### [Code Quality] The pinned cf (`1.0.0-beta.1`, pnpm-workspace.yaml:117) and the open `cf: "*"` peer range still allow cf versions that reject `--preview-name`, so named Preview deploys fail with a raw yargs error.
- **File:** packages/cloudflare/src/deploy.ts:726

📋 Code Quality: ⚠️ 1 warning

The flag change is correct. One open WARNING: the cf pin and peer range still allow cf versions that reject --preview-name.

Recommendation: 📝 Minor Comments

  • [WARNING] The pinned cf (1.0.0-beta.1, pnpm-workspace.yaml:117) and the open cf: "*" peer range still allow cf versions that reject --preview-name, so named Preview deploys fail with a raw yargs error. (packages/cloudflare/src/deploy.ts:726)
View full review

The pinned cf and the peer range still allow a cf that rejects --preview-name

  • buildCfDeployArgs (packages/cloudflare/src/deploy.ts:726) always sends --preview-name <name> when a name is given.
  • The cloudflare-vite-v2 catalog still pins cf: 1.0.0-beta.1 (pnpm-workspace.yaml:117). Because cf is yargs-strict, that version rejects the flag.
  • The @vinext/cloudflare peer range is still "cf": "*" (packages/cloudflare/package.json:69). Anyone on a cf release from before cloudflare/cf#519 gets a raw yargs error from a named Preview deploy.

Before merge, move the catalog pin to the first cf release that ships --preview-name, and change the peer range to >= that version.

I found nothing else in the diff. Positional arguments are rejected with a clear message, name validation still applies, and the tests cover building the arguments, the rejection and invalid names.


✅ All other checks passed

📝 Documentation: ✅ LGTM

The Worker Preview docs and the CLI help text both describe --preview-name <name>. Both also say that leaving it out makes cf use the CI or Git branch name.


Reviewed commit: 3cfc8fef

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant