Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for pnpm packages #288

Merged
merged 1 commit into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -2091,14 +2091,29 @@ get_packages() {
else
# If neither exist, use npm root -g to get the global directory.
# (still ~10x faster than npm list)
npm_global=$(npm root -g)
[[ -d $npm_global ]] && dir "$npm_global"/*/
npm_global="$(npm root -g)"
[[ -d "$npm_global" ]] && dir "$npm_global"/*/

# This may not work in WSL2 (if npm is installed on Windows, not WSL).
# However, if npm is not installed on this WSL subsystem, it doesn't really count
# as a package manager for this subsystem, so let's ignore this case.
fi
fi

# Relatively the same for pnpm
if has pnpm; then
# Try to apply heuristics to find the global directory.
PNPM_P="local/share/pnpm/global/5/node_modules"
if [[ -d "$HOME/.$PNPM_P" ]]; then
dir "$HOME/.$PNPM_P"/*/
elif [[ -d "/usr/$PNPM_P" ]]; then
dir "/usr/$PNPM"/*/
else
# If neither exist, use pnpm root -g to get the global directory.
pnpm_global="$(pnpm root -g)"
[[ -d "$pnpm_global" ]] && dir "$pnpm_global"/*/
fi
fi
fi

if has pkgx && [[ -d "$HOME/.local/bin" ]]; then
Expand Down
Loading