mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-08 17:46:35 +08:00
Summary: Fix #20991 - use name from `app.json` if available, instead of using `package.json`. Pull Request resolved: https://github.com/facebook/react-native/pull/20992 Differential Revision: D13422928 Pulled By: hramos fbshipit-source-id: 72dd07e82a366439f663508b07c1de5ca59b9dbf
This commit is contained in:
committed by
Facebook Github Bot
parent
0314fca63a
commit
f59d79caba
11
react-native-git-upgrade/cliEntry.js
vendored
11
react-native-git-upgrade/cliEntry.js
vendored
@@ -114,10 +114,18 @@ function readPackageFiles(useYarn) {
|
||||
'package.json',
|
||||
);
|
||||
const pakPath = path.resolve(process.cwd(), 'package.json');
|
||||
const appPath = path.resolve(process.cwd(), 'app.json');
|
||||
let app = null;
|
||||
try {
|
||||
app = parseJsonFile(appPath);
|
||||
} catch (err) {
|
||||
log.warn('Unable to parse app.json', err.message);
|
||||
}
|
||||
return {
|
||||
reactNativeNodeModulesPak: parseJsonFile(reactNativeNodeModulesPakPath),
|
||||
reactNodeModulesPak: parseJsonFile(reactNodeModulesPakPath),
|
||||
pak: parseJsonFile(pakPath),
|
||||
app: app,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -305,8 +313,9 @@ async function run(requestedVersion, cliArgs) {
|
||||
reactNativeNodeModulesPak,
|
||||
reactNodeModulesPak,
|
||||
pak,
|
||||
app,
|
||||
} = readPackageFiles(useYarn);
|
||||
const appName = pak.name;
|
||||
const appName = (app && app.name) || pak.name;
|
||||
const currentVersion = reactNativeNodeModulesPak.version;
|
||||
const currentReactVersion = reactNodeModulesPak.version;
|
||||
const declaredVersion = pak.dependencies['react-native'];
|
||||
|
||||
Reference in New Issue
Block a user