diff --git a/gulp/increment_version.js b/gulp/increment_version.js index cffa7e56..f8c1ec8a 100644 --- a/gulp/increment_version.js +++ b/gulp/increment_version.js @@ -16,10 +16,16 @@ version = version.split('.') version[2] = parseInt(version[2]) + 1 //put it back in semver version = version.join('.') -console.log(`incrementing to version ${version}`) //write it to the package.json const packageFile = '../package.json' 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 fs.writeFileSync(packageFile, JSON.stringify(package, undefined, ' '))