[cli] suppress yeoman create output in init
This commit is contained in:
parent
799168929c
commit
aa63636512
|
@ -2,6 +2,15 @@
|
||||||
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var yeoman = require('yeoman-environment');
|
var yeoman = require('yeoman-environment');
|
||||||
|
var TerminalAdapter = require('yeoman-environment/lib/adapter.js');
|
||||||
|
|
||||||
|
class CreateSuppressingTerminalAdapter extends TerminalAdapter {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
// suppres 'create' output generated by yeoman
|
||||||
|
this.log.create = function() {};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// argsOrName can be:
|
// argsOrName can be:
|
||||||
// - A string (e.g. 'AwesomeApp'). This is the common case when
|
// - A string (e.g. 'AwesomeApp'). This is the common case when
|
||||||
|
@ -10,7 +19,7 @@ var yeoman = require('yeoman-environment');
|
||||||
// need to pass custom arguments to the generator.
|
// need to pass custom arguments to the generator.
|
||||||
function init(projectDir, argsOrName) {
|
function init(projectDir, argsOrName) {
|
||||||
console.log('Setting up new React Native app in ' + projectDir);
|
console.log('Setting up new React Native app in ' + projectDir);
|
||||||
var env = yeoman.createEnv();
|
var env = yeoman.createEnv(undefined, undefined, new CreateSuppressingTerminalAdapter());
|
||||||
env.register(require.resolve(path.join(__dirname, 'generator')), 'react:app');
|
env.register(require.resolve(path.join(__dirname, 'generator')), 'react:app');
|
||||||
// argv is e.g.
|
// argv is e.g.
|
||||||
// ['node', 'react-native', 'init', 'AwesomeApp', '--verbose']
|
// ['node', 'react-native', 'init', 'AwesomeApp', '--verbose']
|
||||||
|
|
Loading…
Reference in New Issue