Files
nous-portal/publish.sh
T
AlexKucera 1af3a1360e feat: make the package installable from npm
pi loads a package's extensions through the `pi` manifest or an
`extensions/` directory, so a root index.ts loaded nothing as a
package. Add "pi": { "extensions": ["./index.ts"] }, a files
whitelist that keeps tests and docs out of the tarball, and the
repository links the pi.dev/packages gallery shows.

Add publish.sh for releases: checks, tarball preview, changelog
heading, commit, tag, npm publish, push. No CI (ADR 0003).

Lead the README with pi install npm:pi-nous-portal, document the
release script, and label the package unofficial and
community-maintained. The README also gets a plainer voice.

The publish itself is still pending. Refs #3
2026-11-25 16:15:15 +01:00

35 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Release pi-nous-portal to npm and push the tag.
#
# ./publish.sh release the version in package.json
# ./publish.sh patch bump first (minor, major, or an explicit version work too)
#
# npm asks for your 2FA code at the publish step. If the publish fails after
# the tag exists, fix the cause and rerun: npm publish && git push origin main --follow-tags
set -euo pipefail
bump="${1:-}"
cd "$(dirname "$0")"
[ -z "$(git status --porcelain)" ] || { echo "working tree is not clean" >&2; exit 1; }
[ "$(git branch --show-current)" = "main" ] || { echo "not on main" >&2; exit 1; }
npm whoami >/dev/null
if [ -n "$bump" ]; then
npm version "$bump" --no-git-tag-version
fi
version=$(node -p "require('./package.json').version")
grep -qx '## \[Unreleased\]' CHANGELOG.md || { echo "CHANGELOG.md has no '## [Unreleased]' heading" >&2; exit 1; }
npm run check
npm pack --dry-run
# The Unreleased section becomes the entry for this version.
perl -0pi -e "s/^## \[Unreleased\]\$/## [$version] - $(date +%F)/m" CHANGELOG.md
git commit -am "release v$version"
git tag -a "v$version" -m "v$version"
npm publish
git push origin main --follow-tags