mirror of
https://github.com/facebook/react.git
synced 2026-02-26 00:44:59 +00:00
[rrm] Move version reading up to app level
This commit is contained in:
committed by
Dan Abramov
parent
6938157c76
commit
bbf6079ca3
@@ -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
|
||||
[
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user