npmi

workflow tools npm

Run npm install in all directories that contain a package.json file. Similar to npmci but uses npm install instead of npm ci, allowing package-lock.json to be updated if needed. Useful for updating dependencies across multiple packages in a monorepo.

Usage: git npmi

CLI Command

git config --global alias.npmi "!f() { git ls-files "*/package.json" | sed "s|/[^/]*$||" | sort -u | xargs -I {} sh -c "echo 'Running npm i in {}' && cd {} && npm i"; }; f"

.gitconfig Snippet

[alias]
  npmi = !f() { git ls-files "*/package.json" | sed "s|/[^/]*$||" | sort -u | xargs -I {} sh -c "echo 'Running npm i in {}' && cd {} && npm i"; }; f