1.0.17 • Published 6 years ago
@limitedeternity/prune v1.0.17
prune
prune is a CLI utility, used to clean garbage from ./node_modules
Why?
Because it's free.
Fast and async.
Zero dependenices.
node-prune
is written using Golang, so it's usually not usable.
Install?
$ npm install --save-dev @limitedeternity/prune
So, how to?
Build-time:
>>> *package.json*:
"scripts": {
"postinstall": "bash scripts/build.sh"
}
>>> *scripts/build.sh*:
#!/usr/bin/env bash
if [[ $NODE_ENV == production ]]; then
<build your stuff>
fi;
prune
CLI (in app directory):
$ prune
node_modules cleanup is running...
Running dedupe...
Dedupe finished. Removing rest of garbage files...
Cleanup finished.
Note: prune
action is irreversable. You should either recreate node_modules folder before each build or use npm ci
.
In Heroku case you should set NODE_MODULES_CACHE
var to false
.
Who needs that?
Oh, wait, I have an answer for that...