Merge pull request #3196 from foghina/cli_backwards_compat

[cli] make init backwards-compatible
This commit is contained in:
Felix Oghină 2015-10-02 15:05:03 +01:00
commit 0a13cd0480
1 changed files with 2 additions and 1 deletions

View File

@ -3,10 +3,11 @@
var path = require('path');
var yeoman = require('yeoman-environment');
function init(projectDir, args) {
function init(projectDir, argsOrName) {
console.log('Setting up new React Native app in ' + projectDir);
var env = yeoman.createEnv();
env.register(require.resolve(path.join(__dirname, 'generator')), 'react:app');
var args = Array.isArray(argsOrName) ? argsOrName : [argsOrName].concat(process.args.slice(4));
var generator = env.create('react:app', {args: args});
generator.destinationRoot(projectDir);
generator.run();