Commit ef17b770 authored by Hunter Loftis's avatar Hunter Loftis

merged master

parents ed2fce08 3e94459b
# Node.js Buildpack Changelog # Node.js Buildpack Changelog
## Pending
Fixes modules-checked-in reference URL
## v82 (2015-09-30)
Detects bower+angular resolution failures
Detects missing grunt/gulp/bower failures
## v81 (2015-09-24) ## v81 (2015-09-24)
Supports WEB_CONCURRENCY=28 for Performance-L dynos Supports WEB_CONCURRENCY=28 for Performance-L dynos
......
...@@ -19,6 +19,9 @@ mkdir -p "$BUILD_DIR/.heroku/node/" ...@@ -19,6 +19,9 @@ mkdir -p "$BUILD_DIR/.heroku/node/"
cd $BUILD_DIR cd $BUILD_DIR
export PATH="$BUILD_DIR/.heroku/node/bin":$PATH export PATH="$BUILD_DIR/.heroku/node/bin":$PATH
LOG_FILE='/tmp/node-build-log.txt'
echo "" > "$LOG_FILE"
### Load dependencies ### Load dependencies
source $BP_DIR/lib/output.sh source $BP_DIR/lib/output.sh
...@@ -33,7 +36,9 @@ source $BP_DIR/lib/dependencies.sh ...@@ -33,7 +36,9 @@ source $BP_DIR/lib/dependencies.sh
handle_failure() { handle_failure() {
header "Build failed" header "Build failed"
failure_message | indent warn_untracked_dependencies "$LOG_FILE"
warn_angular_resolution "$LOG_FILE"
failure_message | output "$LOG_FILE"
} }
trap 'handle_failure' ERR trap 'handle_failure' ERR
...@@ -57,8 +62,8 @@ create_env() { ...@@ -57,8 +62,8 @@ create_env() {
} }
header "Creating runtime environment" header "Creating runtime environment"
create_env # can't indent the whole thing because piping causes subshells; no exporting possible create_env # can't pipe the whole thing because piping causes subshells, preventing exports
list_node_config | indent list_node_config | output "$LOG_FILE"
install_bins() { install_bins() {
local node_engine=$(read_json "$BUILD_DIR/package.json" ".engines.node") local node_engine=$(read_json "$BUILD_DIR/package.json" ".engines.node")
...@@ -86,7 +91,7 @@ install_bins() { ...@@ -86,7 +91,7 @@ install_bins() {
} }
header "Installing binaries" header "Installing binaries"
install_bins | indent install_bins | output "$LOG_FILE"
restore_cache() { restore_cache() {
local cache_status="$(get_cache_status)" local cache_status="$(get_cache_status)"
...@@ -106,7 +111,7 @@ restore_cache() { ...@@ -106,7 +111,7 @@ restore_cache() {
} }
header "Restoring cache" header "Restoring cache"
restore_cache | indent restore_cache | output "$LOG_FILE"
build_dependencies() { build_dependencies() {
if $PREBUILD; then if $PREBUILD; then
...@@ -118,7 +123,7 @@ build_dependencies() { ...@@ -118,7 +123,7 @@ build_dependencies() {
} }
header "Building dependencies" header "Building dependencies"
build_dependencies | indent build_dependencies | output "$LOG_FILE"
cache_build() { cache_build() {
local cache_directories=$(get_cache_directories) local cache_directories=$(get_cache_directories)
...@@ -139,7 +144,7 @@ cache_build() { ...@@ -139,7 +144,7 @@ cache_build() {
} }
header "Caching build" header "Caching build"
cache_build | indent cache_build | output "$LOG_FILE"
summarize_build() { summarize_build() {
cd $BUILD_DIR cd $BUILD_DIR
...@@ -147,4 +152,4 @@ summarize_build() { ...@@ -147,4 +152,4 @@ summarize_build() {
} }
header "Build succeeded!" header "Build succeeded!"
summarize_build | indent summarize_build | output "$LOG_FILE"
...@@ -49,7 +49,7 @@ warn_node_engine() { ...@@ -49,7 +49,7 @@ warn_node_engine() {
warn_prebuilt_modules() { warn_prebuilt_modules() {
local build_dir=${1:-} local build_dir=${1:-}
if [ -e "$build_dir/node_modules" ]; then if [ -e "$build_dir/node_modules" ]; then
warning "node_modules checked into source control" "https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-" warning "node_modules checked into source control" "https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git"
fi fi
} }
...@@ -67,3 +67,21 @@ warn_old_npm() { ...@@ -67,3 +67,21 @@ warn_old_npm() {
warning "This version of npm ($npm_version) has several known issues - consider upgrading to the latest release ($latest_npm)" "https://devcenter.heroku.com/articles/nodejs-support#specifying-an-npm-version" warning "This version of npm ($npm_version) has several known issues - consider upgrading to the latest release ($latest_npm)" "https://devcenter.heroku.com/articles/nodejs-support#specifying-an-npm-version"
fi fi
} }
warn_untracked_dependencies() {
local log_file="$1"
if grep -qi 'gulp: not found' "$log_file"; then
warning "Gulp may not be tracked in package.json" "https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies"
elif grep -qi 'grunt: not found' "$log_file"; then
warning "Grunt may not be tracked in package.json" "https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies"
elif grep -qi 'bower: not found' "$log_file"; then
warning "Bower may not be tracked in package.json" "https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies"
fi
}
warn_angular_resolution() {
local log_file="$1"
if grep -qi 'Unable to find suitable version for angular' "$log_file"; then
warning "Bower may need a resolution hint for angular" "https://github.com/bower/bower/issues/1746"
fi
}
...@@ -5,11 +5,13 @@ info() { ...@@ -5,11 +5,13 @@ info() {
# sed -l basically makes sed replace and buffer through stdin to stdout # sed -l basically makes sed replace and buffer through stdin to stdout
# so you get updates while the command runs and dont wait for the end # so you get updates while the command runs and dont wait for the end
# e.g. npm install | indent # e.g. npm install | indent
indent() { output() {
c='s/^/ /' local logfile="$1"
local c='s/^/ /'
case $(uname) in case $(uname) in
Darwin) sed -l "$c";; # mac/bsd sed: -l buffers on line boundaries Darwin) tee -a "$logfile" | sed -l "$c";; # mac/bsd sed: -l buffers on line boundaries
*) sed -u "$c";; # unix/gnu sed: -u unbuffered (arbitrary) chunks of data *) tee -a "$logfile" | sed -u "$c";; # unix/gnu sed: -u unbuffered (arbitrary) chunks of data
esac esac
} }
......
{
"name": "bower-angular-resolution",
"version": "0.0.0",
"homepage": "https://github.com/heroku/heroku-buildpack-nodejs",
"authors": [
"Hunter Loftis <hunter@hunterloftis.com>"
],
"description": "",
"main": "",
"moduleType": [],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular": "1.0.7",
"angular-ui-router": "0.2.15"
}
}
{
"name": "node-buildpack-test-app",
"version": "0.0.1",
"description": "node buildpack integration test app",
"repository": {
"type": "git",
"url": "http://github.com/example/example.git"
},
"dependencies": {
"bower": "1.5.3"
},
"engines": {
"node": "4.1.1"
},
"scripts": {
"postinstall": "bower install --allow-root"
}
}
A fake README, to keep npm from polluting stderr.
\ No newline at end of file
{
"name": "node-buildpack-test-app",
"version": "1.0.0",
"description": "node buildpack integration test app",
"repository" : {
"type" : "git",
"url" : "http://github.com/example/example.git"
},
"dependencies": {
},
"engines": {
"node": "4.1.1"
},
"scripts": {
"postinstall": "grunt build"
}
}
...@@ -22,6 +22,26 @@ testDisableCache() { ...@@ -22,6 +22,26 @@ testDisableCache() {
assertCapturedSuccess assertCapturedSuccess
} }
testBowerAngularResolution() {
compile "bower-angular-resolution"
assertCaptured "Bower may need a resolution hint for angular"
assertCapturedError
}
testUntrackedDependencies() {
compile "missing-grunt"
assertCaptured "Grunt may not be tracked in package.json"
assertCapturedError
}
testBadJson() {
compile "bad-json"
assertCaptured "Build failed"
assertCaptured "We're sorry this build is failing"
assertNotCaptured "Installing binaries"
assertCapturedError 1 "Unable to parse"
}
testBuildWithUserCacheDirectoriesCamel() { testBuildWithUserCacheDirectoriesCamel() {
cache=$(mktmpdir) cache=$(mktmpdir)
...@@ -153,14 +173,6 @@ testDetectWithoutPackageJson() { ...@@ -153,14 +173,6 @@ testDetectWithoutPackageJson() {
assertCapturedError 1 "" assertCapturedError 1 ""
} }
testBadJson() {
compile "bad-json"
assertCaptured "Build failed"
assertCaptured "We're sorry this build is failing"
assertNotCaptured "Installing binaries"
assertCapturedError 1 "Unable to parse"
}
testIoJs() { testIoJs() {
compile "iojs" compile "iojs"
assertCaptured "engines.iojs (package.json): 1.0." assertCaptured "engines.iojs (package.json): 1.0."
...@@ -328,10 +340,6 @@ testBuildWithUserCacheDirectories() { ...@@ -328,10 +340,6 @@ testBuildWithUserCacheDirectories() {
assertCapturedSuccess assertCapturedSuccess
} }
testUserConfig() { testUserConfig() {
compile "userconfig" compile "userconfig"
assertCaptured "www.google.com" assertCaptured "www.google.com"
......
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