nx 19.4.0-rc.1 → 19.4.0
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "19.4.0
|
3
|
+
"version": "19.4.0",
|
4
4
|
"private": false,
|
5
5
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
6
6
|
"repository": {
|
@@ -70,7 +70,7 @@
|
|
70
70
|
"yargs-parser": "21.1.1",
|
71
71
|
"node-machine-id": "1.1.12",
|
72
72
|
"ora": "5.3.0",
|
73
|
-
"@nrwl/tao": "19.4.0
|
73
|
+
"@nrwl/tao": "19.4.0"
|
74
74
|
},
|
75
75
|
"peerDependencies": {
|
76
76
|
"@swc-node/register": "^1.8.0",
|
@@ -85,16 +85,16 @@
|
|
85
85
|
}
|
86
86
|
},
|
87
87
|
"optionalDependencies": {
|
88
|
-
"@nx/nx-darwin-x64": "19.4.0
|
89
|
-
"@nx/nx-darwin-arm64": "19.4.0
|
90
|
-
"@nx/nx-linux-x64-gnu": "19.4.0
|
91
|
-
"@nx/nx-linux-x64-musl": "19.4.0
|
92
|
-
"@nx/nx-win32-x64-msvc": "19.4.0
|
93
|
-
"@nx/nx-linux-arm64-gnu": "19.4.0
|
94
|
-
"@nx/nx-linux-arm64-musl": "19.4.0
|
95
|
-
"@nx/nx-linux-arm-gnueabihf": "19.4.0
|
96
|
-
"@nx/nx-win32-arm64-msvc": "19.4.0
|
97
|
-
"@nx/nx-freebsd-x64": "19.4.0
|
88
|
+
"@nx/nx-darwin-x64": "19.4.0",
|
89
|
+
"@nx/nx-darwin-arm64": "19.4.0",
|
90
|
+
"@nx/nx-linux-x64-gnu": "19.4.0",
|
91
|
+
"@nx/nx-linux-x64-musl": "19.4.0",
|
92
|
+
"@nx/nx-win32-x64-msvc": "19.4.0",
|
93
|
+
"@nx/nx-linux-arm64-gnu": "19.4.0",
|
94
|
+
"@nx/nx-linux-arm64-musl": "19.4.0",
|
95
|
+
"@nx/nx-linux-arm-gnueabihf": "19.4.0",
|
96
|
+
"@nx/nx-win32-arm64-msvc": "19.4.0",
|
97
|
+
"@nx/nx-freebsd-x64": "19.4.0"
|
98
98
|
},
|
99
99
|
"nx-migrations": {
|
100
100
|
"migrations": "./migrations.json",
|
@@ -1,2 +1,8 @@
|
|
1
1
|
export declare function shortenedCloudUrl(installationSource: string, accessToken?: string, usesGithub?: boolean): Promise<string>;
|
2
2
|
export declare function repoUsesGithub(github?: boolean): Promise<boolean>;
|
3
|
+
export declare function removeTrailingSlash(apiUrl: string): string;
|
4
|
+
export declare function getURLifShortenFailed(usesGithub: boolean, githubSlug: string, apiUrl: string, source: string, accessToken?: string): string;
|
5
|
+
export declare function getNxCloudVersion(apiUrl: string): Promise<string | null>;
|
6
|
+
export declare function removeVersionModifier(versionString: string): string;
|
7
|
+
export declare function versionIsValid(version: string): boolean;
|
8
|
+
export declare function compareCleanCloudVersions(version1: string, version2: string): number;
|
@@ -1,14 +1,21 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.repoUsesGithub = exports.shortenedCloudUrl = void 0;
|
3
|
+
exports.compareCleanCloudVersions = exports.versionIsValid = exports.removeVersionModifier = exports.getNxCloudVersion = exports.getURLifShortenFailed = exports.removeTrailingSlash = exports.repoUsesGithub = exports.shortenedCloudUrl = void 0;
|
4
4
|
const devkit_exports_1 = require("../../devkit-exports");
|
5
5
|
const git_utils_1 = require("../../utils/git-utils");
|
6
|
-
const semver_1 = require("semver");
|
7
6
|
async function shortenedCloudUrl(installationSource, accessToken, usesGithub) {
|
8
7
|
const githubSlug = (0, git_utils_1.getGithubSlugOrNull)();
|
9
8
|
const apiUrl = removeTrailingSlash(process.env.NX_CLOUD_API || process.env.NRWL_API || `https://cloud.nx.app`);
|
10
|
-
|
11
|
-
|
9
|
+
try {
|
10
|
+
const version = await getNxCloudVersion(apiUrl);
|
11
|
+
if ((version && compareCleanCloudVersions(version, '2406.11.5') < 0) ||
|
12
|
+
!version) {
|
13
|
+
return apiUrl;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
catch (e) {
|
17
|
+
devkit_exports_1.logger.verbose(`Failed to get Nx Cloud version.
|
18
|
+
${e}`);
|
12
19
|
return apiUrl;
|
13
20
|
}
|
14
21
|
const source = getSource(installationSource);
|
@@ -44,6 +51,7 @@ exports.repoUsesGithub = repoUsesGithub;
|
|
44
51
|
function removeTrailingSlash(apiUrl) {
|
45
52
|
return apiUrl[apiUrl.length - 1] === '/' ? apiUrl.slice(0, -1) : apiUrl;
|
46
53
|
}
|
54
|
+
exports.removeTrailingSlash = removeTrailingSlash;
|
47
55
|
function getSource(installationSource) {
|
48
56
|
if (installationSource.includes('nx-init')) {
|
49
57
|
return 'nx-init';
|
@@ -69,6 +77,7 @@ function getURLifShortenFailed(usesGithub, githubSlug, apiUrl, source, accessTok
|
|
69
77
|
}
|
70
78
|
return `${apiUrl}/setup/connect-workspace/manual?accessToken=${accessToken}&source=${source}`;
|
71
79
|
}
|
80
|
+
exports.getURLifShortenFailed = getURLifShortenFailed;
|
72
81
|
async function getInstallationSupportsGitHub(apiUrl) {
|
73
82
|
try {
|
74
83
|
const response = await require('axios').get(`${apiUrl}/nx-cloud/system/features`);
|
@@ -89,17 +98,55 @@ async function getNxCloudVersion(apiUrl) {
|
|
89
98
|
try {
|
90
99
|
const response = await require('axios').get(`${apiUrl}/nx-cloud/system/version`);
|
91
100
|
const version = removeVersionModifier(response.data.version);
|
101
|
+
const isValid = versionIsValid(version);
|
92
102
|
if (!version) {
|
93
103
|
throw new Error('Failed to extract version from response.');
|
94
104
|
}
|
105
|
+
if (!isValid) {
|
106
|
+
throw new Error(`Invalid version format: ${version}`);
|
107
|
+
}
|
95
108
|
return version;
|
96
109
|
}
|
97
110
|
catch (e) {
|
98
111
|
devkit_exports_1.logger.verbose(`Failed to get version of Nx Cloud.
|
99
112
|
${e}`);
|
113
|
+
return null;
|
100
114
|
}
|
101
115
|
}
|
116
|
+
exports.getNxCloudVersion = getNxCloudVersion;
|
102
117
|
function removeVersionModifier(versionString) {
|
103
|
-
// version
|
118
|
+
// Cloud version string is in the format of YYMM.DD.BuildNumber-Modifier
|
104
119
|
return versionString.split(/[\.-]/).slice(0, 3).join('.');
|
105
120
|
}
|
121
|
+
exports.removeVersionModifier = removeVersionModifier;
|
122
|
+
function versionIsValid(version) {
|
123
|
+
// Updated Regex pattern to require YYMM.DD.BuildNumber format
|
124
|
+
// All parts are required, including the BuildNumber.
|
125
|
+
const pattern = /^\d{4}\.\d{2}\.\d+$/;
|
126
|
+
return pattern.test(version);
|
127
|
+
}
|
128
|
+
exports.versionIsValid = versionIsValid;
|
129
|
+
function compareCleanCloudVersions(version1, version2) {
|
130
|
+
const parseVersion = (version) => {
|
131
|
+
// The format we're using is YYMM.DD.BuildNumber
|
132
|
+
const parts = version.split('.').map((part) => parseInt(part, 10));
|
133
|
+
return {
|
134
|
+
yearMonth: parts[0],
|
135
|
+
day: parts[1],
|
136
|
+
buildNumber: parts[2],
|
137
|
+
};
|
138
|
+
};
|
139
|
+
const v1 = parseVersion(version1);
|
140
|
+
const v2 = parseVersion(version2);
|
141
|
+
if (v1.yearMonth !== v2.yearMonth) {
|
142
|
+
return v1.yearMonth > v2.yearMonth ? 1 : -1;
|
143
|
+
}
|
144
|
+
if (v1.day !== v2.day) {
|
145
|
+
return v1.day > v2.day ? 1 : -1;
|
146
|
+
}
|
147
|
+
if (v1.buildNumber !== v2.buildNumber) {
|
148
|
+
return v1.buildNumber > v2.buildNumber ? 1 : -1;
|
149
|
+
}
|
150
|
+
return 0;
|
151
|
+
}
|
152
|
+
exports.compareCleanCloudVersions = compareCleanCloudVersions;
|
@@ -9,12 +9,12 @@ import { LoadedNxPlugin } from '../plugins/internal-api';
|
|
9
9
|
* @param nxJson
|
10
10
|
*/
|
11
11
|
export declare function retrieveWorkspaceFiles(workspaceRoot: string, projectRootMap: Record<string, string>): Promise<{
|
12
|
-
allWorkspaceFiles: import("
|
12
|
+
allWorkspaceFiles: import("nx/src/devkit-exports").FileData[];
|
13
13
|
fileMap: {
|
14
14
|
projectFileMap: ProjectFiles;
|
15
|
-
nonProjectFiles: import("
|
15
|
+
nonProjectFiles: import("nx/src/native").FileData[];
|
16
16
|
};
|
17
|
-
rustReferences: import("
|
17
|
+
rustReferences: import("nx/src/native").NxWorkspaceFilesExternals;
|
18
18
|
}>;
|
19
19
|
/**
|
20
20
|
* Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
|