Commit c59b671e authored by Jeremy Morrell's avatar Jeremy Morrell Committed by GitHub

Smarter warning (#390)

Warnings that mention npm installs can be confusing if you're using yarn to install your dependencies.
parent dd6a5f5a
warnings=$(mktemp -t heroku-buildpack-nodejs-XXXX)
detect_package_manager() {
case $YARN in
true) echo "yarn";;
*) echo "npm";;
esac
}
failure_message() {
local warn="$(cat $warnings)"
echo ""
......@@ -136,7 +143,8 @@ warn_econnreset() {
warn_unmet_dep() {
local log_file="$1"
local package_manager=$(detect_package_manager)
if grep -qi 'unmet dependency' "$log_file" || grep -qi 'unmet peer dependency' "$log_file"; then
warn "Unmet dependencies don't fail npm install but may cause runtime issues" "https://github.com/npm/npm/issues/7494"
warn "Unmet dependencies don't fail $package_manager install but may cause runtime issues" "https://github.com/npm/npm/issues/7494"
fi
}
{
"name": "unmet-dep",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node server.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"grunt-steroids": "0.2.3"
}
}
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
ansi-styles@~0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-0.2.0.tgz#359ab4b15dcd64ba6d74734b72c36360a9af2c19"
chalk@0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-0.3.0.tgz#1c98437737f1199ebcc1d4c48fd41b9f9c8e8f23"
dependencies:
ansi-styles "~0.2.0"
has-color "~0.1.0"
grunt-steroids@0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/grunt-steroids/-/grunt-steroids-0.2.3.tgz#ac24d8597bbeae40cab972ead0a4a4ec5e6aa0a9"
dependencies:
chalk "0.3.0"
lodash "2.4.1"
wrench "1.5.4"
xml2js "0.4.1"
has-color@~0.1.0:
version "0.1.7"
resolved "https://registry.yarnpkg.com/has-color/-/has-color-0.1.7.tgz#67144a5260c34fc3cca677d041daf52fe7b78b2f"
lodash@2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-2.4.1.tgz#5b7723034dda4d262e5a46fb2c58d7cc22f71420"
sax@0.5.x:
version "0.5.8"
resolved "https://registry.yarnpkg.com/sax/-/sax-0.5.8.tgz#d472db228eb331c2506b0e8c15524adb939d12c1"
wrench@1.5.4:
version "1.5.4"
resolved "https://registry.yarnpkg.com/wrench/-/wrench-1.5.4.tgz#2e8d9d3db3568cc1c001a4c8dceca772e5d21643"
xml2js@0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.1.tgz#dee0630173a5c6ea62797f848615fd55c6bc6992"
dependencies:
sax "0.5.x"
xmlbuilder ">=0.4.2"
xmlbuilder@>=0.4.2:
version "8.2.2"
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-8.2.2.tgz#69248673410b4ba42e1a6136551d2922335aa773"
......@@ -88,8 +88,19 @@ testYarnEngine() {
assertCapturedSuccess
}
testWarnUnmetDep() {
testWarnUnmetDepNpm() {
compile "unmet-dep"
assertCaptured "fail npm install"
assertCaptured "may cause runtime issues"
assertCapturedSuccess
compile "no-version"
assertNotCaptured "may cause runtime issues"
assertCapturedSuccess
}
testWarnUnmetDepYarn() {
compile "unmet-dep-yarn"
assertCaptured "fail yarn install"
assertCaptured "may cause runtime issues"
assertCapturedSuccess
compile "no-version"
......
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