use package version if it is the latest

This commit is contained in:
Yotam Mann 2017-09-17 12:51:33 -04:00
parent 888ea80ea1
commit ccd8681a99

View file

@ -16,10 +16,16 @@ version = version.split('.')
version[2] = parseInt(version[2]) + 1 version[2] = parseInt(version[2]) + 1
//put it back in semver //put it back in semver
version = version.join('.') version = version.join('.')
console.log(`incrementing to version ${version}`)
//write it to the package.json //write it to the package.json
const packageFile = '../package.json' const packageFile = '../package.json'
const package = JSON.parse(fs.readFileSync(packageFile, 'utf-8')) const package = JSON.parse(fs.readFileSync(packageFile, 'utf-8'))
//if the package version if the latest, go with that one
if (semver.gt(package.version, version)){
version = package.version
}
console.log(`incrementing to version ${version}`)
package.version = version package.version = version
fs.writeFileSync(packageFile, JSON.stringify(package, undefined, ' ')) fs.writeFileSync(packageFile, JSON.stringify(package, undefined, ' '))