Skip to content

Commit 08476db

Browse files
AgentEnderFrozenPandaz
authored andcommitted
Revert "fix(core): add warning if running on an outdated global insta… (#15442)
(cherry picked from commit 1eee5f0)
1 parent e34e73f commit 08476db

File tree

5 files changed

+1
-227
lines changed

5 files changed

+1
-227
lines changed

docs/generated/manifests/menus.json

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,14 +1153,6 @@
11531153
"isExternal": false,
11541154
"children": [],
11551155
"disableCollapsible": false
1156-
},
1157-
{
1158-
"name": "Managing your Global Nx Installation",
1159-
"path": "/more-concepts/global-nx",
1160-
"id": "global-nx",
1161-
"isExternal": false,
1162-
"children": [],
1163-
"disableCollapsible": false
11641156
}
11651157
],
11661158
"disableCollapsible": false
@@ -1325,14 +1317,6 @@
13251317
"children": [],
13261318
"disableCollapsible": false
13271319
},
1328-
{
1329-
"name": "Managing your Global Nx Installation",
1330-
"path": "/more-concepts/global-nx",
1331-
"id": "global-nx",
1332-
"isExternal": false,
1333-
"children": [],
1334-
"disableCollapsible": false
1335-
},
13361320
{
13371321
"name": "All Recipes »",
13381322
"path": "/recipes",

docs/generated/manifests/nx.json

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,16 +1434,6 @@
14341434
"isExternal": false,
14351435
"path": "/more-concepts/encapsulated-nx-and-the-wrapper",
14361436
"tags": []
1437-
},
1438-
{
1439-
"id": "global-nx",
1440-
"name": "Managing your Global Nx Installation",
1441-
"description": "",
1442-
"file": "shared/guides/global-nx",
1443-
"itemList": [],
1444-
"isExternal": false,
1445-
"path": "/more-concepts/global-nx",
1446-
"tags": []
14471437
}
14481438
],
14491439
"isExternal": false,
@@ -1650,16 +1640,6 @@
16501640
"path": "/more-concepts/encapsulated-nx-and-the-wrapper",
16511641
"tags": []
16521642
},
1653-
"/more-concepts/global-nx": {
1654-
"id": "global-nx",
1655-
"name": "Managing your Global Nx Installation",
1656-
"description": "",
1657-
"file": "shared/guides/global-nx",
1658-
"itemList": [],
1659-
"isExternal": false,
1660-
"path": "/more-concepts/global-nx",
1661-
"tags": []
1662-
},
16631643
"/recipes": {
16641644
"id": "all",
16651645
"name": "All Recipes »",

docs/map.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -489,11 +489,6 @@
489489
"name": "Encapsulated Nx and the Nx Wrapper",
490490
"id": "encapsulated-nx-and-the-wrapper",
491491
"file": "shared/guides/encapsulated-nx-and-the-wrapper"
492-
},
493-
{
494-
"name": "Managing your Global Nx Installation",
495-
"id": "global-nx",
496-
"file": "shared/guides/global-nx"
497492
}
498493
]
499494
},

docs/shared/guides/global-nx.md

Lines changed: 0 additions & 122 deletions
This file was deleted.

packages/nx/bin/nx.ts

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ import {
66
import * as chalk from 'chalk';
77
import { initLocal } from './init-local';
88
import { output } from '../src/utils/output';
9-
import {
10-
getNxInstallationPath,
11-
getNxRequirePaths,
12-
} from '../src/utils/installation-directory';
13-
import { major } from 'semver';
14-
import { readJsonFile } from '../src/utils/fileutils';
15-
import { execSync } from 'child_process';
9+
import { getNxInstallationPath } from 'nx/src/utils/installation-directory';
1610

1711
const workspace = findWorkspaceRoot(process.cwd());
1812
// new is a special case because there is no local workspace to load
@@ -59,8 +53,6 @@ if (
5953
try {
6054
localNx = resolveNx(workspace);
6155
} catch {
62-
// If we can't resolve a local copy of Nx, we must be global.
63-
warnIfUsingOutdatedGlobalInstall();
6456
output.error({
6557
title: `Could not find Nx modules in this workspace.`,
6658
bodyLines: [`Have you run ${chalk.bold.white(`npm/yarn install`)}?`],
@@ -77,7 +69,6 @@ if (
7769
initLocal(workspace);
7870
} else {
7971
// Nx is being run from globally installed CLI - hand off to the local
80-
warnIfUsingOutdatedGlobalInstall(getLocalNxVersion(workspace));
8172
require(localNx);
8273
}
8374
}
@@ -102,57 +93,3 @@ function resolveNx(workspace: WorkspaceTypeAndRoot | null) {
10293
});
10394
}
10495
}
105-
106-
/**
107-
* Assumes currently running Nx is global install.
108-
* Warns if out of date by 1 major version or more.
109-
*/
110-
function warnIfUsingOutdatedGlobalInstall(localNxVersion?: string) {
111-
const globalVersion = require('../package.json').version;
112-
const isOutdatedGlobalInstall =
113-
globalVersion &&
114-
((localNxVersion && major(globalVersion) < major(localNxVersion)) ||
115-
(getLatestVersionOfNx() &&
116-
major(globalVersion) < major(getLatestVersionOfNx())));
117-
118-
// Using a global Nx Install
119-
if (isOutdatedGlobalInstall) {
120-
const bodyLines = localNxVersion
121-
? ['Its time to update Nx 🎉']
122-
: [
123-
'Its possible that this is causing Nx to not pick up your workspace properly.',
124-
];
125-
126-
bodyLines.push(
127-
'For more information, see https://nx.dev/more-concepts/global-nx'
128-
);
129-
output.warn({
130-
title: `Its time to update Nx 🎉`,
131-
bodyLines,
132-
});
133-
}
134-
}
135-
136-
function getLocalNxVersion(workspace: WorkspaceTypeAndRoot): string {
137-
return readJsonFile(
138-
require.resolve('nx/package.json', {
139-
paths: getNxRequirePaths(workspace.dir),
140-
})
141-
).version;
142-
}
143-
144-
let _latest = null;
145-
function getLatestVersionOfNx(): string {
146-
if (!_latest) {
147-
try {
148-
_latest = execSync('npm view nx@latest version').toString().trim();
149-
} catch {
150-
try {
151-
_latest = execSync('pnpm view nx@latest version').toString().trim();
152-
} catch {
153-
_latest = null;
154-
}
155-
}
156-
}
157-
return _latest;
158-
}

0 commit comments

Comments
 (0)