Skip to content

Commit a3237d6

Browse files
committed
Merge commit 'cff3b1f'
2 parents eaf93a1 + cff3b1f commit a3237d6

File tree

38 files changed

+553
-204
lines changed

38 files changed

+553
-204
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "compile-extensions"]
22
path = compile-extensions
3-
url = https://github.com/cloudfoundry-incubator/compile-extensions.git
3+
url = https://github.com/cloudfoundry/compile-extensions.git

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
language: bash
2+
sudo: required
3+
services:
4+
- docker
5+
install: docker pull heroku/cedar:14
6+
script: make test-cedar-14

CHANGELOG

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
v1.5.1 Nov 06, 2015
2+
====================
3+
4+
* Add support for Node 4.2.2
5+
https://github.com/cloudfoundry/nodejs-buildpack/issues/32
6+
7+
* `bin/detect` outputs buildpack details
8+
(https://www.pivotaltracker.com/story/show/100757820)
9+
10+
* Merged upstream v75..v86 (see `CHANGELOG.md`)
11+
12+
113
v1.5.0 Jul 20, 2015
214
====================
315

CHANGELOG.md

Lines changed: 82 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,89 @@
1-
## master
1+
# Node.js Buildpack Changelog
22

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

8-
## v74 / v75 (24/4/2015)
5+
Enables compiling the same directory multiple times
6+
Updates tests for Node v5
97

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

12-
## v73 (24/4/2015)
10+
Fixes piped output buffering issues
1311

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

16-
## v72 (23/4/2015)
14+
Fixes piped output buffering issues (unsuccessful)
1715

18-
* Accepts `cacheDirectories` array in package.json to override default `node_modules` caching
16+
- https://github.com/heroku/heroku-buildpack-nodejs/issues/273
17+
18+
## v84 (2015-10-08)
19+
20+
Replaces sed with awk for output formatting
21+
22+
- large output (from assets or npm 3) was crashing sed ('resource unavailable')
23+
24+
## v83 (2015-10-05)
25+
26+
Caching improvements
27+
28+
- Fixes modules-checked-in reference URL
29+
- When cache restoration is disabled, empties the cache instead of saving it
30+
- Adds bower_components as a default cache target
31+
32+
## v82 (2015-09-30)
33+
34+
Detects bower+angular resolution failures
35+
Detects missing grunt/gulp/bower failures
36+
37+
## v81 (2015-09-24)
38+
39+
Supports WEB_CONCURRENCY=28 for Performance-L dynos
40+
41+
## v80 (2015-08-14)
42+
43+
Fixes not defaulting to `NODE_ENV=production` during runtime
44+
45+
## v79 (2015-08-10)
46+
47+
Supports WEB_CONCURRENCY for Performance-M dynos
48+
49+
## v78 (2015-07-24)
50+
51+
Defaults node environment to 'production'; bugfixes
52+
53+
- Fix runtime signature cache invalidation
54+
- Provide error messaging for un-downloadable binaries
55+
- Default to NODE_ENV=production for both build and runtime
56+
- https://github.com/heroku/heroku-buildpack-nodejs/issues/60
57+
58+
## v77 (2015-07-15)
59+
60+
Npm bootstrapping skipped when using iojs.
61+
62+
- Fixes https://github.com/heroku/heroku-buildpack-nodejs/issues/202
63+
64+
## v76 (2015-06-23)
65+
66+
Refactor to bring caching logic to the forefront.
67+
68+
- Fixes cachDirectories issues
69+
- Addresses https://github.com/heroku/heroku-buildpack-nodejs/pull/231
70+
- Addresses https://github.com/heroku/heroku-buildpack-nodejs/issues/226
71+
- Simplifies detect (package.json required)
72+
73+
## v75 (2015-04-24)
74+
75+
Updated build failure and help messaging.
76+
77+
## v74 (2015-04-24)
78+
79+
Updated messaging.
80+
81+
## v73 (2015-04-24)
82+
83+
Disables cache restoration if node_modules already exists.
84+
85+
## v72 (2015-04-23)
86+
87+
Accepts `cacheDirectories` array in package.json to override default `node_modules` caching.
88+
89+
- Documented at https://devcenter.heroku.com/articles/nodejs-support#cache-behavior

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,32 @@ In cached mode, [use the semver node_module](bin/compile#L30-32) (as opposed to
4747
1. Build the buildpack
4848

4949
```shell
50-
BUNDLE_GEMFILE=cf.Gemfile bundle exec buildpack-packager [ cached | uncached ]
50+
BUNDLE_GEMFILE=cf.Gemfile bundle exec buildpack-packager [ --cached | --uncached ]
5151
```
5252

5353
1. Use in Cloud Foundry
5454

5555
Upload the buildpack to your Cloud Foundry and optionally specify it by name
56+
5657
```bash
5758
cf create-buildpack custom_node_buildpack node_buildpack-offline-custom.zip 1
5859
cf push my_app -b custom_node_buildpack
5960
```
6061

6162
## Supported binary dependencies
6263

63-
The NodeJS buildpack only supports the two most recent stable patches for each dependency in the [manifest.yml](manifest.yml).
64+
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).
6465

65-
If you want to use previously supported dependency versions, provide the `--use-custom-manifest=manifest-including-unsupported.yml` option to `buildpack-packager`.
66+
67+
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:
68+
69+
```
70+
Could not get translated url, exited with: DEPENDENCY_MISSING_IN_MANIFEST: ...
71+
!
72+
! exit
73+
!
74+
Staging failed: Buildpack compilation step failed
75+
```
6676

6777
## Options
6878

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.0
1+
1.5.1

bin/compile

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ set -o pipefail # don't ignore exit codes when piping output
66
set -o nounset # fail on unset variables
77
unset GIT_DIR # Avoid GIT_DIR leak from previous build steps
88

9+
### Constants
10+
11+
DEFAULT_CACHE="node_modules bower_components"
12+
913
### Configure directories
1014

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

2632
### Load dependencies
2733

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

3844
handle_failure() {
3945
header "Build failed"
40-
failure_message | indent
46+
warn_untracked_dependencies "$LOG_FILE"
47+
warn_angular_resolution "$LOG_FILE"
48+
failure_message | output "$LOG_FILE"
4149
}
4250
trap 'handle_failure' ERR
4351

@@ -60,8 +68,8 @@ create_env() {
6068
}
6169

6270
header "Creating runtime environment"
63-
create_env # can't indent the whole thing because piping causes subshells; no exporting possible
64-
list_node_config | indent
71+
create_env # can't pipe the whole thing because piping causes subshells, preventing exports
72+
list_node_config | output "$LOG_FILE"
6573

6674
install_bins() {
6775
local node_engine=$(read_json "$BUILD_DIR/package.json" ".engines.node")
@@ -79,38 +87,37 @@ install_bins() {
7987
if [ -n "$iojs_engine" ]; then
8088
warn_node_engine "$iojs_engine"
8189
install_iojs "$iojs_engine" "$BUILD_DIR/.heroku/node"
90+
echo "Using bundled npm version for iojs compatibility: `npm --version`"
8291
else
8392
warn_node_engine "$node_engine"
8493
install_nodejs "$node_engine" "$BUILD_DIR/.heroku/node"
94+
install_npm "$npm_engine" "$BUILD_DIR/.heroku/node"
8595
fi
86-
install_npm "$npm_engine" "$BUILD_DIR/.heroku/node"
8796
warn_old_npm
8897
}
8998

9099
header "Installing binaries"
91-
install_bins | indent
100+
install_bins | output "$LOG_FILE"
92101

93102
restore_cache() {
94-
local cache_status=$(get_cache_status)
103+
local cache_status="$(get_cache_status)"
95104

96-
if [ "$cache_status" == "disabled" ]; then
97-
echo "Skipping (cache disabled)"
98-
elif [ "$cache_status" == "invalidated" ]; then
99-
echo "Skipping (cache invalidated)"
100-
else
105+
if [ "$cache_status" == "valid" ]; then
101106
local cache_directories=$(get_cache_directories)
102107
if [ "$cache_directories" == "" ]; then
103-
echo "Loading 1 from cacheDirectories (default):"
104-
restore_cache_directories "$BUILD_DIR" "$CACHE_DIR" "node_modules"
108+
echo "Loading 2 from cacheDirectories (default):"
109+
restore_cache_directories "$BUILD_DIR" "$CACHE_DIR" "$DEFAULT_CACHE"
105110
else
106111
echo "Loading $(echo $cache_directories | wc -w | xargs) from cacheDirectories (package.json):"
107112
restore_cache_directories "$BUILD_DIR" "$CACHE_DIR" $cache_directories
108113
fi
114+
else
115+
echo "Skipping cache restore ($cache_status)"
109116
fi
110117
}
111118

112119
header "Restoring cache"
113-
restore_cache | indent
120+
restore_cache | output "$LOG_FILE"
114121

115122
build_dependencies() {
116123
if $PREBUILD; then
@@ -122,28 +129,32 @@ build_dependencies() {
122129
}
123130

124131
header "Building dependencies"
125-
build_dependencies | indent
132+
build_dependencies | output "$LOG_FILE"
126133

127134
cache_build() {
128135
local cache_directories=$(get_cache_directories)
136+
129137
echo "Clearing previous node cache"
130138
clear_cache
131-
if [ "$cache_directories" == "" ]; then
132-
echo "Saving 1 cacheDirectories (default):"
133-
save_cache_directories "$BUILD_DIR" "$CACHE_DIR" "node_modules"
139+
if ! ${NODE_MODULES_CACHE:-true}; then
140+
echo "Skipping cache save (disabled by config)"
141+
elif [ "$cache_directories" == "" ]; then
142+
echo "Saving 2 cacheDirectories (default):"
143+
save_cache_directories "$BUILD_DIR" "$CACHE_DIR" "$DEFAULT_CACHE"
134144
else
135145
echo "Saving $(echo $cache_directories | wc -w | xargs) cacheDirectories (package.json):"
136146
save_cache_directories "$BUILD_DIR" "$CACHE_DIR" $cache_directories
137147
fi
148+
save_signature
138149
}
139150

140151
header "Caching build"
141-
cache_build | indent
152+
cache_build | output "$LOG_FILE"
142153

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

148159
header "Build succeeded!"
149-
summarize_build | indent
160+
summarize_build | output "$LOG_FILE"

bin/detect

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env bash
22
# bin/detect <build-dir>
33

4+
BP=$(dirname $(dirname $0))
45
if [ -f $1/package.json ]; then
5-
echo "Node.js"
6+
echo "node.js `cat $BP/VERSION`"
67
exit 0
78
fi
89

cf.Gemfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
source "https://rubygems.org"
22

3-
ruby '2.2.2'
3+
ruby '2.2.3'
44

5-
gem 'machete', git: 'https://github.com/cf-buildpacks/machete', tag: 'v0.0.17'
6-
gem 'buildpack-packager', git: 'https://github.com/cloudfoundry-incubator/buildpack-packager', tag: 'v2.2.3'
5+
gem 'machete', git: 'https://github.com/cf-buildpacks/machete', tag: 'v0.0.20'
6+
gem 'buildpack-packager', git: 'https://github.com/cloudfoundry/buildpack-packager', tag: 'v2.2.5'
77
gem 'rspec'
88
gem 'rspec-instafail'
99
gem 'pry'

cf.Gemfile.lock

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
GIT
22
remote: https://github.com/cf-buildpacks/machete
3-
revision: 13055daee5501b3908fe4022b27f0ff9b05128b9
4-
tag: v0.0.17
3+
revision: 0a1710de1f680a602f67f5eff60e9a424acca467
4+
tag: v0.0.20
55
specs:
6-
machete (0.0.17)
6+
machete (0.0.20)
77
httparty
88

99
GIT
10-
remote: https://github.com/cloudfoundry-incubator/buildpack-packager
11-
revision: 58ccd566aee3e1dbfd1810256e3e41eb39d14d54
12-
tag: v2.2.3
10+
remote: https://github.com/cloudfoundry/buildpack-packager
11+
revision: ae3ac1feefe81cfe2881b39423be201ba38b1615
12+
tag: v2.2.5
1313
specs:
14-
buildpack-packager (2.2.3)
14+
buildpack-packager (2.2.5)
1515
activesupport (~> 4.1.8)
1616
kwalify
1717
terminal-table (~> 1.4.5)
1818

1919
GEM
2020
remote: https://rubygems.org/
2121
specs:
22-
activesupport (4.1.12)
22+
activesupport (4.1.13)
2323
i18n (~> 0.6, >= 0.6.9)
2424
json (~> 1.7, >= 1.7.7)
2525
minitest (~> 5.1)
2626
thread_safe (~> 0.1)
2727
tzinfo (~> 1.1)
2828
coderay (1.1.0)
2929
diff-lcs (1.2.5)
30-
httparty (0.13.5)
30+
httparty (0.13.7)
3131
json (~> 1.8)
3232
multi_xml (>= 0.5.2)
3333
i18n (0.7.0)
34-
json (1.8.2)
34+
json (1.8.3)
3535
kwalify (0.7.2)
3636
method_source (0.8.2)
37-
minitest (5.7.0)
37+
minitest (5.8.0)
3838
multi_xml (0.5.5)
3939
pry (0.10.1)
4040
coderay (~> 1.1.0)
@@ -72,4 +72,4 @@ DEPENDENCIES
7272
rspec-instafail
7373

7474
BUNDLED WITH
75-
1.10.5
75+
1.10.6

0 commit comments

Comments
 (0)