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
This commit is contained in:
1 parent
8829d3142c
commit
1af3a1360e
9 files changed
+155
-19
No files matched your search
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/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
|
||||
Reference in new issue
Block a user