From aa9169b043875b0a2ca0c07cecb22f0a0cbb4393 Mon Sep 17 00:00:00 2001 From: MiaoWoo Date: Sat, 21 Mar 2020 15:48:45 +0800 Subject: [PATCH] feat: tracatch plugin build Signed-off-by: MiaoWoo --- package.json | 4 ++-- packages/plugin/src/manager.ts | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 7da550a6..a243f7ff 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "scripts": { "bs": "lerna bootstrap", "clean": "lerna run clean", - "watch": "lerna run watch --parallel --scope=\"@ms/!(manager)\"", - "build": "lerna run build --scope=\"@ms/!(plugins|manager)\"", + "watch": "lerna run watch --parallel", + "build": "lerna run build --scope=\"@ms/!(plugins)\"", "build:plugins": "lerna run build --scope=\"@ms/plugins\"", "ug": "yarn upgrade-interactive --latest", "lp": "lerna publish" diff --git a/packages/plugin/src/manager.ts b/packages/plugin/src/manager.ts index c433a7a1..c0de47f2 100644 --- a/packages/plugin/src/manager.ts +++ b/packages/plugin/src/manager.ts @@ -186,14 +186,19 @@ export class PluginManagerImpl implements plugin.PluginManager { } private buildPlugin(metadata: interfaces.PluginMetadata) { - this.bindPlugin(metadata) - let pluginInstance = this.container.getNamed(plugin.Plugin, metadata.name) - if (!(pluginInstance instanceof interfaces.Plugin)) { - console.i18n('ms.plugin.manager.build.not.extends', { source: metadata.source }) - return + try { + this.bindPlugin(metadata) + let pluginInstance = this.container.getNamed(plugin.Plugin, metadata.name) + if (!(pluginInstance instanceof interfaces.Plugin)) { + console.i18n('ms.plugin.manager.build.not.extends', { source: metadata.source }) + return + } + this.pluginMap.set(metadata.name, pluginInstance) + return pluginInstance; + } catch (ex) { + console.i18n("ms.plugin.manager.initialize.error", { name: metadata.name, ex }) + console.ex(ex) } - this.pluginMap.set(metadata.name, pluginInstance) - return pluginInstance } private bindPlugin(metadata: interfaces.PluginMetadata) {