From e22a8de5e75373b2a560fc6c145bc4827cf273f6 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Sun, 16 May 2021 22:05:27 -0500 Subject: [PATCH] node: Add handy aliases for 'npm' Add standard `npm` aliases that are used frequently. --- modules/node/README.md | 19 +++++++++++++++++++ modules/node/init.zsh | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/modules/node/README.md b/modules/node/README.md index f72acf6..6ec0b75 100644 --- a/modules/node/README.md +++ b/modules/node/README.md @@ -27,6 +27,25 @@ _`$XDG_CONFIG_HOME/nvm`_, _`~/.nvm`_, or is installed with homebrew. - `N_PREFIX` stores the path to [_n_][8] cache. +## Aliases + +### npm + +- `npmi` install a package. +- `npml` list installed packages. +- `npmo` check for outdated packages. +- `npmp` publish a package. +- `npmP` remove extraneous packages. +- `npmr` run arbitrary package scripts. +- `npms` search for packages. +- `npmt` test a package. +- `npmu` update packages. +- `npmx` uninstalls a package. + +- `npmci` install a project with a clean slate. +- `npmcit` install a project with a clean slate and run tests. +- `npmit` install package(s) and run tests. + ## Functions - `node-doc` opens the Node.js online [API documentation][3] in the default diff --git a/modules/node/init.zsh b/modules/node/init.zsh index bc21093..4f50194 100644 --- a/modules/node/init.zsh +++ b/modules/node/init.zsh @@ -43,3 +43,23 @@ fi # N_PREFIX="${XDG_CONFIG_HOME:-$HOME/.config}/n" # The path to 'n' cache. + +# +# Aliases +# + +# npm +alias npmi='npm install' +alias npml='npm list' +alias npmo='npm outdated' +alias npmp='npm publish' +alias npmP='npm prune' +alias npmr='npm run' +alias npms='npm search' +alias npmt='npm test' +alias npmu='npm update' +alias npmx='npm uninstall' + +alias npmci='npm ci' +alias npmcit='npm cit' +alias npmit='npm it'