From d7c50bd78833485bd9d6174d0a4f9458666559b9 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Thu, 14 Sep 2023 16:02:29 -0600 Subject: [PATCH] fix: remove install jit plugins from list --- src/commands/plugins/index.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/commands/plugins/index.ts b/src/commands/plugins/index.ts index 4aee2918..2d75ac18 100644 --- a/src/commands/plugins/index.ts +++ b/src/commands/plugins/index.ts @@ -4,7 +4,7 @@ import {Command, Flags, Interfaces, Plugin, ux} from '@oclif/core' import Plugins from '../../plugins' import {sortBy} from '../../util' -type JitPlugin = {name: string; version: string; type: 'jit'} +type JitPlugin = {name: string; version: string; type: string} type PluginsJson = Array export default class PluginsIndex extends Command { @@ -32,9 +32,14 @@ export default class PluginsIndex extends Command { return [] } + const results = this.config.getPluginsList() + const userAndLinkedPlugins = new Set(results.filter(p => p.type === 'user' || p.type === 'link').map(p => p.name)) const jitPluginsConfig = this.config.pjson.oclif.jitPlugins ?? {} - const jitPlugins: JitPlugin[] = Object.entries(jitPluginsConfig).map(([name, version]) => ({name: this.plugins.friendlyName(name), version, type: 'jit'})) + const jitPlugins: JitPlugin[] = Object.entries(jitPluginsConfig) + .map(([name, version]) => ({name, version, type: 'jit'})) + .filter(p => !userAndLinkedPlugins.has(p.name)) + sortBy(jitPlugins, p => p.name) if (!this.jsonEnabled()) { @@ -42,8 +47,6 @@ export default class PluginsIndex extends Command { this.displayJitPlugins(jitPlugins) } - const results = this.config.getPluginsList() - return [...results, ...jitPlugins] } @@ -61,7 +64,7 @@ export default class PluginsIndex extends Command { if (jitPlugins.length === 0) return this.log(chalk.dim('\nUninstalled JIT Plugins:')) for (const {name, version} of jitPlugins) { - this.log(`${name} ${chalk.dim(version)}`) + this.log(`${this.plugins.friendlyName(name)} ${chalk.dim(version)}`) } }