pkg-claim
v2.0.0
Published
Reserve an npm package name by publishing a minimal stub
Downloads
573
Readme
pkg-claim
Reserve an npm package name by publishing a minimal stub package.
Requirements
- Node.js 24+ for the built CLI, or Bun for local development
- npm authentication (
npm login)
If your npm account requires 2FA, security-key, or browser authentication for
publishing, pkg-claim lets npm publish use the terminal directly so you can
complete npm's prompt during the publish step.
Usage
Run directly with npx:
npx pkg-claimPreview the flow without publishing:
npx pkg-claim --dry-runPublish non-interactively after confirming the exact package name:
npx pkg-claim --no-input --name my-package --yes --confirm-name my-packageYou can also run the built artifact locally:
node bin/pkg-claim.js --dry-run
bun bin/pkg-claim.js --dry-runWhat it does
- Ensures npm is installed
- Verifies npm authentication before any real publish
- Checks whether the package name is available on npm
- Prompts for description, license, and author
- Shows a final publish confirmation, requires the exact package name, and publishes a temporary minimal package to npm (or stops before publish in
--dry-runmode)
Development
bun install
bun test
bun run typecheck
bun run build
bun run checkCreate a changeset for user-facing changes before merging to main:
bun run changesetRelease process
- Run
bun run changesetin a feature branch and commit the generated.changeset/*.mdfile. - Merge the feature PR into
main. - GitHub Actions opens or updates a release PR with the pending version bump.
- Merge that release PR to publish
pkg-claimto npm automatically.
The publish workflow uses npm Trusted Publishing from GitHub Actions, so npm must be configured to trust this repository before the first automated release.
