Merge pull request #1142 from frantic/init-in-existing-project

Warn if `init` is called from existing project
This commit is contained in:
Christopher Chedeau 2015-05-13 18:13:33 -07:00
commit b63905f7f9
1 changed files with 11 additions and 0 deletions

View File

@ -21,6 +21,14 @@ function printUsage() {
process.exit(1); process.exit(1);
} }
function printInitWarning() {
console.log([
'Looks like React Native project already exists in the current',
'folder. Run this command from a different folder or remove node_modules/react-native'
].join('\n'));
process.exit(1);
}
function run() { function run() {
var args = process.argv.slice(2); var args = process.argv.slice(2);
if (args.length === 0) { if (args.length === 0) {
@ -41,6 +49,9 @@ function run() {
case 'bundle': case 'bundle':
bundle.init(args); bundle.init(args);
break; break;
case 'init':
printInitWarning();
break;
default: default:
console.error('Command `%s` unrecognized', args[0]); console.error('Command `%s` unrecognized', args[0]);
printUsage(); printUsage();