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
33 * Verifies every workspace package directory has a `CHANGELOG.md` file.
44 *
55 * `changesets/action@v1` (the GitHub Action wrapping the Changesets CLI in
6− * `release.yml`) reads every workspace package's `CHANGELOG.md` to build
7− * the Version Packages PR description. If any is missing, the action
8− * crashes with `ENOENT` at release time and blocks the release.
6+ * `release.yml`) creates the Version Packages PR after `changeset version`
7+ * updates package versions and changelogs. Every workspace package should have
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.
912 *
10− * The CLI alone (with `changelog: false` in `.changeset/config.json`)
11− * doesn't need them — but we run via the Action, which does.
12− *
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.
13+ * GitHub Release notes are still authored separately at
14+ * `apps/cli/release-notes/next.md`; package changelogs are generated from
15+ * `.changeset/*.md`.
1516 *
1617 * Usage:
1718 * bun run scripts/check-changelog-stubs.ts # fail on missing
@@ -39,12 +40,7 @@ const findWorkspacePackages = (): string[] => { · 21 unmodified lines
3940 return [...dirs].sort();
4041 };
4142
42−const STUB_TEMPLATE = (name: string) =>
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";
43+const STUB_TEMPLATE = (name: string) => `# ${name}\n`;
4844
4945 const fix = process.argv.includes("--fix");
5046 const missing: string[] = [];
@@ -67,9 +63,8 @@ for (const pkgDir of findWorkspacePackages()) { · 16 unmodified lines
6763 if (!fix && missing.length > 0) {
6864 console.error(
6965 `\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" +
71− "Changesets in release.yml). Without them, release.yml crashes with ENOENT\n" +
72− "and the Version Packages PR can't open.\n\n" +
66+ "These seed files are required so Changesets can update every affected\n" +
67+ "workspace changelog during the Version Packages PR.\n\n" +
7368 "Run `bun run scripts/check-changelog-stubs.ts --fix` to create stubs.\n",
7469 );
7570 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