This guide walks through publishing node-accelerate to npm.
- All tests pass (
npm test) - Benchmarks run successfully (
npm run benchmark) - No compiler warnings
- Code follows style guidelines
- Documentation is complete and accurate
-
package.jsonversion is correct -
package.jsonrepository URL is correct -
package.jsonauthor information is correct -
LICENSEfile is present -
README.mdis complete -
.npmignoreexcludes unnecessary files
- Test on multiple Node.js versions (18, 20, 22)
- Test on Apple Silicon (M1/M2/M3/M4)
- Test on Intel Mac (if available)
- Verify TypeScript definitions work
- Test installation from tarball
- README has installation instructions
- README has usage examples
- API documentation is complete
- CHANGELOG is updated
- GitHub repository URL is correct
Update version in package.json:
npm version patch # or minor, or majorThis will:
- Update
package.jsonversion - Create a git commit
- Create a git tag
Create a tarball and test it:
npm packThis creates node-accelerate-1.0.0.tgz. Test it in another directory:
mkdir test-install
cd test-install
npm init -y
npm install ../node-accelerate/node-accelerate-1.0.0.tgz
node -e "const a = require('@digitaldefiance/node-accelerate'); console.log(a)"npm loginEnter your npm credentials.
For first release:
npm publish --access publicFor subsequent releases:
npm publishCheck the package page:
https://www.npmjs.com/package/node-accelerate
Test installation:
npm install node-accelerate-
Push tags to GitHub:
git push origin main --tags
-
Go to GitHub releases page
-
Click "Create a new release"
-
Select the version tag
-
Add release notes from CHANGELOG
-
Publish release
- Tweet about the release
- Post on Reddit (r/node, r/programming)
- Share on LinkedIn
- Submit to Hacker News
- Watch for issues on GitHub
- Monitor npm download stats
- Respond to questions
- Update blog post with npm install instructions
- Update any external documentation
Common issues:
- Missing Xcode Command Line Tools
- Wrong Node.js version
- Not on macOS
Solution: Improve error messages in binding.gyp
- Verify
index.d.tsis infilesarray inpackage.json - Test with
tsc --noEmitin a TypeScript project
Check what's included:
npm pack --dry-runUpdate .npmignore to exclude unnecessary files.
Follow Semantic Versioning:
- Patch (1.0.x): Bug fixes, documentation updates
- Minor (1.x.0): New features, backward compatible
- Major (x.0.0): Breaking changes
{
"scripts": {
"prepublishOnly": "npm test",
"version": "npm run build && git add -A",
"postversion": "git push && git push --tags"
}
}These ensure:
- Tests run before publishing
- Build is up to date
- Tags are pushed to GitHub
npm auditFix any vulnerabilities before publishing.
Enable 2FA on your npm account:
npm profile enable-2fa auth-and-writes- Update dependencies quarterly
- Test with new Node.js versions
- Update documentation as needed
- Respond to issues promptly
If you need to deprecate a version:
npm deprecate node-accelerate@1.0.0 "Use version 1.1.0 or higher"Only possible within 72 hours:
npm unpublish node-accelerate@1.0.0After 72 hours, you can only deprecate.
- GitHub Issues: Bug reports and feature requests
- npm: Package distribution
- Documentation: Keep README and examples up to date
Ready to publish? Follow the checklist above and you're good to go!