mirror of
https://github.com/status-im/react-native.git
synced 2025-01-16 12:34:17 +00:00
144f8598c2
Summary: @public We're rolling out a replacement for `local-cli`. As part of the process we moved many hardcoded values into a JS based configuration file. Reviewed By: @vjeux Differential Revision: D2533111 fb-gh-sync-id: 7250bddee9989b089ded409104e098ef15d79498
74 lines
2.0 KiB
JavaScript
74 lines
2.0 KiB
JavaScript
'use strict';
|
|
|
|
var path = require('path');
|
|
var yeoman = require('yeoman-generator');
|
|
var utils = require('../generator-utils');
|
|
|
|
module.exports = yeoman.generators.NamedBase.extend({
|
|
constructor: function() {
|
|
yeoman.generators.NamedBase.apply(this, arguments);
|
|
|
|
this.option('skip-ios', {
|
|
desc: 'Skip generating iOS files',
|
|
type: Boolean,
|
|
defaults: false
|
|
});
|
|
this.option('skip-android', {
|
|
desc: 'Skip generating Android files',
|
|
type: Boolean,
|
|
defaults: false
|
|
});
|
|
|
|
// this passes command line arguments down to the composed generators
|
|
var args = arguments[0];
|
|
if (!this.options['skip-ios']) {
|
|
this.composeWith('react:ios', {args: args}, {
|
|
local: require.resolve(path.resolve(__dirname, '..', 'generator-ios'))
|
|
});
|
|
}
|
|
if (!this.options['skip-android']) {
|
|
this.composeWith('react:android', {args: args}, {
|
|
local: require.resolve(path.resolve(__dirname, '..', 'generator-android'))
|
|
});
|
|
}
|
|
},
|
|
|
|
configuring: function() {
|
|
utils.copyAndReplace(
|
|
this.templatePath('../../../.flowconfig'),
|
|
this.destinationPath('.flowconfig'),
|
|
{ 'Libraries\/react-native\/react-native-interface.js' : 'node_modules/react-native/Libraries/react-native/react-native-interface.js' }
|
|
);
|
|
|
|
this.fs.copy(
|
|
this.templatePath('rn-cli.config.js'),
|
|
this.destinationPath('rn-cli.config.js')
|
|
);
|
|
this.fs.copy(
|
|
this.templatePath('_gitignore'),
|
|
this.destinationPath('.gitignore')
|
|
);
|
|
this.fs.copy(
|
|
this.templatePath('_watchmanconfig'),
|
|
this.destinationPath('.watchmanconfig')
|
|
);
|
|
},
|
|
|
|
writing: function() {
|
|
if (!this.options['skip-ios']) {
|
|
this.fs.copyTpl(
|
|
this.templatePath('index.ios.js'),
|
|
this.destinationPath('index.ios.js'),
|
|
{name: this.name}
|
|
);
|
|
}
|
|
if (!this.options['skip-android']) {
|
|
this.fs.copyTpl(
|
|
this.templatePath('index.android.js'),
|
|
this.destinationPath('index.android.js'),
|
|
{name: this.name}
|
|
);
|
|
}
|
|
}
|
|
});
|