Skip to content

Commit

Permalink
Detect yarn usage from execpath env variable as signal to use yarn
Browse files Browse the repository at this point in the history
as the package manager. Otherwise it will use npm.
  • Loading branch information
lukekarrys committed Aug 23, 2021
1 parent 64ff23d commit 1f40f05
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
13 changes: 7 additions & 6 deletions tasks/e2e-installs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ cd "$temp_app_path"
npx create-react-app test-app-dist-tag --scripts-version=@latest
cd test-app-dist-tag

# Check corresponding scripts version is installed and no TypeScript is present.
# Check corresponding scripts version is installed and no TypeScript or yarn is present by default
exists node_modules/react-scripts
! exists node_modules/typescript
! exists src/index.tsx
! exists yarn.lock
exists src/index.js
checkDependencies

Expand All @@ -133,16 +134,16 @@ grep '"version": "1.0.17"' node_modules/react-scripts/package.json
checkDependencies

# ******************************************************************************
# Test --use-npm flag
# Test --use-yarn flag
# ******************************************************************************

cd "$temp_app_path"
npx create-react-app test-use-npm-flag --use-npm --scripts-version=1.0.17
cd test-use-npm-flag
npx create-react-app test-use-yarn-flag --use-yarn --scripts-version=1.0.17
cd test-use-yarn-flag

# Check corresponding scripts version is installed.
exists node_modules/react-scripts
[ ! -e "yarn.lock" ] && echo "yarn.lock correctly does not exist"
exists yarn.lock
grep '"version": "1.0.17"' node_modules/react-scripts/package.json
checkDependencies

Expand Down Expand Up @@ -277,7 +278,7 @@ npm start -- --smoke-test
# Test when PnP is enabled
# ******************************************************************************
cd "$temp_app_path"
npx create-react-app test-app-pnp --use-pnp
npx create-react-app test-app-pnp --use-yarn --use-pnp
cd test-app-pnp
! exists node_modules
exists .pnp.js
Expand Down
6 changes: 0 additions & 6 deletions tasks/e2e-kitchensink-eject.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ cd "$temp_app_path/test-kitchensink"
# In kitchensink, we want to test all transforms
export BROWSERSLIST='ie 9'

# Link to test module
npm link "$temp_module_path/node_modules/test-integrity"

# ******************************************************************************
# Finally, let's check that everything still works after ejecting.
# ******************************************************************************
Expand All @@ -124,9 +121,6 @@ echo yes | npm run eject
rm yarn.lock
yarn add @babel/plugin-transform-react-jsx-source @babel/plugin-syntax-jsx @babel/plugin-transform-react-jsx @babel/plugin-transform-react-jsx-self

# Link to test module
npm link "$temp_module_path/node_modules/test-integrity"

# Test the build
REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \
NODE_PATH=src \
Expand Down

0 comments on commit 1f40f05

Please sign in to comment.