Skip to content

Commit

Permalink
add —use-npm flag to bypass yarn
Browse files Browse the repository at this point in the history
  • Loading branch information
tabrindle committed Nov 4, 2017
1 parent dc95d18 commit 547ad01
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/create-react-app/createReactApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const program = new commander.Command(packageJson.name)
'--scripts-version <alternative-package>',
'use a non-standard version of react-scripts'
)
.option('--use-npm')
.allowUnknownOption()
.on('--help', () => {
console.log(` Only ${chalk.green('<project-directory>')} is required.`);
Expand Down Expand Up @@ -133,10 +134,11 @@ createApp(
projectName,
program.verbose,
program.scriptsVersion,
program.useNpm,
hiddenProgram.internalTestingTemplate
);

function createApp(name, verbose, version, template) {
function createApp(name, verbose, version, useNpm, template) {
const root = path.resolve(name);
const appName = path.basename(root);

Expand All @@ -159,7 +161,7 @@ function createApp(name, verbose, version, template) {
JSON.stringify(packageJson, null, 2)
);

const useYarn = shouldUseYarn();
const useYarn = useNpm ? false : shouldUseYarn();
const originalDirectory = process.cwd();
process.chdir(root);
if (!useYarn && !checkThatNpmCanReadCwd()) {
Expand Down

0 comments on commit 547ad01

Please sign in to comment.