heroku/heroku-buildpack-nodejs — pull request #37 by gabrtv (2013-05-10 22:15:29+00:00)
Title: Cache node_modules across compiles

`CACHE_STORE_DIR` and `CACHE_TARGET_DIR` are being declared in `bin/compile` -- but not used. These changes use those envvars to save `node_modules` across compiles.

First compile:

```
-----> Fetching custom git buildpack... done
-----> Node.js app detected
-----> Resolving engine versions
Using Node.js version: 0.10.5
Using npm version: 1.2.18
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
npm http GET https://registry.npmjs.org/express
npm http 200 https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/express/-/express-3.1.2.tgz
npm http 200 https://registry.npmjs.org/express/-/express-3.1.2.tgz
npm http GET https://registry.npmjs.org/connect/2.7.5
npm http GET https://registry.npmjs.org/commander/0.6.1
npm http GET https://registry.npmjs.org/range-parser/0.0.4
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/cookie/0.0.5
npm http GET https://registry.npmjs.org/buffer-crc32
npm http GET https://registry.npmjs.org/fresh/0.1.0
npm http GET https://registry.npmjs.org/methods/0.0.1
npm http GET https://registry.npmjs.org/send/0.1.0
npm http GET https://registry.npmjs.org/cookie-signature/1.0.0
npm http GET https://registry.npmjs.org/debug
npm http 200 https://registry.npmjs.org/range-parser/0.0.4
npm http GET https://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz
npm http 200 https://registry.npmjs.org/commander/0.6.1
npm http GET https://registry.npmjs.org/commander/-/commander-0.6.1.tgz
npm http 200 https://registry.npmjs.org/cookie/0.0.5
npm http GET https://registry.npmjs.org/cookie/-/cookie-0.0.5.tgz
npm http 200 https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz
npm http 200 https://registry.npmjs.org/connect/2.7.5
npm http GET https://registry.npmjs.org/connect/-/connect-2.7.5.tgz
npm http 200 https://registry.npmjs.org/fresh/0.1.0
npm http 200 https://registry.npmjs.org/methods/0.0.1
npm http GET https://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz
npm http GET https://registry.npmjs.org/methods/-/methods-0.0.1.tgz
npm http 200 https://registry.npmjs.org/send/0.1.0
npm http GET https://registry.npmjs.org/send/-/send-0.1.0.tgz
npm http 200 https://registry.npmjs.org/cookie-signature/1.0.0
npm http GET https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.0.tgz
npm http 200 https://registry.npmjs.org/buffer-crc32
npm http GET https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.1.tgz
npm http 200 https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/debug/-/debug-0.7.2.tgz
npm http 200 https://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz
npm http 200 https://registry.npmjs.org/cookie/-/cookie-0.0.5.tgz
npm http 200 https://registry.npmjs.org/commander/-/commander-0.6.1.tgz
npm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz
npm http 200 https://registry.npmjs.org/connect/-/connect-2.7.5.tgz
npm http 200 https://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz
npm http 200 https://registry.npmjs.org/methods/-/methods-0.0.1.tgz
npm http 200 https://registry.npmjs.org/send/-/send-0.1.0.tgz
npm http 200 https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.0.tgz
npm WARN package.json methods@0.0.1 No README.md file found!
npm http 200 https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.1.tgz
npm http 200 https://registry.npmjs.org/debug/-/debug-0.7.2.tgz
npm http GET https://registry.npmjs.org/mime/1.2.6
npm http GET https://registry.npmjs.org/qs/0.5.1
npm http GET https://registry.npmjs.org/formidable/1.0.11
npm http GET https://registry.npmjs.org/buffer-crc32/0.1.1
npm http GET https://registry.npmjs.org/bytes/0.2.0
npm http GET https://registry.npmjs.org/pause/0.0.1
npm http 200 https://registry.npmjs.org/mime/1.2.6
npm http GET https://registry.npmjs.org/mime/-/mime-1.2.6.tgz
npm http 200 https://registry.npmjs.org/pause/0.0.1
npm http GET https://registry.npmjs.org/pause/-/pause-0.0.1.tgz
npm http 200 https://registry.npmjs.org/qs/0.5.1
npm http GET https://registry.npmjs.org/qs/-/qs-0.5.1.tgz
npm http 200 https://registry.npmjs.org/formidable/1.0.11
npm http 200 https://registry.npmjs.org/buffer-crc32/0.1.1
npm http 200 https://registry.npmjs.org/bytes/0.2.0
npm http GET https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.1.1.tgz
npm http GET https://registry.npmjs.org/formidable/-/formidable-1.0.11.tgz
npm http GET https://registry.npmjs.org/bytes/-/bytes-0.2.0.tgz
npm http 200 https://registry.npmjs.org/mime/-/mime-1.2.6.tgz
npm http 200 https://registry.npmjs.org/pause/-/pause-0.0.1.tgz
npm http 200 https://registry.npmjs.org/bytes/-/bytes-0.2.0.tgz
npm http 200 https://registry.npmjs.org/qs/-/qs-0.5.1.tgz
npm http 200 https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.1.1.tgz
npm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.11.tgz
express@3.1.2 node_modules/express
├── methods@0.0.1
├── fresh@0.1.0
├── range-parser@0.0.4
├── cookie-signature@1.0.0
├── buffer-crc32@0.2.1
├── cookie@0.0.5
├── debug@0.7.2
├── commander@0.6.1
├── mkdirp@0.3.5
├── send@0.1.0 (mime@1.2.6)
└── connect@2.7.5 (pause@0.0.1, bytes@0.2.0, buffer-crc32@0.1.1, formidable@1.0.11, qs@0.5.1)
express@3.1.2 /tmp/build_3foahgkawu1g9/node_modules/express
connect@2.7.5 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/connect
qs@0.5.1 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/connect/node_modules/qs
formidable@1.0.11 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/connect/node_modules/formidable
cookie-signature@1.0.0 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/cookie-signature
buffer-crc32@0.1.1 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/connect/node_modules/buffer-crc32
cookie@0.0.5 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/cookie
send@0.1.0 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/send
debug@0.7.2 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/debug
mime@1.2.6 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/send/node_modules/mime
fresh@0.1.0 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/fresh
range-parser@0.0.4 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/range-parser
bytes@0.2.0 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/connect/node_modules/bytes
pause@0.0.1 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/connect/node_modules/pause
commander@0.6.1 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/commander
mkdirp@0.3.5 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/mkdirp
buffer-crc32@0.2.1 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/buffer-crc32
methods@0.0.1 /tmp/build_3foahgkawu1g9/node_modules/express/node_modules/methods
Dependencies installed
-----> Building runtime environment
-----> Discovering process types
Procfile declares types -> web

-----> Compiled slug size: 4.4MB
-----> Launching... done, v5
http://agile-sands-6947.herokuapp.com deployed to Heroku
```

Second compile FTW...

```
-----> Fetching custom git buildpack... done
-----> Node.js app detected
-----> Resolving engine versions
Using Node.js version: 0.10.5
Using npm version: 1.2.18
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
express@3.1.2 /tmp/build_dzwah149pfwq/node_modules/express
connect@2.7.5 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/connect
qs@0.5.1 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/connect/node_modules/qs
formidable@1.0.11 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/connect/node_modules/formidable
cookie-signature@1.0.0 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/cookie-signature
buffer-crc32@0.1.1 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/connect/node_modules/buffer-crc32
cookie@0.0.5 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/cookie
send@0.1.0 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/send
debug@0.7.2 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/debug
mime@1.2.6 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/send/node_modules/mime
fresh@0.1.0 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/fresh
range-parser@0.0.4 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/range-parser
bytes@0.2.0 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/connect/node_modules/bytes
pause@0.0.1 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/connect/node_modules/pause
commander@0.6.1 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/commander
mkdirp@0.3.5 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/mkdirp
buffer-crc32@0.2.1 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/buffer-crc32
methods@0.0.1 /tmp/build_dzwah149pfwq/node_modules/express/node_modules/methods
Dependencies installed
-----> Building runtime environment
-----> Discovering process types
Procfile declares types -> web

-----> Compiled slug size: 4.1MB
-----> Launching... done, v6
http://agile-sands-6947.herokuapp.com deployed to Heroku
```