mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Prettier the rest of ReactNative
Reviewed By: yungsters Differential Revision: D7974340 fbshipit-source-id: 5fe457a8a9be4bd360fc3af9acb5c1136b2be0d7
This commit is contained in:
committed by
Facebook Github Bot
parent
aba4ec0c09
commit
36fcbaa56d
29
react-native-git-upgrade/checks.js
vendored
29
react-native-git-upgrade/checks.js
vendored
@@ -3,7 +3,10 @@
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const {execSync} = require('child_process');
|
||||
@@ -12,7 +15,7 @@ const semver = require('semver');
|
||||
function checkDeclaredVersion(declaredVersion) {
|
||||
if (!declaredVersion) {
|
||||
throw new Error(
|
||||
'Your "package.json" file doesn\'t seem to have "react-native" as a dependency.'
|
||||
'Your "package.json" file doesn\'t seem to have "react-native" as a dependency.',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -20,11 +23,15 @@ function checkDeclaredVersion(declaredVersion) {
|
||||
function checkMatchingVersions(currentVersion, declaredVersion, useYarn) {
|
||||
if (!semver.satisfies(currentVersion, declaredVersion)) {
|
||||
throw new Error(
|
||||
'react-native version in "package.json" (' + declaredVersion + ') doesn\'t match ' +
|
||||
'the installed version in "node_modules" (' + currentVersion + ').\n' +
|
||||
(useYarn ?
|
||||
'Try running "yarn" to fix this.' :
|
||||
'Try running "npm install" to fix this.')
|
||||
'react-native version in "package.json" (' +
|
||||
declaredVersion +
|
||||
") doesn't match " +
|
||||
'the installed version in "node_modules" (' +
|
||||
currentVersion +
|
||||
').\n' +
|
||||
(useYarn
|
||||
? 'Try running "yarn" to fix this.'
|
||||
: 'Try running "npm install" to fix this.'),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -33,10 +40,10 @@ function checkReactPeerDependency(currentVersion, declaredReactVersion) {
|
||||
if (semver.lt(currentVersion, '0.21.0') && !declaredReactVersion) {
|
||||
throw new Error(
|
||||
'Your "package.json" file doesn\'t seem to have "react" as a dependency.\n' +
|
||||
'"react" was changed from a dependency to a peer dependency in react-native v0.21.0.\n' +
|
||||
'Therefore, it\'s necessary to include "react" in your project\'s dependencies.\n' +
|
||||
'Please run "npm install --save react", then re-run ' +
|
||||
'"react-native upgrade".'
|
||||
'"react" was changed from a dependency to a peer dependency in react-native v0.21.0.\n' +
|
||||
'Therefore, it\'s necessary to include "react" in your project\'s dependencies.\n' +
|
||||
'Please run "npm install --save react", then re-run ' +
|
||||
'"react-native upgrade".',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -47,7 +54,7 @@ function checkGitAvailable() {
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
'"react-native-git-upgrade" requires "git" to be available in path. ' +
|
||||
'Please install Git (https://git-scm.com)"'
|
||||
'Please install Git (https://git-scm.com)"',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user