Created
February 25, 2025 18:55
-
-
Save levancho/e00855c3ec759322689957a99a157c3b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const path = require('path'); | |
// Read version from version-tag file | |
const versionTagPath = path.join(__dirname, 'version-tag'); | |
const packageJsonPath = path.join(__dirname, 'package.json'); | |
const version = fs.readFileSync(versionTagPath, 'utf-8').trim(); | |
if (!version) { | |
console.error('No version found in version-tag file'); | |
process.exit(1); | |
} | |
// Read package.json and update the version property | |
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')); | |
packageJson.version = version; | |
// Write updated package.json back to disk | |
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2)); | |
console.log(`Updated package.json to version ${version}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment