mirror of
https://github.com/status-im/react-native.git
synced 2025-02-04 05:34:15 +00:00
CLI errors if no package.json is found
Summary: If you don't have a `package.json` in your project you can't do anything with the cli as it errors. This fixes that by wrapping the reading of the `package.json` file and returns `my-react-native-app` if an error is caught. Closes https://github.com/facebook/react-native/pull/10207 Differential Revision: D4022113 Pulled By: javache fbshipit-source-id: ffe940160f9d0b58e630adfab5e0dc9d34b859e5
This commit is contained in:
parent
b77b760810
commit
41f4f1eaaf
@ -25,8 +25,14 @@ module.exports = {
|
|||||||
func: android,
|
func: android,
|
||||||
options: [{
|
options: [{
|
||||||
command: '--project-name [name]',
|
command: '--project-name [name]',
|
||||||
default: () => JSON.parse(
|
default: () => {
|
||||||
fs.readFileSync('package.json', 'utf8')
|
try {
|
||||||
).name,
|
return JSON.parse(
|
||||||
|
fs.readFileSync('package.json', 'utf8')
|
||||||
|
).name
|
||||||
|
} catch (e) {
|
||||||
|
return 'unknown-app-name'
|
||||||
|
}
|
||||||
|
},
|
||||||
}],
|
}],
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user