{bash,zsh}rc: fix pnpm aliases for corepack

This commit is contained in:
Aminda Suomalainen 2024-06-21 06:45:41 +03:00
parent 823545ed39
commit fc98187a1c
Signed by: Mikaela
SSH Key Fingerprint: SHA256:CXLULpqNBdUKB6E6fLA1b/4SzG0HvKD19PbIePU175Q
2 changed files with 20 additions and 12 deletions

View File

@ -577,15 +577,19 @@ alias mkdir="\mkdir --verbose"
alias chattr="\chattr -V" alias chattr="\chattr -V"
alias chmod="\chmod --verbose" alias chmod="\chmod --verbose"
# pnpm does less duplicating around # https://github.com/nodejs/corepack/blob/v0.28.2/README.md#corepack-enable--name
if hash pnpm 2> /dev/null; then if hash corepack 2> /dev/null; then
alias npm=pnpm alias yarn="corepack yarn"
alias npmx=pnpx alias yarnpkg="corepack yarnpkg"
alias npx=pnpx alias pnpm="corepack pnpm"
alias pnpmx=pnpx alias pnpx="corepack pnpx"
alias npm="corepack npm"
alias npx="corepack npx"
if ! hash prettier 2> /dev/null; then if ! hash prettier 2> /dev/null; then
alias prettier="pnpm exec prettier --cache --ignore-unknown" alias prettier="pnpm exec prettier --cache --ignore-unknown"
fi fi
else
echo "WARNING! corepack is not installed."
fi fi
# github-pages etc. # github-pages etc.

View File

@ -567,15 +567,19 @@ alias mkdir="\mkdir --verbose"
alias chattr="\chattr -V" alias chattr="\chattr -V"
alias chmod="\chmod --verbose" alias chmod="\chmod --verbose"
# pnpm does less duplicating around # https://github.com/nodejs/corepack/blob/v0.28.2/README.md#corepack-enable--name
if hash pnpm 2>/dev/null; then if hash corepack 2>/dev/null; then
alias npm=pnpm alias yarn="corepack yarn"
alias npmx=pnpx alias yarnpkg="corepack yarnpkg"
alias npx=pnpx alias pnpm="corepack pnpm"
alias pnpmx=pnpx alias pnpx="corepack pnpx"
alias npm="corepack npm"
alias npx="corepack npx"
if ! hash prettier 2>/dev/null; then if ! hash prettier 2>/dev/null; then
alias prettier="pnpm exec prettier --cache --ignore-unknown" alias prettier="pnpm exec prettier --cache --ignore-unknown"
fi fi
else
echo "WARNING! corepack is not installed."
fi fi
# github-pages etc. # github-pages etc.