Unverified Commit 715ca1cd authored by Jeremy Morrell's avatar Jeremy Morrell Committed by GitHub

Skip pruning for versions of npm with known issues with git submodules (#528)

Skip pruning for versions of npm with known issues

The following versions of npm will strip out dependencies installed via git when you run npm prune --production: 5.6.0, 5.5.1, 5.5.0, 5.4.2, 5.4.1, 5.4.0, 5.3.0 (didn't work for other reasons), 5.2.0, 5.1.0

This commit skips the prune step and logs a warning for these versions.
parent 280afcef
......@@ -157,19 +157,36 @@ npm_prune_devdependencies() {
local build_dir=${1:-}
local npm_version=$(npm --version)
if [ $NODE_ENV == "test" ]; then
if [ "$NODE_ENV" == "test" ]; then
echo "Skipping because NODE_ENV is 'test'"
return 0
elif [ $NODE_ENV != "production" ]; then
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'"
return 0
elif [ $npm_version == "5.3.0" ]; then
elif [ "$npm_version" == "5.3.0" ]; then
mcount "skip-prune-issue-npm-5.3.0"
echo "Skipping because npm 5.3.0 fails when running 'npm prune' due to a known issue"
echo "https://github.com/npm/npm/issues/17781"
echo ""
echo "You can silence this warning by updating to at least npm 5.7.1 in your package.json"
echo "https://devcenter.heroku.com/articles/nodejs-support#specifying-an-npm-version"
return 0
elif [ "$npm_version" == "5.6.0" ] ||
[ "$npm_version" == "5.5.1" ] ||
[ "$npm_version" == "5.5.0" ] ||
[ "$npm_version" == "5.4.2" ] ||
[ "$npm_version" == "5.4.1" ] ||
[ "$npm_version" == "5.2.0" ] ||
[ "$npm_version" == "5.1.0" ]; then
mcount "skip-prune-issue-npm-5.6.0"
echo "Skipping because npm $npm_version sometimes fails when running 'npm prune' due to a known issue"
echo "https://github.com/npm/npm/issues/19356"
echo ""
echo "You can silence this warning by updating to at least npm 5.7.1 in your package.json"
echo "https://devcenter.heroku.com/articles/nodejs-support#specifying-an-npm-version"
return 0
else
local start=$(nowms)
......
......@@ -10,7 +10,8 @@
"hashish": "*"
},
"engines": {
"node": "8.x"
"node": "8.x",
"npm": "5.7.1"
},
"devDependencies": {
"lodash": "^2.4.1"
......
......@@ -10,7 +10,8 @@
"hashish": "*"
},
"engines": {
"node": "8.x"
"node": "8.x",
"npm": "5.7.1"
},
"devDependencies": {
"lodash": "^2.4.1"
......
......@@ -10,7 +10,8 @@
"hashish": "*"
},
"engines": {
"node": "8.x"
"node": "8.x",
"npm": "5.7.1"
},
"devDependencies": {
"lodash": "^2.4.1"
......
{
"name": "yarn",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"lodash": {
"version": "4.17.5",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz",
"integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw=="
}
}
}
{
"name": "yarn",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"engines": {
"npm": "5.6.0"
},
"devDependencies": {
"mocha": "*"
},
"dependencies": {
"lodash": "^4.16.4"
}
}
......@@ -867,6 +867,16 @@ testNpmPrune53Issue() {
assertCapturedSuccess
}
# Avoid this issue for users with git dependencies
# https://github.com/npm/npm/issues/19356
testNpmPrune56Issue() {
compile "npm-prune-5-6-issue"
assertCaptured "npm 5.6.0"
assertCaptured "Skipping because npm 5.6.0 sometimes fails"
assertCaptured "https://github.com/npm/npm/issues/19356"
assertCapturedSuccess
}
# Utils
pushd $(dirname 0) >/dev/null
......
Markdown is supported
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