forked from ToolJet/ToolJet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-version.js
30 lines (24 loc) · 1.13 KB
/
update-version.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// As we are maintaining three .version files, this script will help in updating it one go
const fs = require('fs');
const path = require('path');
// Get the new version from the command-line arguments
const newVersion = process.argv[2];
if (!newVersion) {
console.error('Usage: node update-version.js <new-version>');
process.exit(1);
}
// Function to update version in a file
function updateVersion(filePath, newVersion) {
const content = fs.readFileSync(filePath, 'utf-8');
const updatedContent = content.replace(/\d+\.\d+\.\d+/, newVersion);
fs.writeFileSync(filePath, updatedContent, 'utf-8');
console.log(`Updated version in ${filePath} to ${newVersion}`);
}
// Update version in both server and client folders
const versionPath = path.join(__dirname, '.version')
const serverVersionFilePath = path.join(__dirname, 'server', '.version');
const frontendVersionFilePath = path.join(__dirname, 'frontend', '.version');
updateVersion(versionPath,newVersion)
updateVersion(serverVersionFilePath, newVersion);
updateVersion(frontendVersionFilePath, newVersion);
// eg.---> npm run update-version <version> ---> npm run update-version 3.0.0