nx 19.6.0-canary.20240719-83b88a1 → 19.6.0-canary.20240723-c4f9d89
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/nx.js +1 -1
- package/package.json +12 -12
- package/src/command-line/connect/command-object.js +6 -0
- package/src/command-line/connect/connect-to-nx-cloud.d.ts +1 -1
- package/src/command-line/connect/connect-to-nx-cloud.js +11 -4
- package/src/command-line/connect/view-logs.js +1 -1
- package/src/command-line/migrate/command-object.js +1 -0
- package/src/core/graph/main.js +1 -1
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +3 -7
- package/src/nx-cloud/utilities/get-cloud-options.d.ts +2 -0
- package/src/nx-cloud/utilities/get-cloud-options.js +8 -0
- package/src/nx-cloud/utilities/url-shorten.d.ts +0 -1
- package/src/nx-cloud/utilities/url-shorten.js +3 -6
- package/src/tasks-runner/utils.js +0 -1
- package/src/utils/ab-testing.d.ts +1 -1
- package/src/utils/ab-testing.js +2 -1
Binary file
|
@@ -7,6 +7,7 @@ const json_1 = require("../../../generators/utils/json");
|
|
7
7
|
const nx_json_1 = require("../../../generators/utils/nx-json");
|
8
8
|
const format_changed_files_with_prettier_if_available_1 = require("../../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
9
9
|
const url_shorten_1 = require("../../utilities/url-shorten");
|
10
|
+
const get_cloud_options_1 = require("../../utilities/get-cloud-options");
|
10
11
|
const git_utils_1 = require("../../../utils/git-utils");
|
11
12
|
const ora = require("ora");
|
12
13
|
const open = require("open");
|
@@ -30,11 +31,6 @@ function getRootPackageName(tree) {
|
|
30
31
|
catch (e) { }
|
31
32
|
return packageJson?.name ?? 'my-workspace';
|
32
33
|
}
|
33
|
-
function removeTrailingSlash(apiUrl) {
|
34
|
-
return apiUrl[apiUrl.length - 1] === '/'
|
35
|
-
? apiUrl.substr(0, apiUrl.length - 1)
|
36
|
-
: apiUrl;
|
37
|
-
}
|
38
34
|
function getNxInitDate() {
|
39
35
|
try {
|
40
36
|
const nxInitIso = (0, child_process_1.execSync)('git log --diff-filter=A --follow --format=%aI -- nx.json | tail -1', { stdio: 'pipe' })
|
@@ -48,7 +44,7 @@ function getNxInitDate() {
|
|
48
44
|
}
|
49
45
|
}
|
50
46
|
async function createNxCloudWorkspace(workspaceName, installationSource, nxInitDate) {
|
51
|
-
const apiUrl =
|
47
|
+
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
52
48
|
const response = await require('axios').post(`${apiUrl}/nx-cloud/create-org-and-workspace`, {
|
53
49
|
workspaceName,
|
54
50
|
installationSource,
|
@@ -145,7 +141,7 @@ async function connectToNxCloud(tree, schema) {
|
|
145
141
|
silent: schema.hideFormatLogs,
|
146
142
|
});
|
147
143
|
}
|
148
|
-
const apiUrl =
|
144
|
+
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
149
145
|
return async () => await printSuccessMessage(responseFromCreateNxCloudWorkspace?.url ?? apiUrl, responseFromCreateNxCloudWorkspace?.token, schema.installationSource, usesGithub, schema.directory);
|
150
146
|
}
|
151
147
|
}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getCloudOptions = getCloudOptions;
|
4
|
+
exports.getCloudUrl = getCloudUrl;
|
5
|
+
exports.removeTrailingSlash = removeTrailingSlash;
|
4
6
|
const nx_json_1 = require("../../config/nx-json");
|
5
7
|
const run_command_1 = require("../../tasks-runner/run-command");
|
6
8
|
function getCloudOptions() {
|
@@ -8,3 +10,9 @@ function getCloudOptions() {
|
|
8
10
|
// TODO: The default is not always cloud? But it's not handled at the moment
|
9
11
|
return (0, run_command_1.getRunnerOptions)('default', nxJson, {}, true);
|
10
12
|
}
|
13
|
+
function getCloudUrl() {
|
14
|
+
return removeTrailingSlash(process.env.NX_CLOUD_API || process.env.NRWL_API || `https://cloud.nx.app`);
|
15
|
+
}
|
16
|
+
function removeTrailingSlash(apiUrl) {
|
17
|
+
return apiUrl[apiUrl.length - 1] === '/' ? apiUrl.slice(0, -1) : apiUrl;
|
18
|
+
}
|
@@ -1,6 +1,5 @@
|
|
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
3
|
export declare function getURLifShortenFailed(usesGithub: boolean, githubSlug: string, apiUrl: string, source: string, accessToken?: string): string;
|
5
4
|
export declare function getNxCloudVersion(apiUrl: string): Promise<string | null>;
|
6
5
|
export declare function removeVersionModifier(versionString: string): string;
|
@@ -2,7 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.shortenedCloudUrl = shortenedCloudUrl;
|
4
4
|
exports.repoUsesGithub = repoUsesGithub;
|
5
|
-
exports.removeTrailingSlash = removeTrailingSlash;
|
6
5
|
exports.getURLifShortenFailed = getURLifShortenFailed;
|
7
6
|
exports.getNxCloudVersion = getNxCloudVersion;
|
8
7
|
exports.removeVersionModifier = removeVersionModifier;
|
@@ -10,9 +9,10 @@ exports.versionIsValid = versionIsValid;
|
|
10
9
|
exports.compareCleanCloudVersions = compareCleanCloudVersions;
|
11
10
|
const devkit_exports_1 = require("../../devkit-exports");
|
12
11
|
const git_utils_1 = require("../../utils/git-utils");
|
12
|
+
const get_cloud_options_1 = require("./get-cloud-options");
|
13
13
|
async function shortenedCloudUrl(installationSource, accessToken, usesGithub) {
|
14
14
|
const githubSlug = (0, git_utils_1.getGithubSlugOrNull)();
|
15
|
-
const apiUrl =
|
15
|
+
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
16
16
|
try {
|
17
17
|
const version = await getNxCloudVersion(apiUrl);
|
18
18
|
if ((version && compareCleanCloudVersions(version, '2406.11.5') < 0) ||
|
@@ -46,16 +46,13 @@ async function shortenedCloudUrl(installationSource, accessToken, usesGithub) {
|
|
46
46
|
}
|
47
47
|
async function repoUsesGithub(github) {
|
48
48
|
const githubSlug = (0, git_utils_1.getGithubSlugOrNull)();
|
49
|
-
const apiUrl =
|
49
|
+
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
50
50
|
const installationSupportsGitHub = await getInstallationSupportsGitHub(apiUrl);
|
51
51
|
return ((githubSlug || github) &&
|
52
52
|
(apiUrl.includes('cloud.nx.app') ||
|
53
53
|
apiUrl.includes('eu.nx.app') ||
|
54
54
|
installationSupportsGitHub));
|
55
55
|
}
|
56
|
-
function removeTrailingSlash(apiUrl) {
|
57
|
-
return apiUrl[apiUrl.length - 1] === '/' ? apiUrl.slice(0, -1) : apiUrl;
|
58
|
-
}
|
59
56
|
function getSource(installationSource) {
|
60
57
|
if (installationSource.includes('nx-init')) {
|
61
58
|
return 'nx-init';
|
@@ -136,7 +136,6 @@ function normalizeTargetDependencyWithStringProjects(dependencyConfig) {
|
|
136
136
|
else if (dependencyConfig.projects === 'dependencies') {
|
137
137
|
dependencyConfig.dependencies = true;
|
138
138
|
delete dependencyConfig.projects;
|
139
|
-
return;
|
140
139
|
/** LERNA SUPPORT END - Remove in v20 */
|
141
140
|
}
|
142
141
|
else {
|
package/src/utils/ab-testing.js
CHANGED
@@ -5,6 +5,7 @@ exports.recordStat = recordStat;
|
|
5
5
|
const node_child_process_1 = require("node:child_process");
|
6
6
|
const is_ci_1 = require("./is-ci");
|
7
7
|
const package_manager_1 = require("./package-manager");
|
8
|
+
const get_cloud_options_1 = require("../nx-cloud/utilities/get-cloud-options");
|
8
9
|
const messageOptions = {
|
9
10
|
setupNxCloud: [
|
10
11
|
{
|
@@ -72,7 +73,7 @@ async function recordStat(opts) {
|
|
72
73
|
const axios = require('axios');
|
73
74
|
await (axios['default'] ?? axios)
|
74
75
|
.create({
|
75
|
-
baseURL:
|
76
|
+
baseURL: (0, get_cloud_options_1.getCloudUrl)(),
|
76
77
|
timeout: 400,
|
77
78
|
})
|
78
79
|
.post('/nx-cloud/stats', {
|