home / skills / autumnsgrove / groveengine / npm-publish

npm-publish skill

/.claude/skills/npm-publish

This skill publishes @autumnsgrove/groveengine to npm by swapping registries, building, publishing, and reverting settings to maintain GitHub Packages.

npx playbooks add skill autumnsgrove/groveengine --skill npm-publish

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
4.3 KB
No content available

Overview

This skill publishes @autumnsgrove/groveengine to the public npm registry while preserving GitHub Packages as the default registry for the repository. It implements a safe registry-swap workflow: switch to npm for publishing, build and publish, then switch the publishConfig back to GitHub Packages. Use it when releasing a new engine version to ensure correct registry, access, and commits.

How this skill works

The skill updates packages/engine/package.json to bump the version and temporarily replace publishConfig with the npm registry and public access. It runs the package build, executes npm publish --access public, then restores the publishConfig back to the GitHub Packages registry. Finally it commits the version bump and pushes the change to the remote to keep the repository consistent.

When to use it

  • Releasing a new version of @autumnsgrove/groveengine to npm
  • When a user requests: "publish to npm", "release to npm", or "bump and publish"
  • After merging feature or bugfix changes that require a new package version
  • When preparing a public package release while keeping GitHub Packages as default

Best practices

  • Decide and verify the new semantic version (MAJOR.MINOR.PATCH) before editing package.json
  • Always swap publishConfig to npm only for the publish step and then swap back immediately
  • Build the package locally (pnpm run package) before running npm publish
  • Verify npm auth token and 2FA bypass settings in npm config to avoid OTP errors
  • Commit only the version and publishConfig change, and push to the main branch after publishing

Example use cases

  • Minor feature release: bump MINOR, swap to npm, build, publish, swap back, commit and push
  • Patch hotfix: bump PATCH, run build and publish to npm to make the fix available
  • Major release with breaking changes: bump MAJOR and follow the same publish workflow
  • Automated release script that edits packages/engine/package.json, publishes, and reverts publishConfig

FAQ

What if npm asks for a one-time password (OTP)?

Create a granular npm token with "Bypass 2FA" enabled and set it with npm config set //registry.npmjs.org/:_authToken=npm_YOUR_TOKEN.

I accidentally committed the npm registry change. How do I fix it?

Edit publishConfig back to GitHub, git add the file, then git commit --amend --no-edit and git push --force-with-lease to correct history.