2024-02-16 22:11:38 +03:00
|
|
|
const fs = require('fs');
|
|
|
|
const semver = require('semver');
|
|
|
|
const path = require('path');
|
2023-10-15 00:04:35 +03:00
|
|
|
|
|
|
|
// Get the version argument from the command line
|
|
|
|
const [, , version] = process.argv;
|
|
|
|
|
|
|
|
if (!semver.valid(version)) {
|
|
|
|
console.error(
|
2024-02-16 22:11:38 +03:00
|
|
|
'Invalid version. The format should be X.X.X where X is a positive integer (or 0).',
|
2023-10-15 00:04:35 +03:00
|
|
|
);
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
2024-02-16 22:11:38 +03:00
|
|
|
const frontPackageJson = path.join(__dirname, '../twenty-front/package.json');
|
|
|
|
const serverPackageJson = path.join(__dirname, '../twenty-server/package.json');
|
|
|
|
const emailPackageJson = path.join(__dirname, '../twenty-emails/package.json');
|
2023-10-15 00:04:35 +03:00
|
|
|
|
|
|
|
// Update package.json
|
2024-02-16 22:11:38 +03:00
|
|
|
for (let file of [
|
|
|
|
frontPackageJson,
|
|
|
|
serverPackageJson,
|
|
|
|
docsPackageJson,
|
|
|
|
emailPackageJson,
|
|
|
|
]) {
|
2023-10-15 00:04:35 +03:00
|
|
|
let pkgdata = JSON.parse(fs.readFileSync(file));
|
|
|
|
pkgdata.version = version;
|
2024-02-16 22:11:38 +03:00
|
|
|
fs.writeFileSync(file, JSON.stringify(pkgdata, null, 2), 'utf8');
|
2023-10-15 00:04:35 +03:00
|
|
|
}
|