Skip to content

Commit

Permalink
Merge commit 'cff3b1f'
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Nov 6, 2015
2 parents eaf93a1 + cff3b1f commit a3237d6
Show file tree
Hide file tree
Showing 38 changed files with 553 additions and 204 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "compile-extensions"]
path = compile-extensions
url = https://github.com/cloudfoundry-incubator/compile-extensions.git
url = https://github.com/cloudfoundry/compile-extensions.git
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: bash
sudo: required
services:
- docker
install: docker pull heroku/cedar:14
script: make test-cedar-14
12 changes: 12 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
v1.5.1 Nov 06, 2015
====================

* Add support for Node 4.2.2
https://github.com/cloudfoundry/nodejs-buildpack/issues/32

* `bin/detect` outputs buildpack details
(https://www.pivotaltracker.com/story/show/100757820)

* Merged upstream v75..v86 (see `CHANGELOG.md`)


v1.5.0 Jul 20, 2015
====================

Expand Down
93 changes: 82 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,89 @@
## master
# Node.js Buildpack Changelog

- Fix caching issues
- Use bin/release instead of generated Procfile
- Support OSX
- Simplify detect (package.json required)
## Pending

## v74 / v75 (24/4/2015)
Enables compiling the same directory multiple times
Updates tests for Node v5

- Update build failure messaging and help
## v86 (2015-10-08)

## v73 (24/4/2015)
Fixes piped output buffering issues

- Patch for caching to disable cache restoration if node_modules already exists (eg from being git submoduled or checked into git)
## v85 (2015-10-08)

## v72 (23/4/2015)
Fixes piped output buffering issues (unsuccessful)

* Accepts `cacheDirectories` array in package.json to override default `node_modules` caching
- https://github.com/heroku/heroku-buildpack-nodejs/issues/273

## v84 (2015-10-08)

Replaces sed with awk for output formatting

- large output (from assets or npm 3) was crashing sed ('resource unavailable')

## v83 (2015-10-05)

Caching improvements

- Fixes modules-checked-in reference URL
- When cache restoration is disabled, empties the cache instead of saving it
- Adds bower_components as a default cache target

## v82 (2015-09-30)

Detects bower+angular resolution failures
Detects missing grunt/gulp/bower failures

## v81 (2015-09-24)

Supports WEB_CONCURRENCY=28 for Performance-L dynos

## v80 (2015-08-14)

Fixes not defaulting to `NODE_ENV=production` during runtime

## v79 (2015-08-10)

Supports WEB_CONCURRENCY for Performance-M dynos

## v78 (2015-07-24)

Defaults node environment to 'production'; bugfixes

- Fix runtime signature cache invalidation
- Provide error messaging for un-downloadable binaries
- Default to NODE_ENV=production for both build and runtime
- https://github.com/heroku/heroku-buildpack-nodejs/issues/60

## v77 (2015-07-15)

Npm bootstrapping skipped when using iojs.

- Fixes https://github.com/heroku/heroku-buildpack-nodejs/issues/202

## v76 (2015-06-23)

Refactor to bring caching logic to the forefront.

- Fixes cachDirectories issues
- Addresses https://github.com/heroku/heroku-buildpack-nodejs/pull/231
- Addresses https://github.com/heroku/heroku-buildpack-nodejs/issues/226
- Simplifies detect (package.json required)

## v75 (2015-04-24)

Updated build failure and help messaging.

## v74 (2015-04-24)

Updated messaging.

## v73 (2015-04-24)

Disables cache restoration if node_modules already exists.

## v72 (2015-04-23)

Accepts `cacheDirectories` array in package.json to override default `node_modules` caching.

- Documented at https://devcenter.heroku.com/articles/nodejs-support#cache-behavior
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,32 @@ In cached mode, [use the semver node_module](bin/compile#L30-32) (as opposed to
1. Build the buildpack

```shell
BUNDLE_GEMFILE=cf.Gemfile bundle exec buildpack-packager [ cached | uncached ]
BUNDLE_GEMFILE=cf.Gemfile bundle exec buildpack-packager [ --cached | --uncached ]
```

1. Use in Cloud Foundry

Upload the buildpack to your Cloud Foundry and optionally specify it by name

```bash
cf create-buildpack custom_node_buildpack node_buildpack-offline-custom.zip 1
cf push my_app -b custom_node_buildpack
```

## Supported binary dependencies

The NodeJS buildpack only supports the two most recent stable patches for each dependency in the [manifest.yml](manifest.yml).
The buildpack only supports the stable patches for each dependency listed in the [manifest.yml](manifest.yml) and [releases page](https://github.com/cloudfoundry/nodejs-buildpack/releases).

If you want to use previously supported dependency versions, provide the `--use-custom-manifest=manifest-including-unsupported.yml` option to `buildpack-packager`.

If you try to use a binary that is not currently supported, staging your app will fail and you will see the following error message:

```
Could not get translated url, exited with: DEPENDENCY_MISSING_IN_MANIFEST: ...
!
! exit
!
Staging failed: Buildpack compilation step failed
```

## Options

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.0
1.5.1
51 changes: 31 additions & 20 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ set -o pipefail # don't ignore exit codes when piping output
set -o nounset # fail on unset variables
unset GIT_DIR # Avoid GIT_DIR leak from previous build steps

### Constants

DEFAULT_CACHE="node_modules bower_components"

### Configure directories

BUILD_DIR=${1:-}
Expand All @@ -22,6 +26,8 @@ export PATH="$BUILD_DIR/.heroku/node/bin":$PATH
export BUILDPACK_PATH=$BP_DIR
source $BP_DIR/compile-extensions/lib/common
# END CF Common
LOG_FILE='/tmp/node-build-log.txt'
echo "" > "$LOG_FILE"

### Load dependencies

Expand All @@ -37,7 +43,9 @@ source $BP_DIR/lib/dependencies.sh

handle_failure() {
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

Expand All @@ -60,8 +68,8 @@ create_env() {
}

header "Creating runtime environment"
create_env # can't indent the whole thing because piping causes subshells; no exporting possible
list_node_config | indent
create_env # can't pipe the whole thing because piping causes subshells, preventing exports
list_node_config | output "$LOG_FILE"

install_bins() {
local node_engine=$(read_json "$BUILD_DIR/package.json" ".engines.node")
Expand All @@ -79,38 +87,37 @@ install_bins() {
if [ -n "$iojs_engine" ]; then
warn_node_engine "$iojs_engine"
install_iojs "$iojs_engine" "$BUILD_DIR/.heroku/node"
echo "Using bundled npm version for iojs compatibility: `npm --version`"
else
warn_node_engine "$node_engine"
install_nodejs "$node_engine" "$BUILD_DIR/.heroku/node"
install_npm "$npm_engine" "$BUILD_DIR/.heroku/node"
fi
install_npm "$npm_engine" "$BUILD_DIR/.heroku/node"
warn_old_npm
}

header "Installing binaries"
install_bins | indent
install_bins | output "$LOG_FILE"

restore_cache() {
local cache_status=$(get_cache_status)
local cache_status="$(get_cache_status)"

if [ "$cache_status" == "disabled" ]; then
echo "Skipping (cache disabled)"
elif [ "$cache_status" == "invalidated" ]; then
echo "Skipping (cache invalidated)"
else
if [ "$cache_status" == "valid" ]; then
local cache_directories=$(get_cache_directories)
if [ "$cache_directories" == "" ]; then
echo "Loading 1 from cacheDirectories (default):"
restore_cache_directories "$BUILD_DIR" "$CACHE_DIR" "node_modules"
echo "Loading 2 from cacheDirectories (default):"
restore_cache_directories "$BUILD_DIR" "$CACHE_DIR" "$DEFAULT_CACHE"
else
echo "Loading $(echo $cache_directories | wc -w | xargs) from cacheDirectories (package.json):"
restore_cache_directories "$BUILD_DIR" "$CACHE_DIR" $cache_directories
fi
else
echo "Skipping cache restore ($cache_status)"
fi
}

header "Restoring cache"
restore_cache | indent
restore_cache | output "$LOG_FILE"

build_dependencies() {
if $PREBUILD; then
Expand All @@ -122,28 +129,32 @@ build_dependencies() {
}

header "Building dependencies"
build_dependencies | indent
build_dependencies | output "$LOG_FILE"

cache_build() {
local cache_directories=$(get_cache_directories)

echo "Clearing previous node cache"
clear_cache
if [ "$cache_directories" == "" ]; then
echo "Saving 1 cacheDirectories (default):"
save_cache_directories "$BUILD_DIR" "$CACHE_DIR" "node_modules"
if ! ${NODE_MODULES_CACHE:-true}; then
echo "Skipping cache save (disabled by config)"
elif [ "$cache_directories" == "" ]; then
echo "Saving 2 cacheDirectories (default):"
save_cache_directories "$BUILD_DIR" "$CACHE_DIR" "$DEFAULT_CACHE"
else
echo "Saving $(echo $cache_directories | wc -w | xargs) cacheDirectories (package.json):"
save_cache_directories "$BUILD_DIR" "$CACHE_DIR" $cache_directories
fi
save_signature
}

header "Caching build"
cache_build | indent
cache_build | output "$LOG_FILE"

summarize_build() {
cd $BUILD_DIR
(npm ls --depth=0 | tail -n +2 || true) 2>/dev/null
}

header "Build succeeded!"
summarize_build | indent
summarize_build | output "$LOG_FILE"
3 changes: 2 additions & 1 deletion bin/detect
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env bash
# bin/detect <build-dir>

BP=$(dirname $(dirname $0))
if [ -f $1/package.json ]; then
echo "Node.js"
echo "node.js `cat $BP/VERSION`"
exit 0
fi

Expand Down
6 changes: 3 additions & 3 deletions cf.Gemfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
source "https://rubygems.org"

ruby '2.2.2'
ruby '2.2.3'

gem 'machete', git: 'https://github.com/cf-buildpacks/machete', tag: 'v0.0.17'
gem 'buildpack-packager', git: 'https://github.com/cloudfoundry-incubator/buildpack-packager', tag: 'v2.2.3'
gem 'machete', git: 'https://github.com/cf-buildpacks/machete', tag: 'v0.0.20'
gem 'buildpack-packager', git: 'https://github.com/cloudfoundry/buildpack-packager', tag: 'v2.2.5'
gem 'rspec'
gem 'rspec-instafail'
gem 'pry'
24 changes: 12 additions & 12 deletions cf.Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
GIT
remote: https://github.com/cf-buildpacks/machete
revision: 13055daee5501b3908fe4022b27f0ff9b05128b9
tag: v0.0.17
revision: 0a1710de1f680a602f67f5eff60e9a424acca467
tag: v0.0.20
specs:
machete (0.0.17)
machete (0.0.20)
httparty

GIT
remote: https://github.com/cloudfoundry-incubator/buildpack-packager
revision: 58ccd566aee3e1dbfd1810256e3e41eb39d14d54
tag: v2.2.3
remote: https://github.com/cloudfoundry/buildpack-packager
revision: ae3ac1feefe81cfe2881b39423be201ba38b1615
tag: v2.2.5
specs:
buildpack-packager (2.2.3)
buildpack-packager (2.2.5)
activesupport (~> 4.1.8)
kwalify
terminal-table (~> 1.4.5)

GEM
remote: https://rubygems.org/
specs:
activesupport (4.1.12)
activesupport (4.1.13)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
coderay (1.1.0)
diff-lcs (1.2.5)
httparty (0.13.5)
httparty (0.13.7)
json (~> 1.8)
multi_xml (>= 0.5.2)
i18n (0.7.0)
json (1.8.2)
json (1.8.3)
kwalify (0.7.2)
method_source (0.8.2)
minitest (5.7.0)
minitest (5.8.0)
multi_xml (0.5.5)
pry (0.10.1)
coderay (~> 1.1.0)
Expand Down Expand Up @@ -72,4 +72,4 @@ DEPENDENCIES
rspec-instafail

BUNDLED WITH
1.10.5
1.10.6
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"express": "~4.0.0"
},
"engines" : {
"node" : ">0.12.0"
"node" : "~>0.12.0"
},

"repository" :
Expand Down
Loading

0 comments on commit a3237d6

Please sign in to comment.