Commit 6518934b authored by Hunter Loftis's avatar Hunter Loftis

Merge pull request #296 from heroku/fiznool-master

Fiznool master
parents a8cf29ac e2dd7874
# Node.js Buildpack Changelog # Node.js Buildpack Changelog
## Latest
- Adds heroku-prebuild script
- Adds heroku-postbuild script
## v88 (2016-2-23) ## v88 (2016-2-23)
- Retries all curl requests - Retries all curl requests
......
...@@ -118,12 +118,14 @@ header "Restoring cache" ...@@ -118,12 +118,14 @@ header "Restoring cache"
restore_cache | output "$LOG_FILE" restore_cache | output "$LOG_FILE"
build_dependencies() { build_dependencies() {
run_if_present 'heroku-prebuild'
if $PREBUILD; then if $PREBUILD; then
echo "Prebuild detected (node_modules already exists)" echo "Prebuild detected (node_modules already exists)"
rebuild_node_modules "$BUILD_DIR" rebuild_node_modules "$BUILD_DIR"
else else
install_node_modules "$BUILD_DIR" install_node_modules "$BUILD_DIR"
fi fi
run_if_present 'heroku-postbuild'
} }
header "Building dependencies" header "Building dependencies"
......
run_if_present() {
local script_name=${1:-}
local has_script=$(read_json "$BUILD_DIR/package.json" ".scripts[\"$script_name\"]")
if [ -n "$has_script" ]; then
echo "Running $script_name"
npm run "$script_name" --if-present
fi
}
install_node_modules() { install_node_modules() {
local build_dir=${1:-} local build_dir=${1:-}
if [ -e $build_dir/package.json ]; then if [ -e $build_dir/package.json ]; then
cd $build_dir cd $build_dir
echo "Pruning any extraneous modules" echo "Pruning any extraneous modules"
npm prune --unsafe-perm --userconfig $build_dir/.npmrc 2>&1 npm prune --unsafe-perm --userconfig $build_dir/.npmrc 2>&1
if [ -e $build_dir/npm-shrinkwrap.json ]; then if [ -e $build_dir/npm-shrinkwrap.json ]; then
......
A fake README, to keep npm from polluting stderr.
\ No newline at end of file
{
"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"
},
"engines": {
"node": "~0.10.0"
},
"scripts" : {
"heroku-prebuild" : "echo heroku-prebuild hook message",
"heroku-postbuild" : "echo heroku-postbuild hook message"
}
}
#!/usr/bin/env bash #!/usr/bin/env bash
# See README.md for info on running these tests. # See README.md for info on running these tests.
testPrePostBuildScripts() {
compile "pre-post-build-scripts"
assertCaptured "Running heroku-prebuild"
assertCaptured "echo heroku-prebuild hook message"
assertCaptured "Running heroku-postbuild"
assertCaptured "echo heroku-postbuild hook message"
assertCapturedSuccess
compile "stable-node"
assertNotCaptured "Running heroku-prebuild"
assertNotCaptured "Running heroku-postbuild"
assertCapturedSuccess
}
testWarningsOnFailure() { testWarningsOnFailure() {
compile "many-warnings" compile "many-warnings"
assertCaptured "troubleshooting-node-deploys" assertCaptured "troubleshooting-node-deploys"
......
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