From 5f05f5a83ae4f42aae29b8de09d23ed78cd9721b Mon Sep 17 00:00:00 2001 From: AgentEnder Date: Mon, 1 May 2023 11:16:42 -0400 Subject: [PATCH] feat(misc): list should link to nx.dev/community for more plugins --- packages/nx/src/command-line/list.ts | 20 ++++++++--------- .../nx/src/utils/plugins/community-plugins.ts | 22 +------------------ packages/nx/src/utils/plugins/index.ts | 5 +---- 3 files changed, 11 insertions(+), 36 deletions(-) diff --git a/packages/nx/src/command-line/list.ts b/packages/nx/src/command-line/list.ts index de4513a1e4c25..033870eb85805 100644 --- a/packages/nx/src/command-line/list.ts +++ b/packages/nx/src/command-line/list.ts @@ -1,10 +1,8 @@ import { workspaceRoot } from '../utils/workspace-root'; import { output } from '../utils/output'; import { - fetchCommunityPlugins, fetchCorePlugins, getInstalledPluginsAndCapabilities, - listCommunityPlugins, listCorePlugins, listInstalledPlugins, listPluginCapabilities, @@ -36,14 +34,6 @@ export async function listHandler(args: ListArgs): Promise { await listPluginCapabilities(args.plugin); } else { const corePlugins = fetchCorePlugins(); - const communityPlugins = await fetchCommunityPlugins().catch(() => { - output.warn({ - title: `Community plugins:`, - bodyLines: [`Error fetching plugins.`], - }); - - return []; - }); const projectGraph = await createProjectGraphAsync({ exitOnError: true }); const localPlugins = await getLocalWorkspacePlugins( @@ -58,7 +48,15 @@ export async function listHandler(args: ListArgs): Promise { } listInstalledPlugins(installedPlugins); listCorePlugins(installedPlugins, corePlugins); - listCommunityPlugins(installedPlugins, communityPlugins); + + output.note({ + title: 'Community Plugins', + bodyLines: [ + 'Looking for a technology / framework not listed above?', + 'There are many excellent plugins matintained by the Nx community.', + 'Search for the one you need here: https://nx.dev/community.', + ], + }); output.note({ title: `Use "nx list [plugin]" to find out more`, diff --git a/packages/nx/src/utils/plugins/community-plugins.ts b/packages/nx/src/utils/plugins/community-plugins.ts index dd8f84c66f17d..cb45b448a1178 100644 --- a/packages/nx/src/utils/plugins/community-plugins.ts +++ b/packages/nx/src/utils/plugins/community-plugins.ts @@ -1,7 +1,5 @@ import { get } from 'https'; -import * as chalk from 'chalk'; -import { output } from '../output'; -import type { CommunityPlugin, PluginCapabilities } from './models'; +import type { CommunityPlugin } from './models'; const COMMUNITY_PLUGINS_JSON_URL = 'https://raw.githubusercontent.com/nrwl/nx/master/community/approved-plugins.json'; @@ -30,21 +28,3 @@ export async function fetchCommunityPlugins(): Promise { req.end(); }); } - -export function listCommunityPlugins( - installedPlugins: Map, - communityPlugins?: CommunityPlugin[] -): void { - if (!communityPlugins) return; - - const availableCommunityPlugins = communityPlugins.filter( - (p) => !installedPlugins.has(p.name) - ); - - output.log({ - title: `Community plugins:`, - bodyLines: availableCommunityPlugins.map((p) => { - return `${chalk.bold(p.name)} - ${p.description}`; - }), - }); -} diff --git a/packages/nx/src/utils/plugins/index.ts b/packages/nx/src/utils/plugins/index.ts index 5ff8fa7243bf4..da889a1a69059 100644 --- a/packages/nx/src/utils/plugins/index.ts +++ b/packages/nx/src/utils/plugins/index.ts @@ -1,7 +1,4 @@ -export { - fetchCommunityPlugins, - listCommunityPlugins, -} from './community-plugins'; +export { fetchCommunityPlugins } from './community-plugins'; export { fetchCorePlugins, listCorePlugins } from './core-plugins'; export { getInstalledPluginsAndCapabilities,