feat: tracatch plugin build

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2020-03-21 15:48:45 +08:00
parent 926fc3b17a
commit 5549bdd804
2 changed files with 14 additions and 9 deletions

View File

@ -8,8 +8,8 @@
"scripts": { "scripts": {
"bs": "lerna bootstrap", "bs": "lerna bootstrap",
"clean": "lerna run clean", "clean": "lerna run clean",
"watch": "lerna run watch --parallel --scope=\"@ms/!(manager)\"", "watch": "lerna run watch --parallel",
"build": "lerna run build --scope=\"@ms/!(plugins|manager)\"", "build": "lerna run build --scope=\"@ms/!(plugins)\"",
"build:plugins": "lerna run build --scope=\"@ms/plugins\"", "build:plugins": "lerna run build --scope=\"@ms/plugins\"",
"ug": "yarn upgrade-interactive --latest", "ug": "yarn upgrade-interactive --latest",
"lp": "lerna publish" "lp": "lerna publish"

View File

@ -186,6 +186,7 @@ export class PluginManagerImpl implements plugin.PluginManager {
} }
private buildPlugin(metadata: interfaces.PluginMetadata) { private buildPlugin(metadata: interfaces.PluginMetadata) {
try {
this.bindPlugin(metadata) this.bindPlugin(metadata)
let pluginInstance = this.container.getNamed<interfaces.Plugin>(plugin.Plugin, metadata.name) let pluginInstance = this.container.getNamed<interfaces.Plugin>(plugin.Plugin, metadata.name)
if (!(pluginInstance instanceof interfaces.Plugin)) { if (!(pluginInstance instanceof interfaces.Plugin)) {
@ -193,7 +194,11 @@ export class PluginManagerImpl implements plugin.PluginManager {
return return
} }
this.pluginMap.set(metadata.name, pluginInstance) this.pluginMap.set(metadata.name, pluginInstance)
return pluginInstance return pluginInstance;
} catch (ex) {
console.i18n("ms.plugin.manager.initialize.error", { name: metadata.name, ex })
console.ex(ex)
}
} }
private bindPlugin(metadata: interfaces.PluginMetadata) { private bindPlugin(metadata: interfaces.PluginMetadata) {