Skip to content

Commit

Permalink
Skip pruning if NPM_CONFIG_PRODUCTION or YARN_PRODUCTION is defined (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jmorrell authored Mar 2, 2018
1 parent 715ca1c commit bd68ebe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
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

0 comments on commit bd68ebe

Please sign in to comment.