@zcross/znpm
v0.4.2
Published
znpm frees up drive space by deduplicating the files in node_modules.
Readme
znpm
znpm frees up drive space by deduplicating the files in node_modules. It wraps npm, so you keep using npm as normal, and packages and manifests come out exactly as npm would install them. Your projects don't need to change at all.
Install
Bash (including Git Bash):
eval "$(curl -fsSL https://github.com/visionsofparadise/znpm/releases/latest/download/install.sh | sh)"PowerShell:
irm https://github.com/visionsofparadise/znpm/releases/latest/download/install.ps1 | iexnpm, in bash:
npm i -g @zcross/znpm && eval "$(znpm enable --shell sh)"npm, in PowerShell:
npm i -g @zcross/znpm; znpm enable --shell powershell | iexSupports: Windows x64/arm64, Linux x64/arm64 with glibc or musl, macOS arm64/x64
Each line installs znpm and turns it on in the shell you ran it in. znpm wraps npm, so npm has to be on PATH first. On Windows, turning it on asks for elevation once.
Check that npm is going through znpm:
npm -v
# X.Y.Z (znpm A.B.C)Then use npm as you always have:
npm install # node_modules files are deduplicated across the drive
npm run ... # commands unrelated to packages are unaffectedReclaiming disk
znpm gcDeletes stored packages on the current drive that no project uses anymore.
Turning it off
znpm disableYou're back on plain npm instantly, nothing to clean up, and every project keeps working as it is. znpm enable turns it back on.
znpm uninstallRemoves znpm from the device entirely.
Escape hatches
To run a single command on plain npm, set ZNPM_DISABLE=1 in the environment, or pass --znpm-disable on the command.
To persistently disable set "disabled": true in znpm's state.json.
You can ignore packages by listing them in your package.json:
{ "znpm": { "ignore": ["left-pad"] } }An ignored package is left exactly as npm installed it: its own copy, writable.
