Skip to content

Commit

Permalink
fix(core): don't show global version warning when Nx is invoked by it…
Browse files Browse the repository at this point in the history
…self (#16102)

(cherry picked from commit 2887596)
  • Loading branch information
AgentEnder authored and FrozenPandaz committed Apr 11, 2023
1 parent 0867dba commit c46f81b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/nx/bin/init-local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import { stripIndents } from '../src/utils/strip-indents';
*
* @param workspace Relevant local workspace properties
*/
process.env.NX_CLI_SET = 'true';

export function initLocal(workspace: WorkspaceTypeAndRoot) {
process.env.NX_CLI_SET = 'true';

try {
performance.mark('init-local');
require('nx/src/utils/perf-logging');
Expand Down
5 changes: 5 additions & 0 deletions packages/nx/bin/nx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ function warnIfUsingOutdatedGlobalInstall(
globalNxVersion: string,
localNxVersion?: string
) {
// Never display this warning if Nx is already running via Nx
if (process.env.NX_CLI_SET) {
return;
}

const isOutdatedGlobalInstall =
globalNxVersion &&
((localNxVersion && major(globalNxVersion) < major(localNxVersion)) ||
Expand Down

0 comments on commit c46f81b

Please sign in to comment.