2023-04-21 15:11:21 +02:00
|
|
|
const fs = require("fs")
|
2023-05-05 14:23:14 +02:00
|
|
|
const semver = require("semver")
|
2023-04-21 15:11:21 +02:00
|
|
|
|
2023-06-26 12:53:29 +02:00
|
|
|
const filePath = "../lerna.json"
|
2023-04-21 15:11:21 +02:00
|
|
|
const versionBump = process.argv[2] || "patch"
|
|
|
|
|
|
|
|
// Read and parse lerna.json file
|
|
|
|
const fileData = fs.readFileSync(filePath)
|
|
|
|
const lernaData = JSON.parse(fileData)
|
|
|
|
|
|
|
|
const currentVersion = lernaData.version
|
|
|
|
|
2023-05-05 14:23:14 +02:00
|
|
|
const newVersion = semver.inc(currentVersion, versionBump, "alpha")
|
2023-04-21 15:11:21 +02:00
|
|
|
|
|
|
|
// Update lerna.json file with new version
|
|
|
|
lernaData.version = newVersion
|
|
|
|
const updatedData = JSON.stringify(lernaData, null, 2)
|
|
|
|
fs.writeFileSync(filePath, updatedData)
|
|
|
|
|
|
|
|
console.log(`Updated version from ${currentVersion} to ${newVersion}`)
|