From 8e8f6a84eae8297804f7bbbf0f8be30620135e27 Mon Sep 17 00:00:00 2001 From: Emily Xiong Date: Sun, 10 Nov 2024 17:35:30 -0500 Subject: [PATCH] fix(core): Remove warning when Nx is not installed globally --- .../create-nx-plugin/bin/create-nx-plugin.ts | 3 --- .../bin/create-nx-workspace.ts | 3 --- .../src/utils/nx/show-nx-warning.ts | 26 ------------------- 3 files changed, 32 deletions(-) delete mode 100644 packages/create-nx-workspace/src/utils/nx/show-nx-warning.ts diff --git a/packages/create-nx-plugin/bin/create-nx-plugin.ts b/packages/create-nx-plugin/bin/create-nx-plugin.ts index 4b7be79b8cac0..006a807f595bd 100644 --- a/packages/create-nx-plugin/bin/create-nx-plugin.ts +++ b/packages/create-nx-plugin/bin/create-nx-plugin.ts @@ -19,7 +19,6 @@ import { createWorkspace, CreateWorkspaceOptions } from 'create-nx-workspace'; import { output } from 'create-nx-workspace/src/utils/output'; import { NxCloud } from 'create-nx-workspace/src/utils/nx/nx-cloud'; import type { PackageManager } from 'create-nx-workspace/src/utils/package-manager'; -import { showNxWarning } from 'create-nx-workspace/src/utils/nx/show-nx-warning'; import { messages, recordStat, @@ -150,8 +149,6 @@ async function main(parsedArgs: yargs.Arguments) { populatedArguments ); - showNxWarning(parsedArgs.pluginName); - await recordStat({ nxVersion, command: 'create-nx-workspace', diff --git a/packages/create-nx-workspace/bin/create-nx-workspace.ts b/packages/create-nx-workspace/bin/create-nx-workspace.ts index 44487ddf21b56..8a25b98a627af 100644 --- a/packages/create-nx-workspace/bin/create-nx-workspace.ts +++ b/packages/create-nx-workspace/bin/create-nx-workspace.ts @@ -25,7 +25,6 @@ import { withOptions, withPackageManager, } from '../src/internal-utils/yargs-options'; -import { showNxWarning } from '../src/utils/nx/show-nx-warning'; import { messages, recordStat } from '../src/utils/nx/ab-testing'; import { mapErrorToBodyLines } from '../src/utils/error-utils'; import { existsSync } from 'fs'; @@ -223,8 +222,6 @@ async function main(parsedArgs: yargs.Arguments) { parsedArgs ); - showNxWarning(parsedArgs.name); - await recordStat({ nxVersion, command: 'create-nx-workspace', diff --git a/packages/create-nx-workspace/src/utils/nx/show-nx-warning.ts b/packages/create-nx-workspace/src/utils/nx/show-nx-warning.ts deleted file mode 100644 index 0ed7295d9bba5..0000000000000 --- a/packages/create-nx-workspace/src/utils/nx/show-nx-warning.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { execSync } from 'child_process'; -import { resolve } from 'path'; -import { output } from '../output'; -import { getPackageManagerCommand } from '../package-manager'; - -export function showNxWarning(workspaceName: string) { - try { - const pathToRunNxCommand = resolve(process.cwd(), workspaceName); - execSync('nx --version', { - cwd: pathToRunNxCommand, - stdio: ['ignore', 'ignore', 'ignore'], - windowsHide: false, - }); - } catch (e) { - // no nx found - const { exec, globalAdd } = getPackageManagerCommand(); - output.addVerticalSeparator(); - output.note({ - title: `Nx CLI is not installed globally.`, - bodyLines: [ - `This means that you will have to use "${exec} nx" to execute commands in the workspace.`, - `Run "${globalAdd} nx" to be able to execute command directly.`, - ], - }); - } -}