Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.

Deletes the node_modules directory and unsets $WEB_CONCURRENCY

Notifications You must be signed in to change notification settings

josephabrahams/heroku-buildpack-node-cleanup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 

Repository files navigation

Heroku Buildpack: Node Cleanup

Deprecation Notice: Heroku now strips out the packages declared under devDependencies before deploying the application. Additionally, they have moved to a standardized application concurrency script across all buildpacks, /app/.profile.d/WEB_CONCURRENCY.sh.

Make the official Heroku buildpack for Node.js compatible with other buildpacks

Delete the node_modules directory

The maximum allowed Heroku slug size (after compression) is 300MB. Image-heavy apps can somethings butt up against this limit, especially when using multiple buildpacks. If you're using Node.js to compile your front-end assets, but not to run your app, you may be able to save a large amount of space by deleting the node_modules directory before slug compilation.

Support running an app from a subdirectory

Set the NPM_PREFIX environment variable to the relative path of the subdirectory that contains the node_modules directory that you'd like to delete.

Delete the nodejs.sh startup script

There is currently an incompatibility between the Node.js and other buildpacks. On dyno boot, the nodejs.sh startup script sets the WEB_CONCURRENCY variable. The launch scripts of subsequent buildpacks will pick this us with no way of knowing that it wasn't set by a user.

Usage

First, set the Node.js buildpack to compile your assets:

$ heroku buildpacks:set heroku/nodejs

Next, add the Node Cleanup buildpack to get rid of the node_modules directory:

$ heroku buildpacks:set --index 1 https://github.com/josephabrahams/heroku-buildpack-node-cleanup

Finally, add whichever buildpack runs your app:

$ heroku buildpacks:set --index 2 heroku/python

Documentation

For more general information about buildpacks on Heroku:

About

Deletes the node_modules directory and unsets $WEB_CONCURRENCY

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%