chrishoward-projects_relate.../version-bump.mjs
Chris Howard 8d961ae51a Fix version synchronization issue
- Fixed manifest.json to match package.json version (0.2.12)
- Updated version-bump.mjs to read version directly from package.json
- This prevents environment variable issues when script runs multiple times

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 16:00:06 +10:00

36 lines
No EOL
1.3 KiB
JavaScript

import { readFileSync, writeFileSync } from "fs";
import { execSync } from "child_process";
// Read version directly from package.json to ensure accuracy
const packageJson = JSON.parse(readFileSync("package.json", "utf8"));
const targetVersion = packageJson.version;
// read minAppVersion from manifest.json and bump version to target version
let manifest = JSON.parse(readFileSync("manifest.json", "utf8"));
const { minAppVersion } = manifest;
manifest.version = targetVersion;
writeFileSync("manifest.json", JSON.stringify(manifest, null, "\t"));
// update versions.json with target version and minAppVersion
let versions = JSON.parse(readFileSync("versions.json", "utf8"));
versions[targetVersion] = minAppVersion;
writeFileSync("versions.json", JSON.stringify(versions, null, "\t"));
// update changelog with release date
const today = new Date().toISOString().split('T')[0];
let changelog = readFileSync("CHANGELOG.md", "utf8");
changelog = changelog.replace(
`## [${targetVersion}] - 2025-01-XX`,
`## [${targetVersion}] - ${today}`
);
writeFileSync("CHANGELOG.md", changelog);
// run build to ensure main.js is updated
console.log("Building plugin...");
try {
execSync("npm run build", { stdio: "inherit" });
console.log("Build completed successfully");
} catch (error) {
console.error("Build failed:", error.message);
process.exit(1);
}