From 0ed716bcd8a1132e5adc1417d8c0354a921ebae0 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Thu, 9 Jan 2020 22:28:39 +0800 Subject: [PATCH] fix: fix `afterInvoke`/`onCreateComplete` callbacks in Migrator closes #4837 --- packages/@vue/cli/lib/Migrator.js | 4 ++-- packages/@vue/cli/lib/Upgrader.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/@vue/cli/lib/Migrator.js b/packages/@vue/cli/lib/Migrator.js index 75877ae1fe..8bc1caf86c 100644 --- a/packages/@vue/cli/lib/Migrator.js +++ b/packages/@vue/cli/lib/Migrator.js @@ -6,14 +6,14 @@ module.exports = class Migrator extends Generator { plugin, pkg = {}, - completeCbs = [], + afterInvokeCbs = [], files = {}, invoking = false } = {}) { super(context, { pkg, plugins: [], - completeCbs, + afterInvokeCbs, files, invoking }) diff --git a/packages/@vue/cli/lib/Upgrader.js b/packages/@vue/cli/lib/Upgrader.js index f447344d2b..e449d37b40 100644 --- a/packages/@vue/cli/lib/Upgrader.js +++ b/packages/@vue/cli/lib/Upgrader.js @@ -118,13 +118,13 @@ module.exports = class Upgrader { installed: options.installed } - const createCompleteCbs = [] + const afterInvokeCbs = [] const migrator = new Migrator(this.context, { plugin: plugin, pkg: this.pkg, files: await readFiles(this.context), - completeCbs: createCompleteCbs, + afterInvokeCbs, invoking: true }) @@ -146,9 +146,9 @@ module.exports = class Upgrader { await this.pm.install() } - if (createCompleteCbs.length) { + if (afterInvokeCbs.length) { logWithSpinner('⚓', `Running completion hooks...`) - for (const cb of createCompleteCbs) { + for (const cb of afterInvokeCbs) { await cb() } stopSpinner()