Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .changeset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 8 additions & 0 deletions .changeset/cf-release-candidate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"cf": minor
---

Release the first cf 1.0 release candidate.
Comment thread
petebacondarwin marked this conversation as resolved.
Resolved

Publish 1.0.0-rc.0 and update the installation and publishing guidance
for the release candidate channel.
2 changes: 1 addition & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"mode": "pre",
"tag": "beta",
"tag": "rc",
"initialVersions": {
"cf": "0.14.0",
"wrangler-bundler-fixture": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion .github/vouch-pr-response.md
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 2 additions & 1 deletion .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -993,11 +993,15 @@ pnpm i https://pkg.pr.new/cloudflare/cf/cf@<branch-name>
```

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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ pnpm i https://pkg.pr.new/cloudflare/cf/cf@<branch-name>
```

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`
Comment thread
petebacondarwin marked this conversation as resolved.
Resolved
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.
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
28 changes: 28 additions & 0 deletions scripts/prepare-prerelease.mjs
Original file line number Diff line number Diff line change
@@ -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`);
86 changes: 86 additions & 0 deletions scripts/prepare-prerelease.test.ts
Original file line number Diff line number Diff line change
@@ -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
);
});
}
Loading