Be a good npm Module! – Readme, License, Travis, Coveralls



Be a good npm Module! – Readme, License, Travis, Coveralls

0 0


be-a-good-npm-module

Presentation about quality signs of an npm module

On Github saintedlama / be-a-good-npm-module

Be a good npm Module!

Readme, License, Travis, Coveralls

Minimum Requirements

  • README.md including tutorial
  • README.md including npm install command
  • LICENSE file (licenseify)

Traffic Sources

Popular Content

Publish modules

  • Get an npm account
  • npm pack
  • check your package tgz. Don't ship shit
  • npm publish package_name.tgz

Don't ship shit!

Test and Cover

  • I use mocha
  • plain mocha output is - not nice
  • mocha -R spec
  • Coverage: Istanbul

Test and Cover

"scripts": {
    "test": "mocha -R spec test/",
    "cover": "istanbul cover
        ./node_modules/mocha/bin/_mocha --report html -- -R spec"
}

Going CI

  • Travis
  • Coveralls
  • Free for Open Source

Travis and Coveralls

language: node_js
node_js:
- "0.10"

services:
- mongodb

before_script:
- npm install -g istanbul
- npm install coveralls
- npm install mocha-lcov-reporter

after_script:
- NODE_ENV=test istanbul cover
    ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec &&
    cat ./coverage/lcov.info |
    ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage

Thanks!