Last active
January 5, 2025 13:31
-
-
Save azu/7ae8b2c7a10f1f52d8769072437407d5 to your computer and use it in GitHub Desktop.
`pnpm --recursive update --interactive --latest` for pnpm catalogs. pnpm + fzf + yq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Update pnpm catalog with interactive | |
# pnpm catalog: https://pnpm.io/ja/catalogs | |
# fzf: https://github.com/junegunn/fzf | |
# yq: https://github.com/kislyuk/yq | |
selected_cataglogs=$(pnpm outdated --recursive --json | jq -r 'to_entries[] | .key + ": " + .value.current + " → " + .value.latest' | fzf --multi) | |
echo $selected_cataglogs | while read line ; do | |
pkg_name=$(echo "$line" | cut -d: -f1) | |
pkg_version=$(echo "$line" | cut -d' ' -f4) | |
echo "Update $pkg_name to $pkg_version" | |
yq -i ".catalog += {\"$pkg_name\": \"$pkg_version\"}" pnpm-workspace.yaml | |
done | |
pnpm install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment