diff --git a/scripts/publish.sh b/scripts/publish.sh new file mode 100755 index 0000000..1b023c3 --- /dev/null +++ b/scripts/publish.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# Publishes every package whose version isn't on npm yet. +# scripts/publish.sh (the one-time password of the npm account) +# One password covers the lot: it is sent with each publish while it lasts. +set -e +cd "$(dirname "$0")/.." +bun scripts/check.mjs +otp="$1" +for dir in packages/*/; do + name=$(node -p "require('./${dir}package.json').name") + version=$(node -p "require('./${dir}package.json').version") + if [ "$(npm view "$name@$version" version 2>/dev/null)" = "$version" ]; then + echo "= $name@$version is on npm already" + continue + fi + (cd "$dir" && npm publish --access public ${otp:+--otp="$otp"}) +done