My recommendation of releasing open source libraries - not only for Node.
This guide was written specifically for Node modules but it can be adapted to other languages and environments simply by changing "npm" to the main place where open source libraries are published for the given platform (e.g. CPAN for Perl, RubyGems for Ruby etc.)
It is divided into three main stages - a one-time Setup being the first thing to do and ongoing Development and Maintainance stages, plus some useful Tips and Services as a bonus.
See also Releasing Internal Libraries as Open Source for my recommendation on how to create open source libraries with functionality that was already implemented as a part of a client project.
One-time process:
- find a name not used on npm
- start a project on github
- register the name on npm
- decide git branching model before making any commits
- decide code style guide before writing any code
- configure the github project with protected branches and restricted merging
- add license to the project as a first commit
- add minimal readme to the project
- add minimal boilerplate for the library with no functionality yet
- add minimal tests for the project to verify if the library can be required
- add project metadata for package managers
- add test scripts to the package meta data
- add linter to the test pipeline to enforce the chosen code style guide
- configure CI (travis and/or circle) with multiple runtime versions
- add badges for CI build status, download count, license etc. to the readme
- explain style guide, branching model and contribution rules in the readme
- add tools to monitor outdated dependencies and vulnerabilities
- publish as a 0.0.0 version and proceed to the development stage
Ongoing process:
- write the implementation and tests of the new features
- run the tests locally and on CI systems
- make sure that the new features work as expected
- document new changes in readme/docs
- bump the version according to the semver rules
- merge the code according to the branching style
- publish the new version on npm
- rinse, repeat
Periodically:
- handle outstanding issues and pull requests
- update CI pipeline with new runtime versions
- test manually with different runtimes and preferably different operating systems
Some useful tips for easier testing:
- you can run tests in Docker to quickly test on different Linux distros
- you can run tests in Vagrant to test on multiple different operating systems
Some useful services to help with the development and testing:
- Project hosting: GitHub (the #1 service for open source projects)
- CI system: Travis (#1), Circle (#2) and more (the more the better), see my analysis and recommendations.
I recommend following the Strict Flow and GitHub Project Guidelines.