editor/scripts/release.mjs
konstantin-paulus 46cef22b26 Enhance Windows support and update dependencies
- Added support for Squirrel.Windows in the desktop app, including configuration for the installer and metadata.
- Updated package-lock.json to include the latest version of @electron-forge/maker-squirrel and other dependencies.
- Modified build scripts to improve compatibility and streamline installation processes.
- Documented the current status of Windows implementation in WINDOWS.md, outlining next steps for CI integration.
2026-09-16 10:53:54 +02:00

74 lines
2.3 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Cuts a release: bumps the single global version in the root and all app
// package.jsons, refreshes the lockfile, commits, and tags. Pushing the tag
// is what triggers the Release workflow, so that stays a manual step.
// Usage: npm run release <patch|minor|major|x.y.z>
import { execFileSync } from "node:child_process";
import { readFileSync, writeFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { npm } from "./lib/npm.mjs";
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
const PKGS = [
"package.json",
"apps/desktop/package.json",
"apps/cli/package.json",
"apps/web/package.json",
];
const git = (...args) => execFileSync("git", args, { cwd: root, encoding: "utf8" }).trim();
const arg = process.argv[2];
if (!arg) {
console.error("Usage: npm run release <patch|minor|major|x.y.z>");
process.exit(1);
}
if (git("status", "--porcelain")) {
console.error("Working tree is not clean; commit or stash first.");
process.exit(1);
}
const current = JSON.parse(readFileSync(join(root, "package.json"), "utf8")).version;
let next;
if (/^\d+\.\d+\.\d+$/.test(arg)) {
next = arg;
} else {
const [major, minor, patch] = current.split(".").map(Number);
if (arg === "major") next = `${major + 1}.0.0`;
else if (arg === "minor") next = `${major}.${minor + 1}.0`;
else if (arg === "patch") next = `${major}.${minor}.${patch + 1}`;
else {
console.error(`Unknown bump "${arg}" (expected patch, minor, major, or x.y.z)`);
process.exit(1);
}
}
const tag = `v${next}`;
if (git("tag", "--list", tag)) {
console.error(`Tag ${tag} already exists.`);
process.exit(1);
}
for (const rel of PKGS) {
const path = join(root, rel);
const pkg = JSON.parse(readFileSync(path, "utf8"));
pkg.version = next;
writeFileSync(path, JSON.stringify(pkg, null, 2) + "\n");
}
npm(["install", "--package-lock-only", "--no-audit", "--no-fund"], { cwd: root });
git("add", ...PKGS, "package-lock.json");
git("commit", "-m", tag);
git("tag", tag);
console.log(`\n${current} -> ${next}`);
console.log(`Release with: git push origin HEAD ${tag}`);