diff --git a/packages/@vue/cli/lib/Creator.js b/packages/@vue/cli/lib/Creator.js index d502972517..1a6b7ef0c3 100644 --- a/packages/@vue/cli/lib/Creator.js +++ b/packages/@vue/cli/lib/Creator.js @@ -222,12 +222,8 @@ module.exports = class Creator extends EventEmitter { // run complete cbs if any (injected by generators) log(`⚓ Running completion hooks...`) this.emit('creation', { event: 'completion-hooks' }) - for (const cb of afterInvokeCbs) { - await cb() - } - for (const cb of afterAnyInvokeCbs) { - await cb() - } + await Promise.all(afterInvokeCbs.map((cb) => cb())) + await Promise.all(afterAnyInvokeCbs.map((cb) => cb())) if (!generator.files['README.md']) { // generate README.md diff --git a/packages/@vue/cli/lib/Generator.js b/packages/@vue/cli/lib/Generator.js index 9766a82295..e5924658a4 100644 --- a/packages/@vue/cli/lib/Generator.js +++ b/packages/@vue/cli/lib/Generator.js @@ -340,9 +340,7 @@ module.exports = class Generator { } }) - for (const postProcess of this.postProcessFilesCbs) { - await postProcess(files) - } + await Promise.all(this.postProcessFilesCbs.map((postProcess) => postProcess(files))) debug('vue:cli-files')(this.files) } diff --git a/packages/@vue/cli/lib/invoke.js b/packages/@vue/cli/lib/invoke.js index ad82e7df26..9f377d27a6 100644 --- a/packages/@vue/cli/lib/invoke.js +++ b/packages/@vue/cli/lib/invoke.js @@ -128,12 +128,8 @@ async function runGenerator (context, plugin, pkg = getPkg(context)) { if (afterInvokeCbs.length || afterAnyInvokeCbs.length) { logWithSpinner('⚓', `Running completion hooks...`) - for (const cb of afterInvokeCbs) { - await cb() - } - for (const cb of afterAnyInvokeCbs) { - await cb() - } + await Promise.all(afterInvokeCbs.map((cb) => cb())) + await Promise.all(afterAnyInvokeCbs.map((cb) => cb())) stopSpinner() log() }