npm-package/PUBLISHING.md
This guide covers how to publish the @beads/bd package to npm.
@beads, so you need to either:
npm login
This will prompt for:
npm whoami
Should output your npm username.
If the @beads organization doesn't exist:
npm org create beads
Or manually at: https://www.npmjs.com/org/create
The version in package.json should match the beads release version.
# Edit package.json manually or use npm version
npm version patch # or minor, major
# From the npm-package directory
npm test
# Test installation locally
npm link
# Verify the global install works
bd version
For the first publish:
# Publish as public (scoped packages are private by default)
npm publish --access public
For subsequent publishes:
npm publish
# Check the package page
open https://www.npmjs.com/package/@beads/bd
# Try installing it
npm install -g @beads/bd
bd version
The typical workflow when a new beads version is released:
npm install and npm test to ensure binaries download correctlynpm publish --access public (or just npm publish after first release)In the future, this could be automated with GitHub Actions:
# .github/workflows/publish-npm.yml
name: Publish to npm
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- run: cd npm-package && npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
You're trying to publish a version that already exists. Bump the version:
npm version patch
npm publish
You're not logged in:
npm login
npm whoami # verify
You don't have permission to publish to @beads. Either:
The version in package.json doesn't match a GitHub release, or the release doesn't have the required binary assets.
Check: https://github.com/gastownhall/beads/releases/v{VERSION}
Keep these in sync:
npm-package/package.json versionv0.21.5)The postinstall script downloads binaries from:
https://github.com/gastownhall/beads/releases/download/v{VERSION}/beads_{VERSION}_{platform}_{arch}.{ext}