Allow main method to be called from elsewhere
This commit is contained in:
@@ -145,15 +145,27 @@ function writeSymbols(symbols, output, callback) {
|
|||||||
/**
|
/**
|
||||||
* Determine which source files have been changed, run JSDoc against those,
|
* Determine which source files have been changed, run JSDoc against those,
|
||||||
* write out exported symbols, and clean up the build dir.
|
* write out exported symbols, and clean up the build dir.
|
||||||
|
*
|
||||||
|
* @param {function(Error)} callback Called when the symbols file has been
|
||||||
|
* written (or if an error occurs).
|
||||||
*/
|
*/
|
||||||
async.waterfall([
|
exports.main = function(callback) {
|
||||||
readSymbols,
|
async.waterfall([
|
||||||
getNewer,
|
readSymbols,
|
||||||
spawnJSDoc,
|
getNewer,
|
||||||
writeSymbols
|
spawnJSDoc,
|
||||||
], function(err) {
|
writeSymbols
|
||||||
if (err) {
|
], callback);
|
||||||
console.error(err.message);
|
};
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
});
|
if (require.main === module) {
|
||||||
|
exports.main(function(err) {
|
||||||
|
if (err) {
|
||||||
|
console.error(err.message);
|
||||||
|
process.exit(1);
|
||||||
|
} else {
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user