support global installation with 'npm install -g' (#374)

This commit is contained in:
Jeff Williams 2013-04-16 08:43:42 -07:00
parent 32b2ea5a1d
commit 35cfc7c595
3 changed files with 29 additions and 1 deletions

View File

@ -28,6 +28,7 @@
"underscore": "1.4.2",
"wrench": "1.3.9"
},
"bin": "./nodejs/bin/jsdoc",
"bugs": "https://github.com/jsdoc3/jsdoc/issues",
"author": {
"name": "Michael Mathews",

26
nodejs/bin/jsdoc Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env node
// This wrapper script allows JSDoc to be installed with 'npm install -g'.
// Note that JSDoc will still run on Mozilla Rhino, NOT Node.js.
var fs = require('fs');
var os = require('os');
var path = require('path');
var spawnProc = require('child_process').spawn;
var args = process.argv.slice(2);
var script = path.normalize( path.join( path.dirname(fs.realpathSync(process.argv[1])), '..', '..',
'jsdoc' ) );
var jsdoc;
if (process.platform === 'win32') {
jsdoc = spawnProc(script + '.cmd', args, {stdio: 'inherit'});
}
else {
jsdoc = spawnProc(script, args, {stdio: 'inherit'});
}
jsdoc.on('close', function(code) {
process.exit(code);
});

View File

@ -1,7 +1,7 @@
{
"name": "jsdoc",
"version": "3.2.0-dev",
"revision": "1365776112567",
"revision": "1366126973987",
"description": "An API documentation generator for JavaScript.",
"keywords": [ "documentation", "javascript" ],
"licenses": [
@ -28,6 +28,7 @@
"underscore": "1.4.2",
"wrench": "1.3.9"
},
"bin": "./nodejs/bin/jsdoc",
"bugs": "https://github.com/jsdoc3/jsdoc/issues",
"author": {
"name": "Michael Mathews",