diff --git a/src/config/config.ts b/src/config/config.ts index 601f09d82..29398180d 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -332,7 +332,7 @@ export class Config implements IConfig { this.npmRegistry = this.scopedEnvVar('NPM_REGISTRY') || this.pjson.oclif.npmRegistry if (!this.scopedEnvVarTrue('DISABLE_THEME')) { - const {theme} = await this.loadThemes() + const {theme} = await this.loadTheme() this.theme = theme } @@ -401,16 +401,17 @@ export class Config implements IConfig { } } - public async loadThemes(): Promise<{ + public async loadTheme(): Promise<{ file: string theme: Theme | undefined }> { - const file = resolve(this.configDir, 'theme.json') - const themes = await safeReadJson>(file) - const theme = themes ? parseTheme(themes) : undefined + const file = this.pjson.oclif.theme + ? resolve(this.root, this.pjson.oclif.theme) + : resolve(this.configDir, 'theme.json') + const themeRaw = await safeReadJson>(file) return { file, - theme, + theme: themeRaw ? parseTheme(themeRaw) : undefined, } } diff --git a/src/interfaces/pjson.ts b/src/interfaces/pjson.ts index 1381bd6f9..4fa6bc002 100644 --- a/src/interfaces/pjson.ts +++ b/src/interfaces/pjson.ts @@ -43,15 +43,11 @@ export namespace PJSON { identifier?: string sign?: string } - windows?: { - homepage?: string - keypath?: string - name?: string - } plugins?: string[] repositoryPrefix?: string schema?: number state?: 'beta' | 'deprecated' | string + theme?: string topicSeparator?: ' ' | ':' topics?: { [k: string]: { @@ -72,6 +68,11 @@ export namespace PJSON { } s3: S3 } + windows?: { + homepage?: string + keypath?: string + name?: string + } } version: string }