Files
huly-platform/foundations/utils/packages/platform-rig/bin/bump-package-version.js
T
Denis Bykhov 16b1109180 Add 'foundations/utils/' from commit '063b52c1cac395319e99d017986c35abe6b79deb'
git-subtree-dir: foundations/utils
git-subtree-mainline: 6ea92dd409
git-subtree-split: 063b52c1ca
2025-11-26 22:56:34 +05:00

28 lines
831 B
JavaScript
Executable File

//
// Copyright © 2022 Hardcore Engineering Inc.
//
const child_process = require('child_process')
child_process.exec('git describe --tags --abbrev=0', (err, stdout, stderr) => {
if (err !== null) {
if (err.message.includes('No names found')) {
console.log('No git version available')
return
}
console.log('Error', err)
process.exit(1)
}
const rawVersion = stdout.trim().replace('v', '').replace('u', '').replace('s', '').split('.')
if (rawVersion.length === 3) {
const version = {
major: parseInt(rawVersion[0]),
minor: parseInt(rawVersion[1]),
patch: parseInt(rawVersion[2])
}
const versionStr = `${version.major}.${version.minor}.${version.patch}`
console.log(`Setting version to ${versionStr}`)
child_process.exec(`npm version ${versionStr}`)
}
})