Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider Adding Node and NPM Caching #19

Open
naaman opened this issue May 16, 2014 · 5 comments
Open

Consider Adding Node and NPM Caching #19

naaman opened this issue May 16, 2014 · 5 comments

Comments

@naaman
Copy link

naaman commented May 16, 2014

Some builds use node and NPM (via the gradle-gulp-plugin), but those artifacts aren't cached during the build process. Consider adding support for node and NPM caching between builds.

@ldaley
Copy link
Contributor

ldaley commented Sep 1, 2014

@naaman a better approach would be to get those plugins to support specifying the locations of caches for these tools, and then to use gradle.gradleUserHomeDir as the cache dir because this is persistent on Heroku.

@cbeams
Copy link

cbeams commented Jun 9, 2015

Looks like the nodejs buildpack just started supporting user-defined cache directories with heroku/heroku-buildpack-nodejs#203. They're doing this via a custom cache_directories attribute in package.json, which seems reasonable to me. I want to cache not only node_modules, but also the libraries pulled in by Bower. In my application these are written to src/main/webapp/lib, i.e. it's not an option to write these files to gradle.gradleUserHomeDir or elsewhere, because these files are actually going to be served by the application.

@jkutner
Copy link
Contributor

jkutner commented Jun 16, 2015

@cbeams are you using the Node.js buildpack in conjunction with this buildpack (such as with buildpack-multi or heroku buildpacks:add)?

Could the artifacts be cached in gradle.gradleUserHomeDir and copied to the webapp location during the build?

@cbeams
Copy link

cbeams commented Jun 16, 2015

@jkutner I am not currently using buildpack-multi. I've done so before, and it's proved more hassle than it's worth. I'm using the normal grade buildpack in conjunction with https://github.com/srs/gradle-node-plugin, and this works well—save for the lack of caching of node_modules, bower_components, etc.

@jkutner
Copy link
Contributor

jkutner commented Jul 6, 2015

@cbeams I created a branch for this. Can you test it out to make sure it does what you expect? You can use it by running:

$ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-gradle#node-modules-cache

By default it should cache node_modules and bower_components. But you can override this to add others by running:

$ heroku config:set BUILD_CACHED_DIRS="node_modules bower_components other_dir"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants