Skip to content

Commit

Permalink
feat: run tsPath on hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Oct 25, 2023
1 parent b90e9de commit 8275a2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ export class Config implements IConfig {
const marker = Performance.mark(OCLIF_MARKER_OWNER, `config.runHook#${p.name}(${hook})`)
try {
/* eslint-disable no-await-in-loop */
const {filePath, isESM, module} = await loadWithData(p, join(p.root, hook))
const {filePath, isESM, module} = await loadWithData(p, hook)
debug('start', isESM ? '(import)' : '(require)', filePath)

const result = timeout
Expand Down
4 changes: 2 additions & 2 deletions src/config/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {OCLIF_MARKER_OWNER, Performance} from '../performance'
import {cacheCommand} from '../util/cache-command'
import {findRoot} from '../util/find-root'
import {readJson, requireJson} from '../util/fs'
import {compact, isProd, mapValues} from '../util/util'
import {castArray, compact, isProd, mapValues} from '../util/util'
import {tsPath} from './ts-node'
import {Debug, getCommandIdPermutations} from './util'

Expand Down Expand Up @@ -192,7 +192,7 @@ export class Plugin implements IPlugin {
this.pjson.oclif = this.pjson['cli-engine'] || {}
}

this.hooks = mapValues(this.pjson.oclif.hooks || {}, (i) => (Array.isArray(i) ? i : [i]))
this.hooks = mapValues(this.pjson.oclif.hooks ?? {}, (i) => castArray(i).map((i) => tsPath(this.root, i, this)))

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

0 comments on commit 8275a2e

Please sign in to comment.