@samitouri / QOS-React-2 / commits / 91f957cb1d

[rrm] Move version reading up to app level

Paul O’Shannessy committed Jul 21, 2016 at 13:40 UTC 91f957cb1dd4997f5c4230987973450e51383438
2 files changed +6 -4
scripts/release-manager/cli.js
+5
@@ -60,6 +60,10 @@ function gitCherryPickMerge(sha) {
60 }
61 }
62
63 +function getReactVersion() {
64 + return (JSON.parse(fs.readFileSync(path.join(PATH_TO_REPO, 'package.json'), 'utf8'))).version;
65 +}
66 +
67 const app = {
68 vorpal,
69
@@ -93,6 +97,7 @@ const app = {
97 this.writeTo = writeTo;
98 this.execInRepo = execInRepo;
99 this.gitCherryPickMerge = gitCherryPickMerge;
100 + this.getReactVersion = getReactVersion;
101
102 // Register commands
103 [
scripts/release-manager/commands/version.js
+1 -4
@@ -47,11 +47,8 @@ module.exports = function(vorpal, app) {
47 .command('version')
48 .description('Update the version of React, useful while publishing')
49 .action(function (args, actionCB) {
50 - const PATH_TO_PACKAGE = path.join(app.PATH_TO_REPO, 'package.json');
50
52 - let packageJSON = JSON.parse(fs.readFileSync(PATH_TO_PACKAGE, 'utf8'));
53 -
54 - let currentVersion = packageJSON.version;
51 + let currentVersion = app.getReactVersion()
52
53 // TODO: See if we can do a better job for handling pre* bumps. The ones
54 // semver adds are of the form -0, but we've used -alpha.0 or -rc.0.