local-cli/generator/templates.js
/**
 * @param destPath Create the new project at this path.
 * @param newProjectName For example 'AwesomeApp'.
 * @param template Template to use, for example 'navigation'.
 * @param yarnVersion Version of yarn available on the system, or null if
 *                    yarn is not available. For example '0.18.1'.
 */
@param destPath Create the new project at this path.
@param destPath Create the new project at this path .
function createProjectFromTemplate(destPath, newProjectName, template, yarnVersion) {
  copyProjectTemplateAndReplace(
    path.resolve('node_modules', 'react-native-macos', 'local-cli', 'templates', 'HelloWorld'),
    destPath,
    newProjectName
  );
  if (template === undefined) {
    return;
  }
  const builtInTemplateName = builtInTemplates[template];
  if (builtInTemplateName) {
    createFromBuiltInTemplate(builtInTemplateName, destPath, newProjectName, yarnVersion);
  } else {
    createFromRemoteTemplate(template, destPath, newProjectName, yarnVersion);
  }
}
function createProjectFromTemplate ( destPath , newProjectName , template , yarnVersion ) { copyProjectTemplateAndReplace ( path . resolve ( 'node_modules' , 'react-native-macos' , 'local-cli' , 'templates' , 'HelloWorld' ) , destPath , newProjectName ) ; if ( template === undefined ) { return ; } const builtInTemplateName = builtInTemplates [ template ] ; if ( builtInTemplateName ) { createFromBuiltInTemplate ( builtInTemplateName , destPath , newProjectName , yarnVersion ) ; } else { createFromRemoteTemplate ( template , destPath , newProjectName , yarnVersion ) ; } }
@param destPath Create the new project at this path.
@param destPath Create the new project at this path .
// Expand the basic 'HelloWorld' template // No specific template, use just the HelloWorld template above // Keep the files from the 'HelloWorld' template, and overwrite some of them // with the specified project template. // The 'HelloWorld' template contains the native files (these are used by // all templates) and every other template only contains additional JS code. // Reason: // This way we don't have to duplicate the native files in every template. // If we duplicated them we'd make RN larger and risk that people would // forget to maintain all the copies so they would go out of sync. // template is e.g. 'navigation', // use the built-in local-cli/templates/HelloNavigation folder // template is e.g. 'ignite', // use the template react-native-template-ignite from npm