Files
scriptc/scripts/sync-versions.mjs
T
Chris Tate 9deedfd074 Add the agent-driven release process: docs, sync script, tag job
- RELEASING.md documents the lockstep three-package prepare flow and the marked-changelog convention
- CHANGELOG.md starts with an Unreleased section and the marked 0.0.1 entry that becomes the GitHub release body
- AGENTS.md states repo-wide build/test conventions and defers docs-site specifics to docs/AGENTS.md
- scripts/sync-versions.mjs stamps runtime and compiler from the CLI version; the workflow's sync check now hints at it
- release.yml gains a github-release job that tags v<version> after a successful publish, never gating npm
2026-07-22 21:03:10 -05:00

29 lines
1.0 KiB
JavaScript

#!/usr/bin/env node
// Stamps the version from packages/cli/package.json into packages/runtime
// and packages/compiler, so the three published packages move in lockstep.
// Usage: node scripts/sync-versions.mjs
import { readFileSync, writeFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
const root = fileURLToPath(new URL("..", import.meta.url));
const manifest = (pkg) => `${root}packages/${pkg}/package.json`;
const read = (path) => JSON.parse(readFileSync(path, "utf8"));
const version = read(manifest("cli")).version;
if (typeof version !== "string" || version.length === 0) {
console.error("packages/cli/package.json has no version");
process.exit(1);
}
for (const pkg of ["runtime", "compiler"]) {
const path = manifest(pkg);
const json = read(path);
if (json.version === version) {
console.log(`packages/${pkg}: already ${version}`);
continue;
}
console.log(`packages/${pkg}: ${json.version} -> ${version}`);
json.version = version;
writeFileSync(path, JSON.stringify(json, null, 2) + "\n");
}