feat: streamline release preparation and changelog checks
Exports the release package list so release prep stages the same versioned files as the bump script. Validates that CHANGELOG.md contains the target release section before preparing a release. Updates the suggested release steps to commit only release files and push the tag explicitly.
This commit is contained in:
+25
-20
@@ -6,7 +6,9 @@ import { fileURLToPath } from 'url';
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const ROOT = path.resolve(__dirname, '..');
|
||||
|
||||
const PACKAGES = [
|
||||
// Every package.json a release bumps. `oc-dev create-release` imports this so
|
||||
// the commit it suggests stages exactly these files.
|
||||
export const RELEASE_PACKAGE_FILES = [
|
||||
'package.json',
|
||||
'packages/ui/package.json',
|
||||
'packages/web/package.json',
|
||||
@@ -14,23 +16,26 @@ const PACKAGES = [
|
||||
'packages/vscode/package.json',
|
||||
];
|
||||
|
||||
const newVersion = process.argv[2];
|
||||
if (!newVersion || !/^\d+\.\d+\.\d+(-[\w.]+)?$/.test(newVersion)) {
|
||||
console.error('Usage: node scripts/bump-version.mjs <version>');
|
||||
console.error('Example: node scripts/bump-version.mjs 0.2.0');
|
||||
console.error('Example: node scripts/bump-version.mjs 0.2.0-beta.1');
|
||||
process.exit(1);
|
||||
const isDirectRun = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
||||
if (isDirectRun) {
|
||||
const newVersion = process.argv[2];
|
||||
if (!newVersion || !/^\d+\.\d+\.\d+(-[\w.]+)?$/.test(newVersion)) {
|
||||
console.error('Usage: node scripts/bump-version.mjs <version>');
|
||||
console.error('Example: node scripts/bump-version.mjs 0.2.0');
|
||||
console.error('Example: node scripts/bump-version.mjs 0.2.0-beta.1');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`Bumping version to ${newVersion}\n`);
|
||||
|
||||
for (const pkgPath of RELEASE_PACKAGE_FILES) {
|
||||
const fullPath = path.join(ROOT, pkgPath);
|
||||
const pkg = JSON.parse(fs.readFileSync(fullPath, 'utf8'));
|
||||
const oldVersion = pkg.version;
|
||||
pkg.version = newVersion;
|
||||
fs.writeFileSync(fullPath, JSON.stringify(pkg, null, 2) + '\n');
|
||||
console.log(` ${pkgPath}: ${oldVersion} -> ${newVersion}`);
|
||||
}
|
||||
|
||||
console.log('\nVersion bump complete. Review changes, then commit and tag.');
|
||||
}
|
||||
|
||||
console.log(`Bumping version to ${newVersion}\n`);
|
||||
|
||||
for (const pkgPath of PACKAGES) {
|
||||
const fullPath = path.join(ROOT, pkgPath);
|
||||
const pkg = JSON.parse(fs.readFileSync(fullPath, 'utf8'));
|
||||
const oldVersion = pkg.version;
|
||||
pkg.version = newVersion;
|
||||
fs.writeFileSync(fullPath, JSON.stringify(pkg, null, 2) + '\n');
|
||||
console.log(` ${pkgPath}: ${oldVersion} -> ${newVersion}`);
|
||||
}
|
||||
|
||||
console.log('\nVersion bump complete. Review changes, then commit and tag.');
|
||||
|
||||
Reference in New Issue
Block a user