Open stof opened 4 years ago
Hi @stof, thanks for raising this - we download the node
binaries as is, which include npm
, and release them to our own S3 buckets. I'm not sure the reasoning for Node having the npm docs there, but it may warrant a discussion/open issue over on Node.
On the flip side, I'd like to remove any unused artifacts that get pulled into slugs regardless, so I'll look at what we can do on the Heroku binaries/buildpack end.
Well, for the docs
folder, which seems to be the source of the website, this seems indeed questionable. The fact that we also have the scripts
folder containing development tooling makes me wonder whether they ever filtered the content they ship.
The man
folder is probably used for npm help
(unless they actually duplicate the content), but that's not a command you will run on heroku.
I can take a look at this. I'll ask if we can remove the docs
directory.
As for npm help
, people often run scripts in dyno if they have created a one/off dyno, so we will want to keep that.
Is it possible to use something like https://github.com/istrategylabs/heroku-buildpack-node-cleanup and delete them from the slug?
Trying to reduce the slug size, I investigated what ends up as part of the 86MB
.heroku/node
folder (as reported bydu -h -d 1 .heroku
in a one-off dyno). Among this size, we have 6.3MB contributed by.heroku/node/lib/node_modules/npm/docs
. Including the npm documentation in the slug looks unnecessary to me, and that represents 7% of the (uncompressed) size contributed by the buildpack.Note that the
man
,scripts
(containing npm development tooling) andchangelogs
folders of thenpm
install could probably also be removed in the cleanup (but they are much smaller).