Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
fix: loading plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Apr 21, 2018
1 parent 7ba0ed9 commit 9082eb0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,9 @@ export class Config implements IConfig {
constructor(public options: Options) {}

async load() {
await this.loadPlugins(this.options.root, 'core', [{root: this.options.root}], {must: true})
const plugin = this.plugins[0]
const plugin = new Plugin.Plugin({root: this.options.root})
await plugin.load()
this.plugins.push(plugin)
this.root = plugin.root
this.pjson = plugin.pjson
this.name = this.pjson.name
Expand Down Expand Up @@ -412,7 +413,7 @@ export class Config implements IConfig {
} catch {}
return 0
}
protected async loadPlugins(root: string, type: string, plugins: (string | {root?: string, name?: string, tag?: string})[], options: {must?: boolean} = {}) {
protected async loadPlugins(root: string, type: string, plugins: (string | {root?: string, name?: string, tag?: string})[]) {
if (!plugins || !plugins.length) return
debug('loading plugins', plugins)
await Promise.all((plugins || []).map(async plugin => {
Expand All @@ -431,7 +432,6 @@ export class Config implements IConfig {
this.plugins.push(instance)
await this.loadPlugins(instance.root, type, instance.pjson.oclif.plugins || [])
} catch (err) {
if (options.must) throw err
this.warn(err, 'loadPlugins')
}
}))
Expand Down

0 comments on commit 9082eb0

Please sign in to comment.