nx 19.6.0-canary.20240724-684d2a9 → 19.6.0-canary.20240726-b3c67de
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/nx-cloud.d.ts +2 -1
- package/bin/nx-cloud.js +9 -17
- package/package.json +13 -13
- package/src/command-line/list/list.js +10 -14
- package/src/command-line/migrate/migrate.js +19 -7
- package/src/command-line/release/command-object.js +5 -21
- package/src/command-line/report/report.d.ts +1 -0
- package/src/command-line/report/report.js +14 -9
- package/src/command-line/reset/command-object.d.ts +1 -0
- package/src/command-line/reset/command-object.js +4 -0
- package/src/command-line/reset/reset.js +13 -0
- package/src/command-line/run/run.js +2 -14
- package/src/daemon/socket-utils.js +1 -1
- package/src/daemon/tmp-dir.d.ts +1 -1
- package/src/daemon/tmp-dir.js +3 -2
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +6 -0
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +15 -5
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +2 -0
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +1 -1
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +3 -1
- package/src/native/index.d.ts +2 -0
- package/src/native/native-bindings.js +1 -0
- package/src/native/nx.wasi.cjs +35 -33
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +2 -10
- package/src/nx-cloud/utilities/client.d.ts +10 -0
- package/src/nx-cloud/utilities/client.js +35 -0
- package/src/nx-cloud/utilities/url-shorten.d.ts +2 -2
- package/src/nx-cloud/utilities/url-shorten.js +13 -6
- package/src/tasks-runner/task-env.js +3 -2
- package/src/tasks-runner/utils.js +9 -5
- package/src/utils/chunkify.d.ts +10 -0
- package/src/utils/chunkify.js +19 -12
- package/src/utils/command-line-utils.d.ts +3 -0
- package/src/utils/command-line-utils.js +11 -7
- package/src/utils/git-utils.js +14 -4
- package/src/utils/plugins/core-plugins.d.ts +6 -3
- package/src/utils/plugins/core-plugins.js +107 -115
- package/src/utils/plugins/index.d.ts +4 -4
- package/src/utils/plugins/index.js +7 -8
- package/src/utils/plugins/installed-plugins.d.ts +2 -3
- package/src/utils/plugins/installed-plugins.js +4 -31
- package/src/utils/plugins/local-plugins.d.ts +2 -3
- package/src/utils/plugins/local-plugins.js +2 -29
- package/src/utils/plugins/output.d.ts +5 -0
- package/src/utils/plugins/output.js +104 -0
- package/src/utils/plugins/plugin-capabilities.d.ts +12 -2
- package/src/utils/plugins/plugin-capabilities.js +2 -87
- package/src/utils/plugins/community-plugins.d.ts +0 -2
- package/src/utils/plugins/community-plugins.js +0 -28
- package/src/utils/plugins/models.d.ts +0 -22
- package/src/utils/plugins/models.js +0 -2
- package/src/utils/plugins/shared.d.ts +0 -1
- package/src/utils/plugins/shared.js +0 -7
package/src/native/nx.wasi.cjs
CHANGED
@@ -88,39 +88,40 @@ function __napi_rs_initialize_modules(__napiInstance) {
|
|
88
88
|
__napiInstance.exports['__napi_register__copy_3']?.()
|
89
89
|
__napiInstance.exports['__napi_register__hash_array_4']?.()
|
90
90
|
__napiInstance.exports['__napi_register__hash_file_5']?.()
|
91
|
-
__napiInstance.exports['
|
92
|
-
__napiInstance.exports['
|
93
|
-
__napiInstance.exports['
|
94
|
-
__napiInstance.exports['
|
95
|
-
__napiInstance.exports['
|
96
|
-
__napiInstance.exports['
|
97
|
-
__napiInstance.exports['
|
98
|
-
__napiInstance.exports['
|
99
|
-
__napiInstance.exports['
|
100
|
-
__napiInstance.exports['
|
101
|
-
__napiInstance.exports['
|
102
|
-
__napiInstance.exports['
|
103
|
-
__napiInstance.exports['
|
104
|
-
__napiInstance.exports['
|
105
|
-
__napiInstance.exports['
|
106
|
-
__napiInstance.exports['
|
107
|
-
__napiInstance.exports['
|
108
|
-
__napiInstance.exports['
|
109
|
-
__napiInstance.exports['
|
110
|
-
__napiInstance.exports['
|
111
|
-
__napiInstance.exports['
|
112
|
-
__napiInstance.exports['
|
113
|
-
__napiInstance.exports['
|
114
|
-
__napiInstance.exports['
|
115
|
-
__napiInstance.exports['
|
116
|
-
__napiInstance.exports['
|
117
|
-
__napiInstance.exports['
|
118
|
-
__napiInstance.exports['
|
119
|
-
__napiInstance.exports['
|
120
|
-
__napiInstance.exports['
|
121
|
-
__napiInstance.exports['
|
122
|
-
__napiInstance.exports['
|
123
|
-
__napiInstance.exports['
|
91
|
+
__napiInstance.exports['__napi_register__IS_WASM_6']?.()
|
92
|
+
__napiInstance.exports['__napi_register__get_binary_target_7']?.()
|
93
|
+
__napiInstance.exports['__napi_register__ImportResult_struct_8']?.()
|
94
|
+
__napiInstance.exports['__napi_register__find_imports_9']?.()
|
95
|
+
__napiInstance.exports['__napi_register__transfer_project_graph_10']?.()
|
96
|
+
__napiInstance.exports['__napi_register__ExternalNode_struct_11']?.()
|
97
|
+
__napiInstance.exports['__napi_register__Target_struct_12']?.()
|
98
|
+
__napiInstance.exports['__napi_register__Project_struct_13']?.()
|
99
|
+
__napiInstance.exports['__napi_register__ProjectGraph_struct_14']?.()
|
100
|
+
__napiInstance.exports['__napi_register__HashPlanner_struct_15']?.()
|
101
|
+
__napiInstance.exports['__napi_register__HashPlanner_impl_19']?.()
|
102
|
+
__napiInstance.exports['__napi_register__HashDetails_struct_20']?.()
|
103
|
+
__napiInstance.exports['__napi_register__HasherOptions_struct_21']?.()
|
104
|
+
__napiInstance.exports['__napi_register__TaskHasher_struct_22']?.()
|
105
|
+
__napiInstance.exports['__napi_register__TaskHasher_impl_25']?.()
|
106
|
+
__napiInstance.exports['__napi_register__Task_struct_26']?.()
|
107
|
+
__napiInstance.exports['__napi_register__TaskTarget_struct_27']?.()
|
108
|
+
__napiInstance.exports['__napi_register__TaskGraph_struct_28']?.()
|
109
|
+
__napiInstance.exports['__napi_register__FileData_struct_29']?.()
|
110
|
+
__napiInstance.exports['__napi_register__InputsInput_struct_30']?.()
|
111
|
+
__napiInstance.exports['__napi_register__FileSetInput_struct_31']?.()
|
112
|
+
__napiInstance.exports['__napi_register__RuntimeInput_struct_32']?.()
|
113
|
+
__napiInstance.exports['__napi_register__EnvironmentInput_struct_33']?.()
|
114
|
+
__napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_34']?.()
|
115
|
+
__napiInstance.exports['__napi_register__DepsOutputsInput_struct_35']?.()
|
116
|
+
__napiInstance.exports['__napi_register__NxJson_struct_36']?.()
|
117
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_struct_37']?.()
|
118
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_impl_46']?.()
|
119
|
+
__napiInstance.exports['__napi_register__WorkspaceErrors_47']?.()
|
120
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_48']?.()
|
121
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_49']?.()
|
122
|
+
__napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_50']?.()
|
123
|
+
__napiInstance.exports['__napi_register__FileMap_struct_51']?.()
|
124
|
+
__napiInstance.exports['__napi_register____test_only_transfer_file_map_52']?.()
|
124
125
|
}
|
125
126
|
module.exports.HashPlanner = __napiModule.exports.HashPlanner
|
126
127
|
module.exports.ImportResult = __napiModule.exports.ImportResult
|
@@ -129,6 +130,7 @@ module.exports.WorkspaceContext = __napiModule.exports.WorkspaceContext
|
|
129
130
|
module.exports.copy = __napiModule.exports.copy
|
130
131
|
module.exports.expandOutputs = __napiModule.exports.expandOutputs
|
131
132
|
module.exports.findImports = __napiModule.exports.findImports
|
133
|
+
module.exports.getBinaryTarget = __napiModule.exports.getBinaryTarget
|
132
134
|
module.exports.getFilesForOutputs = __napiModule.exports.getFilesForOutputs
|
133
135
|
module.exports.hashArray = __napiModule.exports.hashArray
|
134
136
|
module.exports.hashFile = __napiModule.exports.hashFile
|
Binary file
|
@@ -8,7 +8,6 @@ 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
10
|
const get_cloud_options_1 = require("../../utilities/get-cloud-options");
|
11
|
-
const git_utils_1 = require("../../../utils/git-utils");
|
12
11
|
const ora = require("ora");
|
13
12
|
const open = require("open");
|
14
13
|
function printCloudConnectionDisabledMessage() {
|
@@ -55,7 +54,7 @@ async function createNxCloudWorkspace(workspaceName, installationSource, nxInitD
|
|
55
54
|
}
|
56
55
|
return response.data;
|
57
56
|
}
|
58
|
-
async function printSuccessMessage(
|
57
|
+
async function printSuccessMessage(token, installationSource, usesGithub) {
|
59
58
|
const connectCloudUrl = await (0, url_shorten_1.shortenedCloudUrl)(installationSource, token, usesGithub);
|
60
59
|
if (installationSource === 'nx-connect' && usesGithub) {
|
61
60
|
try {
|
@@ -88,12 +87,6 @@ async function printSuccessMessage(url, token, installationSource, usesGithub, d
|
|
88
87
|
`${connectCloudUrl}`,
|
89
88
|
],
|
90
89
|
});
|
91
|
-
(0, git_utils_1.commitChanges)(`feat(nx): Added Nx Cloud token to your nx.json
|
92
|
-
|
93
|
-
To connect your workspace to Nx Cloud, push your repository
|
94
|
-
to your git hosting provider and go to the following URL:
|
95
|
-
|
96
|
-
${connectCloudUrl}`, directory);
|
97
90
|
}
|
98
91
|
else {
|
99
92
|
output_1.output.note({
|
@@ -141,8 +134,7 @@ async function connectToNxCloud(tree, schema) {
|
|
141
134
|
silent: schema.hideFormatLogs,
|
142
135
|
});
|
143
136
|
}
|
144
|
-
|
145
|
-
return async () => await printSuccessMessage(responseFromCreateNxCloudWorkspace?.url ?? apiUrl, responseFromCreateNxCloudWorkspace?.token, schema.installationSource, usesGithub, schema.directory);
|
137
|
+
return async () => await printSuccessMessage(responseFromCreateNxCloudWorkspace?.token, schema.installationSource, usesGithub);
|
146
138
|
}
|
147
139
|
}
|
148
140
|
function sleep(ms) {
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { CloudTaskRunnerOptions } from '../nx-cloud-tasks-runner-shell';
|
2
|
+
export declare class UnknownCommandError extends Error {
|
3
|
+
command: string;
|
4
|
+
availableCommands: string[];
|
5
|
+
constructor(command: string, availableCommands: string[]);
|
6
|
+
}
|
7
|
+
export declare function getCloudClient(options: CloudTaskRunnerOptions): Promise<{
|
8
|
+
invoke: (command: string) => void;
|
9
|
+
availableCommands: string[];
|
10
|
+
}>;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.UnknownCommandError = void 0;
|
4
|
+
exports.getCloudClient = getCloudClient;
|
5
|
+
const resolution_helpers_1 = require("../resolution-helpers");
|
6
|
+
const update_manager_1 = require("../update-manager");
|
7
|
+
class UnknownCommandError extends Error {
|
8
|
+
constructor(command, availableCommands) {
|
9
|
+
super(`Unknown Command "${command}"`);
|
10
|
+
this.command = command;
|
11
|
+
this.availableCommands = availableCommands;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
exports.UnknownCommandError = UnknownCommandError;
|
15
|
+
async function getCloudClient(options) {
|
16
|
+
const { nxCloudClient } = await (0, update_manager_1.verifyOrUpdateNxCloudClient)(options);
|
17
|
+
const paths = (0, resolution_helpers_1.findAncestorNodeModules)(__dirname, []);
|
18
|
+
nxCloudClient.configureLightClientRequire()(paths);
|
19
|
+
return {
|
20
|
+
invoke: (command) => {
|
21
|
+
if (command in nxCloudClient.commands) {
|
22
|
+
nxCloudClient.commands[command]()
|
23
|
+
.then(() => process.exit(0))
|
24
|
+
.catch((e) => {
|
25
|
+
console.error(e);
|
26
|
+
process.exit(1);
|
27
|
+
});
|
28
|
+
}
|
29
|
+
else {
|
30
|
+
throw new UnknownCommandError(command, Object.keys(nxCloudClient.commands));
|
31
|
+
}
|
32
|
+
},
|
33
|
+
availableCommands: Object.keys(nxCloudClient.commands),
|
34
|
+
};
|
35
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export declare function shortenedCloudUrl(installationSource: string, accessToken?: string, usesGithub?: boolean): Promise<string>;
|
2
|
-
export declare function repoUsesGithub(github?: boolean): Promise<boolean>;
|
3
|
-
export declare function getURLifShortenFailed(usesGithub: boolean, githubSlug: string, apiUrl: string, source: string, accessToken?: string): string;
|
2
|
+
export declare function repoUsesGithub(github?: boolean, githubSlug?: string, apiUrl?: string): Promise<boolean>;
|
3
|
+
export declare function getURLifShortenFailed(usesGithub: boolean, githubSlug: string | null, apiUrl: string, source: string, accessToken?: string): string;
|
4
4
|
export declare function getNxCloudVersion(apiUrl: string): Promise<string | null>;
|
5
5
|
export declare function removeVersionModifier(versionString: string): string;
|
6
6
|
export declare function versionIsValid(version: string): boolean;
|
@@ -13,6 +13,9 @@ 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
15
|
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
16
|
+
if (usesGithub === undefined || usesGithub === null) {
|
17
|
+
usesGithub = await repoUsesGithub(undefined, githubSlug, apiUrl);
|
18
|
+
}
|
16
19
|
try {
|
17
20
|
const version = await getNxCloudVersion(apiUrl);
|
18
21
|
if ((version && compareCleanCloudVersions(version, '2406.11.5') < 0) ||
|
@@ -31,7 +34,7 @@ async function shortenedCloudUrl(installationSource, accessToken, usesGithub) {
|
|
31
34
|
type: usesGithub ? 'GITHUB' : 'MANUAL',
|
32
35
|
source,
|
33
36
|
accessToken: usesGithub ? null : accessToken,
|
34
|
-
selectedRepositoryName: githubSlug,
|
37
|
+
selectedRepositoryName: githubSlug === 'github' ? null : githubSlug,
|
35
38
|
});
|
36
39
|
if (!response?.data || response.data.message) {
|
37
40
|
throw new Error(response?.data?.message ?? 'Failed to shorten Nx Cloud URL');
|
@@ -41,14 +44,18 @@ async function shortenedCloudUrl(installationSource, accessToken, usesGithub) {
|
|
41
44
|
catch (e) {
|
42
45
|
devkit_exports_1.logger.verbose(`Failed to shorten Nx Cloud URL.
|
43
46
|
${e}`);
|
44
|
-
return getURLifShortenFailed(usesGithub, githubSlug, apiUrl, source, accessToken);
|
47
|
+
return getURLifShortenFailed(usesGithub, githubSlug === 'github' ? null : githubSlug, apiUrl, source, accessToken);
|
45
48
|
}
|
46
49
|
}
|
47
|
-
async function repoUsesGithub(github) {
|
48
|
-
|
49
|
-
|
50
|
+
async function repoUsesGithub(github, githubSlug, apiUrl) {
|
51
|
+
if (!apiUrl) {
|
52
|
+
apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
53
|
+
}
|
54
|
+
if (!githubSlug) {
|
55
|
+
githubSlug = (0, git_utils_1.getGithubSlugOrNull)();
|
56
|
+
}
|
50
57
|
const installationSupportsGitHub = await getInstallationSupportsGitHub(apiUrl);
|
51
|
-
return ((githubSlug || github) &&
|
58
|
+
return ((!!githubSlug || !!github) &&
|
52
59
|
(apiUrl.includes('cloud.nx.app') ||
|
53
60
|
apiUrl.includes('eu.nx.app') ||
|
54
61
|
installationSupportsGitHub));
|
@@ -8,6 +8,7 @@ exports.unloadDotEnvFile = unloadDotEnvFile;
|
|
8
8
|
const dotenv_1 = require("dotenv");
|
9
9
|
const dotenv_expand_1 = require("dotenv-expand");
|
10
10
|
const workspace_root_1 = require("../utils/workspace-root");
|
11
|
+
const node_path_1 = require("node:path");
|
11
12
|
function getEnvVariablesForBatchProcess(skipNxCache, captureStderr) {
|
12
13
|
return {
|
13
14
|
// User Process Env Variables override Dotenv Variables
|
@@ -158,13 +159,13 @@ function getEnvFilesForTask(task) {
|
|
158
159
|
function loadDotEnvFilesForTask(task, environmentVariables) {
|
159
160
|
const dotEnvFiles = getEnvFilesForTask(task);
|
160
161
|
for (const file of dotEnvFiles) {
|
161
|
-
loadAndExpandDotEnvFile(file, environmentVariables);
|
162
|
+
loadAndExpandDotEnvFile((0, node_path_1.join)(workspace_root_1.workspaceRoot, file), environmentVariables);
|
162
163
|
}
|
163
164
|
return environmentVariables;
|
164
165
|
}
|
165
166
|
function unloadDotEnvFiles(environmentVariables) {
|
166
167
|
for (const file of ['.env', '.local.env', '.env.local']) {
|
167
|
-
unloadDotEnvFile(file, environmentVariables);
|
168
|
+
unloadDotEnvFile((0, node_path_1.join)(workspace_root_1.workspaceRoot, file), environmentVariables);
|
168
169
|
}
|
169
170
|
return environmentVariables;
|
170
171
|
}
|
@@ -215,16 +215,20 @@ function getOutputsForTargetAndConfiguration(taskTargetOrTask, overridesOrNode,
|
|
215
215
|
};
|
216
216
|
if (targetConfiguration?.outputs) {
|
217
217
|
validateOutputs(targetConfiguration.outputs);
|
218
|
-
|
219
|
-
|
220
|
-
|
218
|
+
const result = new Set();
|
219
|
+
for (const output of targetConfiguration.outputs) {
|
220
|
+
const interpolatedOutput = interpolate(output, {
|
221
221
|
projectRoot: node.data.root,
|
222
222
|
projectName: node.name,
|
223
223
|
project: { ...node.data, name: node.name }, // this is legacy
|
224
224
|
options,
|
225
225
|
});
|
226
|
-
|
227
|
-
|
226
|
+
if (!!interpolatedOutput &&
|
227
|
+
!interpolatedOutput.match(/{(projectRoot|workspaceRoot|(options.*))}/)) {
|
228
|
+
result.add(interpolatedOutput);
|
229
|
+
}
|
230
|
+
}
|
231
|
+
return Array.from(result);
|
228
232
|
}
|
229
233
|
// Keep backwards compatibility in case `outputs` doesn't exist
|
230
234
|
if (options.outputPath) {
|
package/src/utils/chunkify.d.ts
CHANGED
@@ -1 +1,11 @@
|
|
1
1
|
export declare function chunkify(target: string[], maxChunkLength?: number): string[][];
|
2
|
+
/**
|
3
|
+
* Get the maximum length of a command-line argument string based on current platform
|
4
|
+
*
|
5
|
+
* https://serverfault.com/questions/69430/what-is-the-maximum-length-of-a-command-line-in-mac-os-x
|
6
|
+
* https://support.microsoft.com/en-us/help/830473/command-prompt-cmd-exe-command-line-string-limitation
|
7
|
+
* https://unix.stackexchange.com/a/120652
|
8
|
+
*
|
9
|
+
* Taken from: https://github.com/lint-staged/lint-staged/blob/adf50b00669f6aac2eeca25dd28ff86a9a3c2a48/lib/index.js#L21-L37
|
10
|
+
*/
|
11
|
+
export declare function getMaxArgLength(): 262144 | 8191 | 131072;
|
package/src/utils/chunkify.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.chunkify = chunkify;
|
4
|
-
|
5
|
-
const TERMINAL_SIZE =
|
4
|
+
exports.getMaxArgLength = getMaxArgLength;
|
5
|
+
const TERMINAL_SIZE = getMaxArgLength();
|
6
6
|
function chunkify(target, maxChunkLength = TERMINAL_SIZE - 500) {
|
7
7
|
const chunks = [];
|
8
8
|
let currentChunk = [];
|
@@ -23,15 +23,22 @@ function chunkify(target, maxChunkLength = TERMINAL_SIZE - 500) {
|
|
23
23
|
chunks.push(currentChunk);
|
24
24
|
return chunks;
|
25
25
|
}
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
/**
|
27
|
+
* Get the maximum length of a command-line argument string based on current platform
|
28
|
+
*
|
29
|
+
* https://serverfault.com/questions/69430/what-is-the-maximum-length-of-a-command-line-in-mac-os-x
|
30
|
+
* https://support.microsoft.com/en-us/help/830473/command-prompt-cmd-exe-command-line-string-limitation
|
31
|
+
* https://unix.stackexchange.com/a/120652
|
32
|
+
*
|
33
|
+
* Taken from: https://github.com/lint-staged/lint-staged/blob/adf50b00669f6aac2eeca25dd28ff86a9a3c2a48/lib/index.js#L21-L37
|
34
|
+
*/
|
35
|
+
function getMaxArgLength() {
|
36
|
+
switch (process.platform) {
|
37
|
+
case 'darwin':
|
38
|
+
return 262144;
|
39
|
+
case 'win32':
|
40
|
+
return 8191;
|
41
|
+
default:
|
42
|
+
return 131072;
|
36
43
|
}
|
37
44
|
}
|
@@ -41,6 +41,9 @@ export declare function splitArgsIntoNxArgsAndOverrides(args: {
|
|
41
41
|
__overrides_unparsed__: string[];
|
42
42
|
};
|
43
43
|
};
|
44
|
+
export declare function readParallelFromArgsAndEnv(args: {
|
45
|
+
[k: string]: any;
|
46
|
+
}): number;
|
44
47
|
export declare function parseFiles(options: NxArgs): {
|
45
48
|
files: string[];
|
46
49
|
};
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.createOverrides = createOverrides;
|
4
4
|
exports.splitArgsIntoNxArgsAndOverrides = splitArgsIntoNxArgsAndOverrides;
|
5
|
+
exports.readParallelFromArgsAndEnv = readParallelFromArgsAndEnv;
|
5
6
|
exports.parseFiles = parseFiles;
|
6
7
|
exports.getProjectRoots = getProjectRoots;
|
7
8
|
exports.readGraphFileFromGraphArg = readGraphFileFromGraphArg;
|
@@ -112,23 +113,26 @@ function splitArgsIntoNxArgsAndOverrides(args, mode, options = { printWarnings:
|
|
112
113
|
nxArgs.skipNxCache = process.env.NX_SKIP_NX_CACHE === 'true';
|
113
114
|
}
|
114
115
|
normalizeNxArgsRunner(nxArgs, nxJson, options);
|
116
|
+
nxArgs['parallel'] = readParallelFromArgsAndEnv(args);
|
117
|
+
return { nxArgs, overrides };
|
118
|
+
}
|
119
|
+
function readParallelFromArgsAndEnv(args) {
|
115
120
|
if (args['parallel'] === 'false' || args['parallel'] === false) {
|
116
|
-
|
121
|
+
return 1;
|
117
122
|
}
|
118
123
|
else if (args['parallel'] === 'true' ||
|
119
124
|
args['parallel'] === true ||
|
120
125
|
args['parallel'] === '' ||
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
126
|
+
// dont require passing --parallel if NX_PARALLEL is set, but allow overriding it
|
127
|
+
(process.env.NX_PARALLEL && args['parallel'] === undefined)) {
|
128
|
+
return Number(args['maxParallel'] ||
|
129
|
+
args['max-parallel'] ||
|
125
130
|
process.env.NX_PARALLEL ||
|
126
131
|
3);
|
127
132
|
}
|
128
133
|
else if (args['parallel'] !== undefined) {
|
129
|
-
|
134
|
+
return Number(args['parallel']);
|
130
135
|
}
|
131
|
-
return { nxArgs, overrides };
|
132
136
|
}
|
133
137
|
function normalizeNxArgsRunner(nxArgs, nxJson, options) {
|
134
138
|
if (!nxArgs.runner) {
|
package/src/utils/git-utils.js
CHANGED
@@ -9,26 +9,36 @@ const devkit_exports_1 = require("../devkit-exports");
|
|
9
9
|
function getGithubSlugOrNull() {
|
10
10
|
try {
|
11
11
|
const gitRemote = (0, child_process_1.execSync)('git remote -v').toString();
|
12
|
+
// If there are no remotes, we default to github
|
13
|
+
if (!gitRemote || gitRemote.length === 0) {
|
14
|
+
return 'github';
|
15
|
+
}
|
12
16
|
return extractUserAndRepoFromGitHubUrl(gitRemote);
|
13
17
|
}
|
14
18
|
catch (e) {
|
15
|
-
|
19
|
+
// Probably git is not set up, so we default to github
|
20
|
+
return 'github';
|
16
21
|
}
|
17
22
|
}
|
18
23
|
function extractUserAndRepoFromGitHubUrl(gitRemotes) {
|
19
24
|
const regex = /^\s*(\w+)\s+(git@github\.com:|https:\/\/github\.com\/)([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\.git/gm;
|
25
|
+
const remotesPriority = ['origin', 'upstream', 'base'];
|
26
|
+
const foundRemotes = {};
|
20
27
|
let firstGitHubUrl = null;
|
21
28
|
let match;
|
22
29
|
while ((match = regex.exec(gitRemotes)) !== null) {
|
23
30
|
const remoteName = match[1];
|
24
31
|
const url = match[2] + match[3] + '/' + match[4] + '.git';
|
25
|
-
|
26
|
-
return parseGitHubUrl(url);
|
27
|
-
}
|
32
|
+
foundRemotes[remoteName] = url;
|
28
33
|
if (!firstGitHubUrl) {
|
29
34
|
firstGitHubUrl = url;
|
30
35
|
}
|
31
36
|
}
|
37
|
+
for (const remote of remotesPriority) {
|
38
|
+
if (foundRemotes[remote]) {
|
39
|
+
return parseGitHubUrl(foundRemotes[remote]);
|
40
|
+
}
|
41
|
+
}
|
32
42
|
return firstGitHubUrl ? parseGitHubUrl(firstGitHubUrl) : null;
|
33
43
|
}
|
34
44
|
function parseGitHubUrl(url) {
|
@@ -1,3 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
export interface CorePlugin {
|
2
|
+
name: string;
|
3
|
+
capabilities: 'executors' | 'generators' | 'executors,generators' | 'graph';
|
4
|
+
link?: string;
|
5
|
+
}
|
6
|
+
export declare const CORE_PLUGINS: CorePlugin[];
|