From 312d2ed865ee7ce069dd706808930d50e4f75e8f Mon Sep 17 00:00:00 2001 From: "Tyler D. Franklin" Date: Fri, 16 Feb 2018 16:13:40 -0600 Subject: [PATCH 1/2] testing changes --- packages/create-react-app/createReactApp.js | 39 ++++++++++++++++----- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/packages/create-react-app/createReactApp.js b/packages/create-react-app/createReactApp.js index 1bf3bb0649d..0e4b10863c7 100755 --- a/packages/create-react-app/createReactApp.js +++ b/packages/create-react-app/createReactApp.js @@ -76,6 +76,7 @@ const program = new commander.Command(packageJson.name) 'use a non-standard version of react-scripts' ) .option('--use-npm') + .option('--no-bin-links') .allowUnknownOption() .on('--help', () => { console.log(` Only ${chalk.green('')} is required.`); @@ -159,10 +160,11 @@ createApp( program.verbose, program.scriptsVersion, program.useNpm, + program.binLinks, hiddenProgram.internalTestingTemplate ); -function createApp(name, verbose, version, useNpm, template) { +function createApp(name, verbose, version, useNpm, binLinks, template) { const root = path.resolve(name); const appName = path.basename(root); @@ -184,8 +186,9 @@ function createApp(name, verbose, version, useNpm, template) { path.join(root, 'package.json'), JSON.stringify(packageJson, null, 2) + os.EOL ); - - const useYarn = useNpm ? false : shouldUseYarn(root); + console.log(`what are we using?: ${useNpm}`); + const useYarn = false; + //const useYarn = useNpm ? false : shouldUseYarn(root); const originalDirectory = process.cwd(); process.chdir(root); if (!useYarn && !checkThatNpmCanReadCwd()) { @@ -218,7 +221,16 @@ function createApp(name, verbose, version, useNpm, template) { version = 'react-scripts@0.9.x'; } } - run(root, appName, version, verbose, originalDirectory, template, useYarn); + run( + root, + appName, + version, + verbose, + binLinks, + originalDirectory, + template, + useYarn + ); } function isYarnAvailable() { @@ -235,7 +247,7 @@ function shouldUseYarn(appDir) { return (mono.isYarnWs && mono.isAppIncluded) || isYarnAvailable(); } -function install(root, useYarn, dependencies, verbose, isOnline) { +function install(root, useYarn, dependencies, verbose, binLinks, isOnline) { return new Promise((resolve, reject) => { let command; let args; @@ -275,6 +287,11 @@ function install(root, useYarn, dependencies, verbose, isOnline) { args.push('--verbose'); } + if (binLinks === false) { + console.log(`ya got links?: ${binLinks}`); + args.push('--no-bin-links'); + } + const child = spawn(command, args, { stdio: 'inherit' }); child.on('close', code => { if (code !== 0) { @@ -293,6 +310,7 @@ function run( appName, version, verbose, + binLinks, originalDirectory, template, useYarn @@ -318,9 +336,14 @@ function run( ); console.log(); - return install(root, useYarn, allDependencies, verbose, isOnline).then( - () => packageName - ); + return install( + root, + useYarn, + allDependencies, + verbose, + binLinks, + isOnline + ).then(() => packageName); }) .then(packageName => { checkNodeVersion(packageName); From 3ab2e86533d4a699949349daf75292314f7899f5 Mon Sep 17 00:00:00 2001 From: "Tyler D. Franklin" Date: Fri, 16 Feb 2018 16:28:55 -0600 Subject: [PATCH 2/2] --no-bin-links options added --- packages/create-react-app/createReactApp.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/create-react-app/createReactApp.js b/packages/create-react-app/createReactApp.js index 0e4b10863c7..8d3384a6b78 100755 --- a/packages/create-react-app/createReactApp.js +++ b/packages/create-react-app/createReactApp.js @@ -186,9 +186,8 @@ function createApp(name, verbose, version, useNpm, binLinks, template) { path.join(root, 'package.json'), JSON.stringify(packageJson, null, 2) + os.EOL ); - console.log(`what are we using?: ${useNpm}`); - const useYarn = false; - //const useYarn = useNpm ? false : shouldUseYarn(root); + + const useYarn = useNpm ? false : shouldUseYarn(root); const originalDirectory = process.cwd(); process.chdir(root); if (!useYarn && !checkThatNpmCanReadCwd()) { @@ -288,7 +287,6 @@ function install(root, useYarn, dependencies, verbose, binLinks, isOnline) { } if (binLinks === false) { - console.log(`ya got links?: ${binLinks}`); args.push('--no-bin-links'); }