Skip to content

Commit

Permalink
fix(v2): load plugin commands asynchronously
Browse files Browse the repository at this point in the history
https://github.com/facebook/docusaurus/blame/master/packages/docusaurus/src/commands/external.ts#L12 changed the exported method to an async function, but the CLI loader was not updated to also run async, breaking things such as `npm run docusaurus docs:version <version>`.
  • Loading branch information
aeneasr authored Dec 3, 2020
1 parent f37987f commit 14890ae
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/docusaurus/bin/docusaurus.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,16 @@ function isInternalCommand(command) {
].includes(command);
}

if (!isInternalCommand(process.argv.slice(2)[0])) {
externalCommand(cli, path.resolve('.'));
}
async function run() {
if (!isInternalCommand(process.argv.slice(2)[0])) {
await externalCommand(cli, path.resolve('.'));
}

cli.parse(process.argv);
cli.parse(process.argv);

if (!process.argv.slice(2).length) {
cli.outputHelp();
if (!process.argv.slice(2).length) {
cli.outputHelp();
}
}

run()

0 comments on commit 14890ae

Please sign in to comment.