ToolJet/update-version.js
Nakul Nagargade c609fe2a78
Setup sentry logging as per version and upload its source map (#7143)
* Added a fix for snake case properties

* Setup sentry logging as per version and upload its source map

* Remove version

* Fix process not being defined

* Add version to sentry release

* Add release version in config api

* Changes in docker file

* Create a version file in frontend

* Remove docker changes

* fix

* Add a script to bump .version files

---------

Co-authored-by: Muhsin Shah <[email protected]>
2023-09-04 10:00:14 +05:30

30 lines
No EOL
1.1 KiB
JavaScript

// 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