Require directly, don't spawn

This commit is contained in:
Joe Stanton
2015-05-14 15:18:44 +01:00
parent 132f8fa3ce
commit 2e2e577a09
5 changed files with 79 additions and 114 deletions

View File

@@ -85,31 +85,17 @@ function init(name) {
start: 'node_modules/react-native/packager/packager.sh'
}
};
fs.writeFileSync(
path.join(root, 'package.json'),
JSON.stringify(packageJson, null, 2)
);
fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify(packageJson));
process.chdir(root);
var initCmd = path.resolve(__dirname, '..', 'init.sh') + ' ' + projectName;
run(initCmd, function(e) {
run('npm install --save react-native', function(e) {
if (e) {
console.error('initialization failed');
console.error('`npm install --save react-native` failed');
process.exit(1);
}
run('npm install --save react-native', function(e) {
if (e) {
console.error('`npm install --save react-native` failed');
process.exit(1);
}
console.log('Next steps:');
console.log('');
console.log(' Open ' + path.join(root, projectName) + '.xcodeproj in Xcode');
console.log(' Hit Run button');
console.log('');
});
var cli = require(CLI_MODULE_PATH());
cli.init(root, projectName);
});
}