From e2301c37ed51630a7c40a05a0492acb1b60425e4 Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 30 Sep 2026 21:23:08 +0800 Subject: [PATCH] scripts/publish.sh: publishes every package whose version isn't on npm yet, with one OTP for the lot --- scripts/publish.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 scripts/publish.sh 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