diff --git a/.changeset/README.md b/.changeset/README.md index ea7b6d3470..451e353cbe 100644 --- a/.changeset/README.md +++ b/.changeset/README.md @@ -6,6 +6,10 @@ changelog — must be captured in a "changeset". We use [`changesets`](https://github.com/changesets/changesets/blob/main/README.md) to create changesets, bump versions, and update the changelog. +Run `pnpm changeset:version` to prepare version updates. It resets the counter +when the prerelease channel changes, so `1.0.0-beta.32` becomes `1.0.0-rc.0`. +Subsequent releases on the same channel increment normally. + ## Creating a Changeset ```sh @@ -30,7 +34,7 @@ pnpm changeset out explicitly in the changeset description. - **major**: Breaking changes to stable features. -During the 1.0 beta, breaking changes go in `minor` bumps and must be called +During the 1.0 prereleases, breaking changes go in `minor` bumps and must be called out explicitly. Major bumps require strong justification. ## Changeset Message Format diff --git a/.changeset/cf-release-candidate.md b/.changeset/cf-release-candidate.md new file mode 100644 index 0000000000..fc4d92ae5d --- /dev/null +++ b/.changeset/cf-release-candidate.md @@ -0,0 +1,8 @@ +--- +"cf": minor +--- + +Release the first cf 1.0 release candidate. + +Publish 1.0.0-rc.0 and update the installation and publishing guidance +for the release candidate channel. diff --git a/.changeset/pre.json b/.changeset/pre.json index c379915950..89685ac6b0 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -1,6 +1,6 @@ { "mode": "pre", - "tag": "beta", + "tag": "rc", "initialVersions": { "cf": "0.14.0", "wrangler-bundler-fixture": "0.0.0", diff --git a/.github/SECURITY.md b/.github/SECURITY.md index 8af4f00f80..972a5afb67 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -1,5 +1,5 @@ # Security Policy > [!IMPORTANT] -> Cloudflare cf is in a beta state and is under active, rapid development. +> Cloudflare cf is a release candidate and is under active, rapid development. > Please treat any deployment as experimental and do not rely on it for production security guarantees. diff --git a/.github/vouch-pr-response.md b/.github/vouch-pr-response.md index da9064c746..a5aafceaf9 100644 --- a/.github/vouch-pr-response.md +++ b/.github/vouch-pr-response.md @@ -1,5 +1,5 @@ Hi @{author}. Thanks for contributing to `cf`! -During the open beta, we’re being very intentional about the changes we accept so that we can prioritise stability for GA. We’re limiting pull requests to contributions coordinated with the team in advance, so this PR has been automatically closed. +During the release candidate phase, we’re being very intentional about the changes we accept so that we can prioritise stability for GA. We’re limiting pull requests to contributions coordinated with the team in advance, so this PR has been automatically closed. We’d still love to hear about your use case, so please make sure it’s captured in a [`cf` issue](https://github.com/cloudflare/cf/issues). If the proposed change fits our priorities, we’d be happy to take another look at this PR. diff --git a/.github/workflows/changesets.yml b/.github/workflows/changesets.yml index 0fa67256d5..a512493581 100644 --- a/.github/workflows/changesets.yml +++ b/.github/workflows/changesets.yml @@ -99,7 +99,8 @@ jobs: # emits "loose" markdown lists (a blank line before nested # bullet lists) that Vite+ formatting tightens, so the raw changelog # fails `pnpm check`'s format check. The `changeset:version` - # script chains `vp fmt` after generation so the changelog is + # script resets the counter when the prerelease channel changes, + # then chains `vp fmt` after generation so the changelog is # formatted before the changesets action commits it. (The # action execs this input directly — it is NOT shell- # interpreted — so the `&&` must live in the script, not here.) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 538bd2d75a..80d6d5f9fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,7 @@ jobs: uses: $/.github/actions/install-dependencies - name: Test automation scripts - run: node --test scripts/update-openapi.test.ts + run: node --test scripts/update-openapi.test.ts scripts/prepare-prerelease.test.ts - name: Run cli tests run: pnpm --filter cf test diff --git a/AGENTS.md b/AGENTS.md index 7bd3aaf270..51352c6a82 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -166,6 +166,7 @@ commands/flags, and pre-1.0 behavior changes use `minor`. Purely internal refactors, tests, docs, and CI changes need none. See [the changeset rules](.changeset/README.md). -Prereleases use pkg.pr.new; versioned beta/stable releases use Changesets. +Per-commit prereleases use pkg.pr.new; versioned prereleases and stable releases +use Changesets. Keep bug fixes independently releasable rather than batching for a release window. See [publishing details](docs/architecture.md#publishing). diff --git a/README.md b/README.md index afbeb9e9cf..57673432ba 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ cf is a CLI that is built for the next generation of software development: - cloudflare.config.ts is the new configuration format for the whole of Cloudflare, starting with Workers, and bringing the safety and accuracy of TypeScript to you and your agent’s language server protocol (LSP) - Vite becomes default, bringing with it the best local development server, and a plugin suite for developers and framework authors. -Install the open beta today globally and run it from anywhere: +Install the release candidate globally and run it from anywhere: ``` npm i -g cf diff --git a/docs/architecture.md b/docs/architecture.md index 9de78394fb..60582696ef 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -993,11 +993,15 @@ pnpm i https://pkg.pr.new/cloudflare/cf/cf@ ``` The previous `publish-{alpha,,cf}.sh` scripts have been removed. Per-commit -prereleases flow through pkg-pr-new. Versioned beta and stable releases use +prereleases flow through pkg-pr-new. Versioned prereleases and stable releases use Changesets: `.github/workflows/changesets.yml` opens/updates the Version Packages PR when changesets exist and publishes to npm after that PR is merged. Publishing uses npm trusted publishing (OIDC), not a long-lived `NPM_TOKEN`. +Use `pnpm changeset:version` to prepare releases. Before Changesets runs, it +resets cf's prerelease counter when the channel changes: `1.0.0-beta.32` +becomes `1.0.0-rc.0`. Later RC releases increment the counter normally. + Vite+ Pack emits a minified bundle without source maps by default. `PACKAGE_PRERELEASE_LABEL` may be supplied to the pack `define` configuration, but no current source module reads it, so the binary does not self-report the diff --git a/package.json b/package.json index c5d2769a93..48294b5a8d 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "check:type": "vp run -r task:check:type", "fix": "vp lint --fix --type-aware && vp fmt", "changeset": "changeset", - "changeset:version": "changeset version && vp fmt packages/cli/CHANGELOG.md" + "changeset:version": "node scripts/prepare-prerelease.mjs && changeset version && vp fmt packages/cli/CHANGELOG.md" }, "devDependencies": { "@changesets/cli": "2.31.0", diff --git a/packages/cli/AGENTS.md b/packages/cli/AGENTS.md index 518cd513d2..2b74b0f732 100644 --- a/packages/cli/AGENTS.md +++ b/packages/cli/AGENTS.md @@ -282,7 +282,7 @@ pnpm i https://pkg.pr.new/cloudflare/cf/cf@ ``` The old `scripts/publish-{alpha,,cf}.sh` scripts have been removed. Versioned -beta and stable releases use Changesets: `.github/workflows/changesets.yml` +prereleases and stable releases use Changesets: `.github/workflows/changesets.yml` opens or updates a Version Packages PR while changesets are pending, then publishes to npm after that PR is merged. npm authentication uses trusted-publishing OIDC rather than a long-lived token. diff --git a/packages/cli/README.md b/packages/cli/README.md index 2c142d2903..af51de2e7c 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -2,7 +2,7 @@ A unified command-line interface for Cloudflare, generated from Cloudflare's public OpenAPI surface and published as the unscoped `cf` npm package. -This is a beta preview. To learn more, see the [announcement blog post](https://blog.cloudflare.com/cf-cli-local-explorer/). +This is a release candidate for cf 1.0. To learn more, see the [announcement blog post](https://blog.cloudflare.com/cloudflare-cf-cli-launch/). ## Install diff --git a/renovate.json5 b/renovate.json5 index fc8410a1bb..4f3a7c985b 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -76,9 +76,9 @@ followTag: "beta", }, { - description: "Follow the Vite plugin's beta release", + description: "Follow the Vite plugin's release candidate", matchPackageNames: ["@cloudflare/vite-plugin"], - followTag: "beta", + followTag: "rc", }, { description: "Update pnpm", diff --git a/scripts/prepare-prerelease.mjs b/scripts/prepare-prerelease.mjs new file mode 100644 index 0000000000..45bcd1b5c1 --- /dev/null +++ b/scripts/prepare-prerelease.mjs @@ -0,0 +1,28 @@ +import { existsSync, readFileSync, writeFileSync } from "node:fs"; + +const preStatePath = ".changeset/pre.json"; +if (!existsSync(preStatePath)) { + process.exit(0); +} + +const preState = JSON.parse(readFileSync(preStatePath, "utf8")); +if (preState.mode !== "pre") { + process.exit(0); +} + +const packagePath = "packages/cli/package.json"; +const packageJson = JSON.parse(readFileSync(packagePath, "utf8")); +const separator = packageJson.version.indexOf("-"); +if (separator === -1) { + process.exit(0); +} + +const prerelease = packageJson.version.slice(separator + 1).split("+")[0]; +if (prerelease.replace(/\.\d+$/, "") === preState.tag) { + process.exit(0); +} + +// Changesets increments the numeric suffix even when the channel changes. +// An unnumbered prerelease makes its next version start at zero. +packageJson.version = `${packageJson.version.slice(0, separator)}-${preState.tag}`; +writeFileSync(packagePath, `${JSON.stringify(packageJson, null, "\t")}\n`); diff --git a/scripts/prepare-prerelease.test.ts b/scripts/prepare-prerelease.test.ts new file mode 100644 index 0000000000..54673788dd --- /dev/null +++ b/scripts/prepare-prerelease.test.ts @@ -0,0 +1,86 @@ +import assert from "node:assert/strict"; +import { execFileSync } from "node:child_process"; +import { + mkdirSync, + mkdtempSync, + readFileSync, + rmSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { test } from "node:test"; +import { fileURLToPath } from "node:url"; + +const prepareScript = fileURLToPath( + new URL("./prepare-prerelease.mjs", import.meta.url) +); +const changesetCli = fileURLToPath( + new URL("../bin.js", import.meta.resolve("@changesets/cli")) +); + +for (const { version, tag, expected } of [ + { version: "1.0.0-beta.32", tag: "rc", expected: "1.0.0-rc.0" }, + { version: "1.0.0-rc.0", tag: "rc", expected: "1.0.0-rc.1" }, + { version: "1.0.0-rc.33", tag: "rc", expected: "1.0.0-rc.34" }, + { version: "1.0.0-beta.32", tag: "beta", expected: "1.0.0-beta.33" }, + { version: "0.14.0", tag: "rc", expected: "0.15.0-rc.0" }, +]) { + await test(`versions ${version} on ${tag} as ${expected}`, (context) => { + const cwd = mkdtempSync(join(tmpdir(), "cf-prerelease-")); + context.after(() => rmSync(cwd, { recursive: true, force: true })); + mkdirSync(join(cwd, ".changeset")); + mkdirSync(join(cwd, "packages/cli"), { recursive: true }); + const writeJson = (path: string, value: unknown) => + writeFileSync(join(cwd, path), `${JSON.stringify(value)}\n`); + writeJson("package.json", { + name: "cf-release-test", + private: true, + workspaces: ["packages/*"], + }); + writeJson("packages/cli/package.json", { name: "cf", version }); + writeJson(".changeset/config.json", { changelog: false }); + writeJson(".changeset/pre.json", { + mode: "pre", + tag, + initialVersions: { cf: "0.14.0" }, + changesets: [], + }); + writeFileSync( + join(cwd, ".changeset/release.md"), + '---\n"cf": minor\n---\n\nPrepare the release\n' + ); + + execFileSync(process.execPath, [prepareScript], { cwd }); + execFileSync(process.execPath, [changesetCli, "version"], { + cwd, + stdio: "pipe", + }); + + const updated = JSON.parse( + readFileSync(join(cwd, "packages/cli/package.json"), "utf8") + ); + assert.equal(updated.version, expected); + }); +} + +for (const preState of [undefined, { mode: "exit", tag: "rc" }]) { + await test(`leaves versions alone with prerelease state ${JSON.stringify(preState)}`, (context) => { + const cwd = mkdtempSync(join(tmpdir(), "cf-prerelease-")); + context.after(() => rmSync(cwd, { recursive: true, force: true })); + mkdirSync(join(cwd, "packages/cli"), { recursive: true }); + const manifest = '{"name":"cf","version":"1.0.0-beta.32"}\n'; + writeFileSync(join(cwd, "packages/cli/package.json"), manifest); + if (preState) { + mkdirSync(join(cwd, ".changeset")); + writeFileSync(join(cwd, ".changeset/pre.json"), JSON.stringify(preState)); + } + + execFileSync(process.execPath, [prepareScript], { cwd }); + + assert.equal( + readFileSync(join(cwd, "packages/cli/package.json"), "utf8"), + manifest + ); + }); +}