Maintaining these projects might appear a chore, but in reality it is quite easy. The key is to tighten the project right after implementing the functionality. The overall goal is to make the project easy to jump back to in the future.
Here are steps I take to tighten the module for long term maintenance:
Write unit tests, using a tool that provides code coverage. My favorite is my own gt. It has same syntax as QUnit, but has larger number of test types (external shells, performance) and runs natively under nodejs.
- think of minimum coverage numbers for code and for unit test code. I would personally shoot for 75% - 90% test coverage for my source files, and 95% - 100% for the tests themselves (to make sure not too many tests are skipped at any point).
Add badges to your README.md file to show build status, npm stats and out of date dependencies. For example, here are badges for one of my projects
You can read more about badges in project status badges
Install grunt-complexity and setup maximum complexity limits in your Gruntfile.js. I believe for long term maintenance this is an extremely important step. Try to refactor code to have lower complexity while the code is still fresh in your memory.
Install grunt-nice-package with
npm install grunt-nice-package --save-devand add nice-package task to your pipeline:
grunt-nice-package is a very lightweight sanity checker for your package.json, warning you if there are any missing fields. Adding the missing fields makes package reuse easier for others.
If your project has both package.json and bower.json, add grunt-npm2bower-sync to sync main properties from package.json to bower.json
"pre-push": [ "rm -rf node_modules", "npm install", "npm test" ]
Hope this list helps you improve and maintain your nodejs modules.