Skip to content

Latest commit

 

History

History
89 lines (69 loc) · 1.85 KB

File metadata and controls

89 lines (69 loc) · 1.85 KB

Publishing to npm

Pre-publish Checklist

  • Tests pass (bun test)
  • Build works (bun run build)
  • CLI works (node dist/cli.js --version)
  • README is comprehensive
  • LICENSE file exists
  • package.json has all required fields
  • Update package name to unique npm name
  • Update author and repository URLs
  • Test locally with npm link

Publishing Steps

  1. Update package name (if complexity-analyzer is taken):

    # Edit package.json to use a unique name like:
    # "@hew/complexity-analyzer" or "complexity-analyzer-cli"
  2. Test locally:

    # Build the package
    bun run build
    
    # Test local installation
    npm link
    cd /tmp/test-project
    npm link complexity-analyzer
    npx complexity-analyzer --version
  3. Login to npm:

    npm login
  4. Publish (dry run first):

    # See what would be published
    npm pack --dry-run
    
    # Check package size
    npm publish --dry-run
  5. Actual publish:

    npm publish
    
    # Or if scoped:
    npm publish --access public
  6. Verify installation:

    npm install -g complexity-analyzer
    complexity-analyzer --version

Post-publish

  1. Create a GitHub release
  2. Tag the version: git tag v0.0.1 && git push --tags
  3. Update README with actual npm package name
  4. Share on social media / dev communities

Version Bumping

For future releases:

# Patch release (0.0.1 -> 0.0.2)
npm version patch

# Minor release (0.0.1 -> 0.1.0)
npm version minor

# Major release (0.0.1 -> 1.0.0)
npm version major

Troubleshooting

  • Name taken: Add a scope @username/package-name or choose unique name
  • Auth issues: Run npm login again
  • Size too large: Check .npmignore is working
  • Missing files: Check files field in package.json