I am trying to pass an option (like --template flag) to React CRA CLI, as proposed in https://github.com/facebook/create-react-app/issues/9502.
That is, when we run npx create-react-app my-app --skip-git, it should create the react app without initializing a git repository.
I forked the repo and attempted to create a variable and option as --skip-git (like in angular cli, nestjs cli) in the createReactApp.js.
createReactApp.js
const program = new commander.Command(packageJson.name)
.version(packageJson.version)
.arguments('<project-directory>')
.usage(`${chalk.green('<project-directory>')} [options]`)
.action(name => {
projectName = name;
})
.option('--verbose', 'print additional logs')
.optioninfonfo', 'print environment debug info')
.option(
'--scripts-version <alternative-package>',
'use a non-standard version of react-scripts'
)
.option(
'--template <path-to-template>',
'specify a template for the created project'
)
.option('--use-pnp')
.option('--skip-git', 'Allow to skip git repository initialization.')
This worked locally. When I ran npx create-react-app my-app --skip-git, the createReactApp.js detected the flag and I was even able to console if the flag passed or not.
But when I try to apply changes in react-scripts/scripts/init.js, it is not reflected locally. For eg:
let initializedGit = false;
if (tryGitInit()) {
initializedGit = true;
console.log();
console.log('Initialized a git repo.');
}
Here I just changed 'repository' to 'repo' (verifying if the changes are reflected), but it is not reflected in my local.
How do I make changes in the init.js file and verify in local to create a PR?