react-native/local-cli/init.js

18 lines
496 B
JavaScript
Raw Normal View History

2015-05-14 14:18:44 +00:00
'use strict';
var path = require('path');
2015-03-28 15:50:31 +00:00
var utils = require('./generator-utils');
var yeoman = require('yeoman-environment');
2015-05-14 14:18:44 +00:00
function init(projectDir, appName) {
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 generator = env.create('react:app', {args: [appName]});
generator.destinationRoot(projectDir);
generator.run();
2015-05-14 14:18:44 +00:00
}
module.exports = init;