Skip to content

Commit

Permalink
fix(misc): do not check against the global version on npm
Browse files Browse the repository at this point in the history
  • Loading branch information
vsavkin committed May 31, 2023
1 parent b0732e1 commit 7154c87
Show file tree
Hide file tree
Showing 3 changed files with 209 additions and 219 deletions.
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@
"@ngrx/router-store": "~16.0.0",
"@ngrx/store": "~16.0.0",
"@nguniversal/builders": "~16.0.0",
"@nx/cypress": "16.3.0-beta.11",
"@nx/devkit": "16.3.0-beta.11",
"@nx/eslint-plugin": "16.3.0-beta.11",
"@nx/jest": "16.3.0-beta.11",
"@nx/js": "16.3.0-beta.11",
"@nx/linter": "16.3.0-beta.11",
"@nx/next": "16.3.0-beta.11",
"@nx/react": "16.3.0-beta.11",
"@nx/storybook": "16.3.0-beta.11",
"@nx/web": "16.3.0-beta.11",
"@nx/webpack": "16.3.0-beta.11",
"@nx/cypress": "16.3.0-beta.14",
"@nx/devkit": "16.3.0-beta.14",
"@nx/eslint-plugin": "16.3.0-beta.14",
"@nx/jest": "16.3.0-beta.14",
"@nx/js": "16.3.0-beta.14",
"@nx/linter": "16.3.0-beta.14",
"@nx/next": "16.3.0-beta.14",
"@nx/react": "16.3.0-beta.14",
"@nx/storybook": "16.3.0-beta.14",
"@nx/web": "16.3.0-beta.14",
"@nx/webpack": "16.3.0-beta.14",
"@parcel/watcher": "2.0.4",
"@phenomnomnominal/tsquery": "~5.0.1",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
Expand Down Expand Up @@ -212,7 +212,7 @@
"next-sitemap": "^3.1.10",
"ng-packagr": "~16.0.0",
"node-fetch": "^2.6.7",
"nx": "16.3.0-beta.11",
"nx": "16.3.0-beta.14",
"nx-cloud": "16.0.5",
"octokit": "^2.0.14",
"open": "^8.4.0",
Expand Down Expand Up @@ -337,7 +337,7 @@
"resolutions": {
"minimist": "^1.2.6",
"underscore": "^1.12.1",
"nx": "16.3.0-beta.11"
"nx": "16.3.0-beta.14"
},
"nx": {
"includedScripts": [
Expand Down
24 changes: 2 additions & 22 deletions packages/nx/bin/nx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
import { major } from 'semver';
import { stripIndents } from '../src/utils/strip-indents';
import { readModulePackageJson } from '../src/utils/package-json';
import { execSync } from 'child_process';
import { join } from 'path';

function main() {
Expand Down Expand Up @@ -171,10 +170,8 @@ function warnIfUsingOutdatedGlobalInstall(

const isOutdatedGlobalInstall =
globalNxVersion &&
((localNxVersion && major(globalNxVersion) < major(localNxVersion)) ||
(!localNxVersion &&
getLatestVersionOfNx() &&
major(globalNxVersion) < major(getLatestVersionOfNx())));
localNxVersion &&
major(globalNxVersion) < major(localNxVersion);

// Using a global Nx Install
if (isOutdatedGlobalInstall) {
Expand Down Expand Up @@ -204,21 +201,4 @@ function getLocalNxVersion(workspace: WorkspaceTypeAndRoot): string | null {
} catch {}
}

function _getLatestVersionOfNx(): string {
try {
return execSync('npm view nx@latest version').toString().trim();
} catch {
try {
return execSync('pnpm view nx@latest version').toString().trim();
} catch {
return null;
}
}
}

const getLatestVersionOfNx = ((fn: () => string) => {
let cache: string = null;
return () => cache || (cache = fn());
})(_getLatestVersionOfNx);

main();
Loading

1 comment on commit 7154c87

@vercel
Copy link

@vercel vercel bot commented on 7154c87 May 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx-five.vercel.app
nx.dev

Please sign in to comment.