1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-12-20 23:31:30 +03:00
leon/scripts/release/update-version.js

31 lines
679 B
JavaScript
Raw Normal View History

import { command } from 'execa'
2019-02-10 15:26:50 +03:00
import log from '@/helpers/log'
/**
* Update version number in files which need version number
2019-02-10 15:26:50 +03:00
*/
2021-03-15 20:39:52 +03:00
export default (version) => new Promise(async (resolve, reject) => {
2019-02-10 15:26:50 +03:00
log.info('Updating version...')
const promises = []
const files = [
'package.json',
'package-lock.json'
]
for (let i = 0; i < files.length; i += 1) {
promises.push(command(`json -I -f ${files[i]} -e 'this.version="${version}"'`, { shell: true }))
2019-02-10 15:26:50 +03:00
}
try {
await Promise.all(promises)
log.success(`Version updated to ${version}`)
resolve()
} catch (e) {
log.error(`Error while updating version: ${e.stderr}`)
reject(e)
}
})