Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip pruning if NPM_CONFIG_PRODUCTION or YARN_PRODUCTION is defined #529

Merged
merged 1 commit into from
Mar 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ yarn_prune_devdependencies() {
elif [ "$NODE_ENV" != "production" ]; then
echo "Skipping because NODE_ENV is not 'production'"
return 0
elif [ -n "$YARN_PRODUCTION" ] && [ "$YARN_PRODUCTION" != "true" ]; then
echo "Skipping because YARN_PRODUCTION is not 'true'"
elif [ -n "$YARN_PRODUCTION" ]; then
echo "Skipping because YARN_PRODUCTION is '$YARN_PRODUCTION'"
return 0
else
local start=$(nowms)
Expand Down Expand Up @@ -163,8 +163,8 @@ npm_prune_devdependencies() {
elif [ "$NODE_ENV" != "production" ]; then
echo "Skipping because NODE_ENV is not 'production'"
return 0
elif [ -n "$NPM_CONFIG_PRODUCTION" ] && [ "$NPM_CONFIG_PRODUCTION" != "true" ]; then
echo "Skipping because NPM_CONFIG_PRODUCTION is not 'true'"
elif [ -n "$NPM_CONFIG_PRODUCTION" ]; then
echo "Skipping because NPM_CONFIG_PRODUCTION is '$NPM_CONFIG_PRODUCTION'"
return 0
elif [ "$npm_version" == "5.3.0" ]; then
mcount "skip-prune-issue-npm-5.3.0"
Expand Down
18 changes: 16 additions & 2 deletions test/run
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,14 @@ testDevDepenenciesWithNoPruning() {
echo "false" > $env_dir/NPM_CONFIG_PRODUCTION
compile "dependencies" "$(mktmpdir)" $env_dir
assertCaptured "lodash"
assertCaptured "Skipping because NPM_CONFIG_PRODUCTION is not 'true'"
assertCaptured "Skipping because NPM_CONFIG_PRODUCTION is 'false'"
assertCapturedSuccess

env_dir=$(mktmpdir)
echo "true" > $env_dir/NPM_CONFIG_PRODUCTION
compile "dependencies" "$(mktmpdir)" $env_dir
assertNotCaptured "lodash"
assertCaptured "Skipping because NPM_CONFIG_PRODUCTION is 'true'"
assertCapturedSuccess
}

Expand All @@ -692,7 +699,14 @@ testDevDepenenciesWithNoPruningYarn() {
echo "false" > $env_dir/YARN_PRODUCTION
compile "dependencies-yarn" "$(mktmpdir)" $env_dir
assertCaptured "lodash"
assertCaptured "Skipping because YARN_PRODUCTION is not 'true'"
assertCaptured "Skipping because YARN_PRODUCTION is 'false'"
assertCapturedSuccess

env_dir=$(mktmpdir)
echo "true" > $env_dir/YARN_PRODUCTION
compile "dependencies-yarn" "$(mktmpdir)" $env_dir
assertNotCaptured "lodash"
assertCaptured "Skipping because YARN_PRODUCTION is 'true'"
assertCapturedSuccess
}

Expand Down