MCPcopy Create free account
hub / github.com/react/create-react-app / init

Function init

packages/create-react-app/createReactApp.js:58–233  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56let projectName;
57
58function init() {
59 const program = new commander.Command(packageJson.name)
60 .version(packageJson.version)
61 .arguments('<project-directory>')
62 .usage(`${chalk.green('<project-directory>')} [options]`)
63 .action(name => {
64 projectName = name;
65 })
66 .option('--verbose', 'print additional logs')
67 .option('--info', 'print environment debug info')
68 .option(
69 '--scripts-version <alternative-package>',
70 'use a non-standard version of react-scripts'
71 )
72 .option(
73 '--template <path-to-template>',
74 'specify a template for the created project'
75 )
76 .option('--use-pnp')
77 .allowUnknownOption()
78 .on('--help', () => {
79 console.log(
80 ` Only ${chalk.green('<project-directory>')} is required.`
81 );
82 console.log();
83 console.log(
84 ` A custom ${chalk.cyan('--scripts-version')} can be one of:`
85 );
86 console.log(` - a specific npm version: ${chalk.green('0.8.2')}`);
87 console.log(` - a specific npm tag: ${chalk.green('@next')}`);
88 console.log(
89 ` - a custom fork published on npm: ${chalk.green(
90 'my-react-scripts'
91 )}`
92 );
93 console.log(
94 ` - a local path relative to the current working directory: ${chalk.green(
95 'file:../my-react-scripts'
96 )}`
97 );
98 console.log(
99 ` - a .tgz archive: ${chalk.green(
100 'https://mysite.com/my-react-scripts-0.8.2.tgz'
101 )}`
102 );
103 console.log(
104 ` - a .tar.gz archive: ${chalk.green(
105 'https://mysite.com/my-react-scripts-0.8.2.tar.gz'
106 )}`
107 );
108 console.log(
109 ` It is not needed unless you specifically want to use a fork.`
110 );
111 console.log();
112 console.log(` A custom ${chalk.cyan('--template')} can be one of:`);
113 console.log(
114 ` - a custom template published on npm: ${chalk.green(
115 'cra-template-typescript'

Callers 1

index.jsFile · 0.70

Calls 4

checkForLatestVersionFunction · 0.85
isUsingYarnFunction · 0.85
createAppFunction · 0.85
toStringMethod · 0.80

Tested by

no test coverage detected