[rrm] Move version reading up to app level

This commit is contained in:
Paul O’Shannessy
2016-07-21 13:40:53 -07:00
committed by Dan Abramov
parent 6938157c76
commit bbf6079ca3
2 changed files with 6 additions and 4 deletions

View File

@@ -60,6 +60,10 @@ function gitCherryPickMerge(sha) {
}
}
function getReactVersion() {
return (JSON.parse(fs.readFileSync(path.join(PATH_TO_REPO, 'package.json'), 'utf8'))).version;
}
const app = {
vorpal,
@@ -93,6 +97,7 @@ const app = {
this.writeTo = writeTo;
this.execInRepo = execInRepo;
this.gitCherryPickMerge = gitCherryPickMerge;
this.getReactVersion = getReactVersion;
// Register commands
[

View File

@@ -47,11 +47,8 @@ module.exports = function(vorpal, app) {
.command('version')
.description('Update the version of React, useful while publishing')
.action(function (args, actionCB) {
const PATH_TO_PACKAGE = path.join(app.PATH_TO_REPO, 'package.json');
let packageJSON = JSON.parse(fs.readFileSync(PATH_TO_PACKAGE, 'utf8'));
let currentVersion = packageJSON.version;
let currentVersion = app.getReactVersion()
// TODO: See if we can do a better job for handling pre* bumps. The ones
// semver adds are of the form -0, but we've used -alpha.0 or -rc.0.