fix(FN-XXX): sync workspace version on release
This commit is contained in:
@@ -366,6 +366,7 @@ info("Applying changesets (version bump + CHANGELOG)…");
|
||||
run("pnpm release:version");
|
||||
|
||||
overrideVersion(releases, proposedVersion, chosenVersion);
|
||||
run("node scripts/sync-workspace-version.mjs");
|
||||
|
||||
info("Updating lockfile…");
|
||||
run("pnpm install --no-frozen-lockfile");
|
||||
@@ -375,6 +376,10 @@ const version = cliPkg.version;
|
||||
if (version !== chosenVersion) {
|
||||
fail(`Post-bump version mismatch: package reports ${version}, expected ${chosenVersion}.`);
|
||||
}
|
||||
const workspacePkg = JSON.parse(readFileSync("package.json", "utf8"));
|
||||
if (workspacePkg.version !== chosenVersion) {
|
||||
fail(`Post-bump workspace version mismatch: package.json reports ${workspacePkg.version}, expected ${chosenVersion}.`);
|
||||
}
|
||||
ok(`New version: ${version}`);
|
||||
|
||||
info("Syncing root CHANGELOG.md from packages/cli/CHANGELOG.md…");
|
||||
|
||||
25
scripts/sync-workspace-version.mjs
Normal file
25
scripts/sync-workspace-version.mjs
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { readFileSync, writeFileSync } from "node:fs";
|
||||
|
||||
function readJson(path) {
|
||||
return JSON.parse(readFileSync(path, "utf8"));
|
||||
}
|
||||
|
||||
const rootPackagePath = "package.json";
|
||||
const cliPackagePath = "packages/cli/package.json";
|
||||
|
||||
const rootPackage = readJson(rootPackagePath);
|
||||
const cliPackage = readJson(cliPackagePath);
|
||||
|
||||
if (typeof cliPackage.version !== "string" || cliPackage.version.length === 0) {
|
||||
throw new Error(`Missing version in ${cliPackagePath}`);
|
||||
}
|
||||
|
||||
if (rootPackage.version === cliPackage.version) {
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
rootPackage.version = cliPackage.version;
|
||||
writeFileSync(rootPackagePath, JSON.stringify(rootPackage, null, 2) + "\n");
|
||||
console.log(`Synced workspace version to ${cliPackage.version}`);
|
||||
Reference in New Issue
Block a user