Skip to content

Instantly share code, notes, and snippets.

@joeworkman
Created January 9, 2022 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joeworkman/373c8b72e5596aaa6094e8e1bc97845c to your computer and use it in GitHub Desktop.
Save joeworkman/373c8b72e5596aaa6094e8e1bc97845c to your computer and use it in GitHub Desktop.
Store a set of folders that will run pnpm instead of npm without having to remember what repos use what command. This is a simple shell function that you can add to your shell rc file.
npm() {
pnpm_folders=(/dev/repo1 /dev/repo2)
if printf '%s\n' "${pnpm_folders[@]}" | grep `pwd` ; then
pnpm $@
else
npm $@
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment