Skip to content
Merged
Changes from 1 commit
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
24 changes: 22 additions & 2 deletions scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,21 @@ async function runRelease() {
// 2. Update deno.json
console.log("\n📝 Updating version in deno.json...");
if (!DRY_RUN) {
denoJson.version = newVersion;
// Rewrite the version in place rather than re-serialising the parsed
// object. JSON.stringify reflows the whole file -- it expands inline
// arrays such as `"dependencies": ["build:npm"]` across several lines --
// which buries the one meaningful line under unrelated churn that then
// has to be reverted by hand.
const source = await fs.readTextFile(denoJsonPath);
const versionLine = /("version"\s*:\s*")[^"]*(")/;
if (!versionLine.test(source)) {
throw new Error('Could not find a "version" field in deno.json');
}
await fs.writeTextFile(
denoJsonPath,
JSON.stringify(denoJson, null, 2) + "\n",
source.replace(versionLine, `$1${newVersion}$2`),
);
denoJson.version = newVersion;
}

// 2.5 Update examples
Expand All @@ -295,6 +305,16 @@ async function runRelease() {
await runCommand(["deno", "task", "verify:dist"]);
}

// 3.5 Regenerate artifacts that embed the version.
//
// hydration-runtime.generated.ts is a prebundled artifact carrying its own
// `var VERSION = "..."`, so a regex bump cannot reach it. Left stale it
// disagrees with version-constant.ts, and `generate:manifests:check` fails
// the required typecheck shard -- blocking the publish this task exists to
// perform. Every release before this ran `deno task generate` by hand.
console.log("\n🔧 Regenerating version-embedding artifacts...");
await runCommand(["deno", "task", "generate"]);
Comment thread
kojiwakayama marked this conversation as resolved.

// 4. Git commit, tag, and push (CI will handle npm publish + binary upload)
console.log("\n📦 Committing and tagging release...");
await runCommand(["git", "add", "."]);
Expand Down