-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpm.js
executable file
·28 lines (24 loc) · 869 Bytes
/
pm.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env node
/* global require: true */
// initialize the environment for Node.js
const path = require('path');
const isMain = require.main === module;
// Create a custom require method that adds `lib/jsdoc` and `node_modules` to the module
// lookup path. This makes it possible to `require('jsdoc/foo')` from external templates and
// plugins, and within JSDoc itself. It also allows external templates and plugins to
// require JSDoc's module dependencies without installing them locally.
require = require('requizzle')({
requirePaths: {
before: [path.join(__dirname, 'lib'), path.join(__dirname, 'lib/converters')],
after: [path.join(__dirname, 'node_modules')]
},
infect: true
});
if (isMain) {
require('./cli');
} else {
module.exports = function (options) {
const JsDoc = require('./index');
return new JsDoc(options).runCommand();
};
}