local-cli/init/init.js
/**
 * Creates the template for a React Native project given the provided
 * parameters:
 * @param projectDir Templates will be copied here.
 * @param argsOrName Project name or full list of custom arguments
 *                   for the generator.
 * @param options Command line options passed from the react-native-cli directly.
 *                E.g. `{ version: '0.43.0', template: 'navigation' }`
 */
Creates the template for a React Native project given the provided
parameters:
@param projectDir Templates will be copied here.
@param argsOrName Project name or full list of custom arguments
for the generator.
@param options Command line options passed from the react-native-cli directly.
Creates the template for a React Native project given the provided parameters : @param projectDir Templates will be copied here . @param argsOrName Project name or full list of custom arguments for the generator . @param options Command line options passed from the react - native - cli directly .
function init(projectDir, argsOrName) {
  const args = Array.isArray(argsOrName)
    ? argsOrName 
    : [argsOrName].concat(process.argv.slice(4)); 
  if (!args || args.length === 0) {
    console.error('react-native init requires a project name.');
    return;
  }
  const newProjectName = args[0];
  const options = minimist(args);
  if (listTemplatesAndExit(newProjectName, options)) {
    return;
  } else {
    console.log('Setting up new React Native app in ' + projectDir);
    generateProject(projectDir, newProjectName, options);
  }
}
function init ( projectDir , argsOrName ) { const args = Array . isArray ( argsOrName ) ? argsOrName : [ argsOrName ] . concat ( process . argv . slice ( 4 ) ) ; if ( ! args || args . length === 0 ) { console . error ( 'react-native init requires a project name.' ) ; return ; } const newProjectName = args [ 0 ] ; const options = minimist ( args ) ; if ( listTemplatesAndExit ( newProjectName , options ) ) { return ; } else { console . log ( 'Setting up new React Native app in ' + projectDir ) ; generateProject ( projectDir , newProjectName , options ) ; } }
Creates the template for a React Native project given the provided
 parameters:
 @param projectDir Templates will be copied here.
Creates the template for a React Native project given the provided parameters : @param projectDir Templates will be copied here .
// argsOrName was e.g. ['AwesomeApp', '--verbose'] // argsOrName was e.g. 'AwesomeApp' // args array is e.g. ['AwesomeApp', '--verbose', '--template', 'navigation'] // Just listing templates using 'react-native init --template' // Not creating a new app.