mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 03:26:07 +00:00
Hide npm output when doing react-native init
This commit is contained in:
parent
3309f6da80
commit
2ddf3d942d
21
react-native-cli/index.js
vendored
21
react-native-cli/index.js
vendored
@ -6,7 +6,7 @@
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var spawn = require('child_process').spawn;
|
||||
var exec = require('child_process').exec;
|
||||
var prompt = require("prompt");
|
||||
|
||||
var CLI_MODULE_PATH = function() {
|
||||
@ -131,8 +131,11 @@ function createProject(name) {
|
||||
fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify(packageJson));
|
||||
process.chdir(root);
|
||||
|
||||
run('npm install --save react-native', function(e) {
|
||||
console.log('Installing react-native package from npm...');
|
||||
exec('npm install --save react-native', function(e, stdout, stderr) {
|
||||
if (e) {
|
||||
console.log(stdout);
|
||||
console.error(stderr);
|
||||
console.error('`npm install --save react-native` failed');
|
||||
process.exit(1);
|
||||
}
|
||||
@ -141,17 +144,3 @@ function createProject(name) {
|
||||
cli.init(root, projectName);
|
||||
});
|
||||
}
|
||||
|
||||
function run(command, cb) {
|
||||
var parts = command.split(/\s+/);
|
||||
var cmd = parts[0];
|
||||
var args = parts.slice(1);
|
||||
var proc = spawn(cmd, args, {stdio: 'inherit'});
|
||||
proc.on('close', function(code) {
|
||||
if (code !== 0) {
|
||||
cb(new Error('Command exited with a non-zero status'));
|
||||
} else {
|
||||
cb(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user