Skip to content

Commit

Permalink
chore: code review
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Nov 1, 2023
1 parent 72e2c41 commit ca475f5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/config/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class Plugin implements IPlugin {

commands!: Command.Loadable[]

commandsDir!: string | undefined
commandsDir: string | undefined

hasManifest = false

Expand Down Expand Up @@ -183,11 +183,14 @@ export class Plugin implements IPlugin {
this.commandsDir = await this.getCommandsDir()
this.commandIDs = await this.getCommandIDs()

this.hooks = {}
for (const [k, v] of Object.entries(this.pjson.oclif.hooks ?? {})) {
// eslint-disable-next-line no-await-in-loop
this.hooks[k] = await Promise.all(castArray(v).map(async (i) => tsPath(this.root, i, this)))
}
this.hooks = Object.fromEntries(
await Promise.all(
Object.entries(this.pjson.oclif.hooks ?? {}).map(async ([k, v]) => [
k,
await Promise.all(castArray(v).map(async (i) => tsPath(this.root, i, this))),
]),
),
)

this.manifest = await this._manifest()
this.commands = Object.entries(this.manifest.commands)
Expand Down

0 comments on commit ca475f5

Please sign in to comment.