Skip to content

Commit

Permalink
Add: key arg for readConfig()
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Feb 2, 2023
1 parent d310bed commit c2fcf7a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/techor/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class Techor<Options extends TechorOptions<Config>, Config> {
this.options = extend(defaultOptions, ...options) as Options
}

readConfig(): Config {
readConfig(key = 'config'): Config | any {
const { config, cwd } = this.options
if (typeof config === 'object') {
return config as Config
Expand All @@ -23,7 +23,7 @@ export default class Techor<Options extends TechorOptions<Config>, Config> {
const configPath = this.configPath
if (configPath) {
const userConfigModule = crossImport(configPath, { cwd })
userConfig = userConfigModule.config || userConfigModule.default || userConfigModule
userConfig = (key ? userConfigModule[key] : undefined) || userConfigModule.default || userConfigModule
log.ok`Import **${configPath}** config`
} else if (config) {
log.x`Cannot find -${config}- config`
Expand Down

0 comments on commit c2fcf7a

Please sign in to comment.