As a contributor of some packages on npm, I will try my best to give you some tips on how to publish package on npm.
Node package manager is the official package manager for nodejs.
You must use Semver versioning for your package.
If you use Grunt or Gulp, you can use a plugin to release a major or minor version, and automate your release process (grunt-bump, gulp-bump)
devDependencies key in your
package.json to define dependencies needed in your build or test process.
Install package as dev dependencies :
npm install <package-name> --save-dev
You must put your test framework, grunt|gulp plugins, jshint, in
You can use a
.npmignore file at the root of your project to keep your files and directories out of your package. For example, tests and demo directories can be excluded.
.npmignore example file
test .jshintrc .travis.yml
Test your module
Before publishing your node package, it's really interesting to test it installed, globally or in another project.
Global module, if your package define global module you can install this using.
cd your_module_directory npm install . -g # Test
You can also test your module in another project using this command:
cd test_project npm install you_module-directory # Test
npm documentation : https://www.npmjs.org/doc/
Grunt bump: https://github.com/vojtajina/grunt-bump
Gulp bump: https://github.com/stevelacy/gulp-bump