twenty/packages/twenty-utils/release.js
Charles Bochet 68a6250757 Bump version
2023-12-21 23:52:45 +01:00

24 lines
732 B
JavaScript

const fs = require("fs");
const semver = require("semver");
const path = require("path");
// Get the version argument from the command line
const [, , version] = process.argv;
if (!semver.valid(version)) {
console.error(
"Invalid version. The format should be X.X.X where X is a positive integer (or 0)."
);
process.exit(1);
}
const FrontPackageJson = path.join(__dirname, "../twenty-front/package.json");
const ServerPackageJson = path.join(__dirname, "../twenty-server/package.json");
// Update package.json
for (let file of [FrontPackageJson, ServerPackageJson]) {
let pkgdata = JSON.parse(fs.readFileSync(file));
pkgdata.version = version;
fs.writeFileSync(file, JSON.stringify(pkgdata, null, 2), "utf8");
}