mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
fix(jsdoc): wait for async templates to finish before existing
Previously, we could exit before the template finished running, making it impossible to build a truly async template.
This commit is contained in:
parent
65406e6d94
commit
58726cb9da
@ -145,7 +145,7 @@ module.exports = (() => {
|
||||
};
|
||||
|
||||
// TODO: docs
|
||||
cli.runCommand = cb => {
|
||||
cli.runCommand = () => {
|
||||
let cmd;
|
||||
const opts = env.opts;
|
||||
|
||||
@ -166,11 +166,13 @@ module.exports = (() => {
|
||||
cmd = cli.main;
|
||||
}
|
||||
|
||||
cmd().then(errorCode => {
|
||||
return cmd().then(errorCode => {
|
||||
if (!errorCode && props.shouldExitWithError) {
|
||||
errorCode = 1;
|
||||
}
|
||||
cb(errorCode);
|
||||
|
||||
cli.logFinish();
|
||||
cli.exit(errorCode || 0);
|
||||
});
|
||||
};
|
||||
|
||||
@ -385,6 +387,7 @@ module.exports = (() => {
|
||||
};
|
||||
|
||||
cli.generateDocs = () => {
|
||||
let message;
|
||||
const path = require('jsdoc/path');
|
||||
const resolver = require('jsdoc/tutorial/resolver');
|
||||
const taffy = require('taffydb').taffy;
|
||||
@ -421,13 +424,12 @@ module.exports = (() => {
|
||||
return Promise.resolve(publishPromise);
|
||||
}
|
||||
else {
|
||||
logger.fatal(
|
||||
`${env.opts.template} does not export a "publish" function. ` +
|
||||
'Global "publish" functions are no longer supported.'
|
||||
);
|
||||
}
|
||||
message = `${env.opts.template} does not export a "publish" function. ` +
|
||||
'Global "publish" functions are no longer supported.';
|
||||
logger.fatal(message);
|
||||
|
||||
return Promise.resolve();
|
||||
return Promise.reject(new Error(message));
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: docs
|
||||
|
||||
@ -45,18 +45,13 @@
|
||||
*/
|
||||
global.env = (() => require('./lib/jsdoc/env'))();
|
||||
|
||||
(() => {
|
||||
(async () => {
|
||||
const cli = require('./cli');
|
||||
|
||||
function cb(errorCode) {
|
||||
cli.logFinish();
|
||||
cli.exit(errorCode || 0);
|
||||
}
|
||||
|
||||
cli.setVersionInfo()
|
||||
.loadConfig()
|
||||
.configureLogger()
|
||||
.logStart();
|
||||
|
||||
cli.runCommand(cb);
|
||||
await cli.runCommand();
|
||||
})();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user