Commit 756a9a0f authored by Trevor Brindle's avatar Trevor Brindle Committed by Joe Haddad
Browse files

add —use-npm flag to bypass yarn (#3409)

* add —use-npm flag to bypass yarn

* add e2e test for —use-npm flag
parent 4bec8771
3 merge requests!12191Lim.Pisey.168:/Identified - We are currently investigating reports of missing build logs. The issue has been identified and a resolution is in progress. We will provide a further update when available.Mar 21, 09:02 UTC,!12853brikk,!5717Automatically extract project file structure from build bundle file
Showing with 18 additions and 2 deletions
+18 -2
......@@ -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.`);
......@@ -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);
......@@ -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()) {
......
......@@ -145,6 +145,20 @@ exists node_modules/react-scripts
grep '"version": "0.4.0"' node_modules/react-scripts/package.json
checkDependencies
# ******************************************************************************
# Test --use-npm flag
# ******************************************************************************
cd "$temp_app_path"
create_react_app --use-npm --scripts-version=0.4.0 test-use-npm-flag
cd test-use-npm-flag
# Check corresponding scripts version is installed.
exists node_modules/react-scripts
[ ! -e "yarn.lock" ] && echo "yarn.lock correctly does not exist"
grep '"version": "0.4.0"' node_modules/react-scripts/package.json
checkDependencies
# ******************************************************************************
# Test --scripts-version with a tarball url
# ******************************************************************************
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment