chore(script): list latest package versions from registry

This commit is contained in:
Elliot DeNolf
2023-10-02 17:19:40 -04:00
parent 7abb2450ef
commit 0c977511f6
2 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# List all published packages
# parse params: tag=beta or blank string ''
tag=${1:-}
echo
if [ -n "$tag" ]; then
echo "Listing packages with tag: $tag"
tag="@$tag"
else
echo "Listing latest packages"
tag=""
fi
echo
packages=$(find packages -name package.json -type f -exec grep -L '"private": true' {} \; | xargs jq -r '.name')
# sort alphabetically
packages=$(echo "$packages" | tr ' ' '\n' | sort -u | tr '\n' ' ')
# Loop through each package and print the name and version. Print as table
for package in $packages; do
version=$(npm view "$package""$tag" version 2> /dev/null || echo "N/A")
printf "%-30s %s\n" "$package" "$version"
done