History

[codex] Fix Changesets changelog generation (#917)

Rhys Sullivan committed 5 months ago

Commit 1e87bee1 parent 81a26ab35 files · +53 −174Browse files

Showing the changes to scripts (1 of 35 files). Show all

Unified · Split

scripts/check-changelog-stubs.ts+12−17
@@ -3,15 +3,16 @@ · 2 unmodified lines
3 * Verifies every workspace package directory has a `CHANGELOG.md` file.3 * Verifies every workspace package directory has a `CHANGELOG.md` file.
4 *4 *
5 * `changesets/action@v1` (the GitHub Action wrapping the Changesets CLI in5 * `changesets/action@v1` (the GitHub Action wrapping the Changesets CLI in
6 * `release.yml`) reads every workspace package's `CHANGELOG.md` to build6 * `release.yml`) creates the Version Packages PR after `changeset version`
7 * the Version Packages PR description. If any is missing, the action7 * updates package versions and changelogs. Every workspace package should have
8 * crashes with `ENOENT` at release time and blocks the release.8 * a `CHANGELOG.md` seed so Changesets has a stable file to update and the
9 * action never falls back to missing-file behavior. Keep seed files H1-only:
10 * Changesets inserts generated version sections immediately after the H1, so
11 * any placeholder prose would become part of the first generated release notes.
9 *12 *
10 * The CLI alone (with `changelog: false` in `.changeset/config.json`)13 * GitHub Release notes are still authored separately at
11 * doesn't need them — but we run via the Action, which does.14 * `apps/cli/release-notes/next.md`; package changelogs are generated from
12 *15 * `.changeset/*.md`.
13 * The stubs themselves are not user-facing. Canonical release notes are
14 * at `apps/cli/release-notes/next.md` and on the GitHub Releases page.
15 *16 *
16 * Usage:17 * Usage:
17 * bun run scripts/check-changelog-stubs.ts # fail on missing18 * bun run scripts/check-changelog-stubs.ts # fail on missing
@@ -39,12 +40,7 @@ const findWorkspacePackages = (): string[] => { · 21 unmodified lines
39 return [...dirs].sort();40 return [...dirs].sort();
40};41};
41 42
42const STUB_TEMPLATE = (name: string) =>43const STUB_TEMPLATE = (name: string) => `# ${name}\n`;
43 `# ${name} changelog\n\n` +
44 "This file exists for `changesets/action@v1` compatibility (it reads every\n" +
45 "workspace package's `CHANGELOG.md` to build the Version Packages PR).\n" +
46 "Canonical user-facing release notes are at `apps/cli/release-notes/next.md`\n" +
47 "and on the GitHub Releases page.\n";
48 44
49const fix = process.argv.includes("--fix");45const fix = process.argv.includes("--fix");
50const missing: string[] = [];46const missing: string[] = [];
@@ -67,9 +63,8 @@ for (const pkgDir of findWorkspacePackages()) { · 16 unmodified lines
67if (!fix && missing.length > 0) {63if (!fix && missing.length > 0) {
68 console.error(64 console.error(
69 `\nMissing CHANGELOG.md in ${missing.length} workspace package(s):\n - ${missing.join("\n - ")}\n\n` +65 `\nMissing CHANGELOG.md in ${missing.length} workspace package(s):\n - ${missing.join("\n - ")}\n\n` +
70 "These are required by `changesets/action@v1` (the GitHub Action wrapping\n" +66 "These seed files are required so Changesets can update every affected\n" +
71 "Changesets in release.yml). Without them, release.yml crashes with ENOENT\n" +67 "workspace changelog during the Version Packages PR.\n\n" +
72 "and the Version Packages PR can't open.\n\n" +
73 "Run `bun run scripts/check-changelog-stubs.ts --fix` to create stubs.\n",68 "Run `bun run scripts/check-changelog-stubs.ts --fix` to create stubs.\n",
74 );69 );
75 process.exit(1);70 process.exit(1);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t