#JSDev wrapper for node
JSDev is a filter that activates selected comments, making them executable. This makes it possible to put development, performance, and testing scaffolding into a source file. The scaffolding is removed by minification, but is activated by JSDev.
You can refer to his original project repository to learn how to use it.
This module change the require() function behavior so that you could easily use JSDev in your node projects.
require('jsdev').modifyRequire() require('./b') /*log 'tag in script which require jsdev will not be opened'*/
var util = require('util') //jsdev(test) tag2 log:console.log //jsdev(test,production) tag1 //jsdev tag1 log:util.log /*tag1 console.log('tag1 opened')*/ /*tag2 console.log('tag2 opened')*/ /*log 'function tag'*/
$ node a.js tag1 opened 10 Feb 13:23:53 - function tag
$ NODE_ENV=test node a.js tag1 opened tag2 opened function tag
$ NODE_ENV=production node a.js tag1 opened
jsdev@>=0.0.1into devDependencies in the package.json file of your project.
- Any futher require()'d file will apply the rules specified in the file as a comment line start with
//jsdev(test,production) tag1to turn on tag3 in test and production environment. If you don't specify the environment, it will default to be development(
//jsdev tag2turn tag2 on in only the development environment).