nx 19.5.2 → 19.5.4
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/nx-cloud.d.ts +2 -1
- package/bin/nx-cloud.js +9 -17
- package/package.json +13 -13
- package/release/changelog-renderer/index.js +5 -4
- package/src/command-line/connect/connect-to-nx-cloud.d.ts +2 -0
- package/src/command-line/connect/connect-to-nx-cloud.js +33 -6
- package/src/command-line/connect/view-logs.js +5 -3
- package/src/command-line/examples.js +4 -0
- package/src/command-line/init/implementation/add-nx-to-monorepo.js +1 -1
- package/src/command-line/init/implementation/add-nx-to-nest.js +1 -1
- package/src/command-line/init/implementation/add-nx-to-npm-repo.js +1 -1
- package/src/command-line/init/implementation/angular/index.js +1 -1
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +1 -1
- package/src/command-line/init/implementation/utils.d.ts +1 -1
- package/src/command-line/init/implementation/utils.js +7 -5
- package/src/command-line/init/init-v2.js +1 -4
- package/src/command-line/list/list.js +10 -14
- package/src/command-line/migrate/migrate.js +19 -7
- package/src/command-line/release/changelog.js +1 -0
- package/src/command-line/release/command-object.js +5 -21
- package/src/command-line/release/config/config.js +4 -0
- package/src/command-line/release/plan.js +2 -12
- package/src/command-line/release/utils/generate-version-plan-content.d.ts +1 -0
- package/src/command-line/release/utils/generate-version-plan-content.js +21 -0
- package/src/command-line/release/utils/shared.js +8 -5
- package/src/command-line/release/version.js +4 -2
- 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/command-line/watch/watch.js +1 -1
- 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.d.ts +3 -2
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +19 -66
- 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 +3 -3
- package/src/nx-cloud/utilities/url-shorten.js +18 -13
- package/src/project-graph/plugins/internal-api.js +4 -1
- package/src/tasks-runner/run-command.d.ts +4 -4
- package/src/tasks-runner/run-command.js +22 -17
- package/src/tasks-runner/task-env.js +3 -2
- package/src/tasks-runner/task-graph-utils.d.ts +3 -0
- package/src/tasks-runner/task-graph-utils.js +34 -0
- 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
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.createNxCloudOnboardingURL = createNxCloudOnboardingURL;
|
4
4
|
exports.repoUsesGithub = repoUsesGithub;
|
5
5
|
exports.getURLifShortenFailed = getURLifShortenFailed;
|
6
6
|
exports.getNxCloudVersion = getNxCloudVersion;
|
@@ -10,9 +10,12 @@ exports.compareCleanCloudVersions = compareCleanCloudVersions;
|
|
10
10
|
const devkit_exports_1 = require("../../devkit-exports");
|
11
11
|
const git_utils_1 = require("../../utils/git-utils");
|
12
12
|
const get_cloud_options_1 = require("./get-cloud-options");
|
13
|
-
async function
|
13
|
+
async function createNxCloudOnboardingURL(onboardingSource, accessToken, usesGithub, meta) {
|
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) ||
|
@@ -25,13 +28,14 @@ async function shortenedCloudUrl(installationSource, accessToken, usesGithub) {
|
|
25
28
|
${e}`);
|
26
29
|
return apiUrl;
|
27
30
|
}
|
28
|
-
const source = getSource(
|
31
|
+
const source = getSource(onboardingSource);
|
29
32
|
try {
|
30
33
|
const response = await require('axios').post(`${apiUrl}/nx-cloud/onboarding`, {
|
31
34
|
type: usesGithub ? 'GITHUB' : 'MANUAL',
|
32
35
|
source,
|
33
36
|
accessToken: usesGithub ? null : accessToken,
|
34
|
-
selectedRepositoryName: githubSlug,
|
37
|
+
selectedRepositoryName: githubSlug === 'github' ? null : githubSlug,
|
38
|
+
meta,
|
35
39
|
});
|
36
40
|
if (!response?.data || response.data.message) {
|
37
41
|
throw new Error(response?.data?.message ?? 'Failed to shorten Nx Cloud URL');
|
@@ -41,14 +45,18 @@ async function shortenedCloudUrl(installationSource, accessToken, usesGithub) {
|
|
41
45
|
catch (e) {
|
42
46
|
devkit_exports_1.logger.verbose(`Failed to shorten Nx Cloud URL.
|
43
47
|
${e}`);
|
44
|
-
return getURLifShortenFailed(usesGithub, githubSlug, apiUrl, source, accessToken);
|
48
|
+
return getURLifShortenFailed(usesGithub, githubSlug === 'github' ? null : githubSlug, apiUrl, source, accessToken);
|
45
49
|
}
|
46
50
|
}
|
47
|
-
async function repoUsesGithub(github) {
|
48
|
-
|
49
|
-
|
51
|
+
async function repoUsesGithub(github, githubSlug, apiUrl) {
|
52
|
+
if (!apiUrl) {
|
53
|
+
apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
54
|
+
}
|
55
|
+
if (!githubSlug) {
|
56
|
+
githubSlug = (0, git_utils_1.getGithubSlugOrNull)();
|
57
|
+
}
|
50
58
|
const installationSupportsGitHub = await getInstallationSupportsGitHub(apiUrl);
|
51
|
-
return ((githubSlug || github) &&
|
59
|
+
return ((!!githubSlug || !!github) &&
|
52
60
|
(apiUrl.includes('cloud.nx.app') ||
|
53
61
|
apiUrl.includes('eu.nx.app') ||
|
54
62
|
installationSupportsGitHub));
|
@@ -60,11 +68,8 @@ function getSource(installationSource) {
|
|
60
68
|
else if (installationSource.includes('nx-connect')) {
|
61
69
|
return 'nx-connect';
|
62
70
|
}
|
63
|
-
else if (installationSource.includes('create-nx-workspace')) {
|
64
|
-
return 'create-nx-workspace';
|
65
|
-
}
|
66
71
|
else {
|
67
|
-
return
|
72
|
+
return installationSource;
|
68
73
|
}
|
69
74
|
}
|
70
75
|
function getURLifShortenFailed(usesGithub, githubSlug, apiUrl, source, accessToken) {
|
@@ -13,6 +13,7 @@ const loader_1 = require("./loader");
|
|
13
13
|
const utils_1 = require("./utils");
|
14
14
|
const error_types_1 = require("../error-types");
|
15
15
|
const native_1 = require("../../native");
|
16
|
+
const os_1 = require("os");
|
16
17
|
class LoadedNxPlugin {
|
17
18
|
constructor(plugin, pluginDefinition) {
|
18
19
|
this.name = plugin.name;
|
@@ -74,7 +75,9 @@ exports.nxPluginCache = new Map();
|
|
74
75
|
async function loadNxPlugins(plugins, root = workspace_root_1.workspaceRoot) {
|
75
76
|
performance.mark('loadNxPlugins:start');
|
76
77
|
const loadingMethod = process.env.NX_ISOLATE_PLUGINS === 'true' ||
|
77
|
-
(!native_1.IS_WASM &&
|
78
|
+
(!native_1.IS_WASM &&
|
79
|
+
(0, os_1.platform)() !== 'win32' &&
|
80
|
+
process.env.NX_ISOLATE_PLUGINS !== 'false')
|
78
81
|
? isolation_1.loadNxPluginInIsolation
|
79
82
|
: loader_1.loadNxPlugin;
|
80
83
|
plugins = await normalizePlugins(plugins, root);
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import { TasksRunner } from './tasks-runner';
|
2
|
-
import { NxArgs } from '../utils/command-line-utils';
|
3
|
-
import { LifeCycle } from './life-cycle';
|
4
|
-
import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
|
5
1
|
import { NxJsonConfiguration } from '../config/nx-json';
|
2
|
+
import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
|
6
3
|
import { Task, TaskGraph } from '../config/task-graph';
|
7
4
|
import { TargetDependencyConfig } from '../config/workspace-json-project-json';
|
5
|
+
import { NxArgs } from '../utils/command-line-utils';
|
6
|
+
import { LifeCycle } from './life-cycle';
|
7
|
+
import { TasksRunner } from './tasks-runner';
|
8
8
|
export declare function runCommand(projectsToRun: ProjectGraphProjectNode[], projectGraph: ProjectGraph, { nxJson }: {
|
9
9
|
nxJson: NxJsonConfiguration;
|
10
10
|
}, nxArgs: NxArgs, overrides: any, initiatingProject: string | null, extraTargetDependencies: Record<string, (TargetDependencyConfig | string)[]>, extraOptions: {
|
@@ -5,28 +5,28 @@ exports.invokeTasksRunner = invokeTasksRunner;
|
|
5
5
|
exports.getRunner = getRunner;
|
6
6
|
exports.getRunnerOptions = getRunnerOptions;
|
7
7
|
const path_1 = require("path");
|
8
|
-
const
|
8
|
+
const nx_json_1 = require("../config/nx-json");
|
9
|
+
const client_1 = require("../daemon/client/client");
|
10
|
+
const create_task_hasher_1 = require("../hasher/create-task-hasher");
|
11
|
+
const hash_task_1 = require("../hasher/hash-task");
|
9
12
|
const fileutils_1 = require("../utils/fileutils");
|
13
|
+
const is_ci_1 = require("../utils/is-ci");
|
14
|
+
const nx_cloud_utils_1 = require("../utils/nx-cloud-utils");
|
10
15
|
const output_1 = require("../utils/output");
|
11
|
-
const
|
16
|
+
const params_1 = require("../utils/params");
|
17
|
+
const workspace_root_1 = require("../utils/workspace-root");
|
18
|
+
const create_task_graph_1 = require("./create-task-graph");
|
12
19
|
const life_cycle_1 = require("./life-cycle");
|
13
|
-
const static_run_many_terminal_output_life_cycle_1 = require("./life-cycles/static-run-many-terminal-output-life-cycle");
|
14
|
-
const static_run_one_terminal_output_life_cycle_1 = require("./life-cycles/static-run-one-terminal-output-life-cycle");
|
15
|
-
const task_timings_life_cycle_1 = require("./life-cycles/task-timings-life-cycle");
|
16
20
|
const dynamic_run_many_terminal_output_life_cycle_1 = require("./life-cycles/dynamic-run-many-terminal-output-life-cycle");
|
17
|
-
const task_profiling_life_cycle_1 = require("./life-cycles/task-profiling-life-cycle");
|
18
|
-
const is_ci_1 = require("../utils/is-ci");
|
19
21
|
const dynamic_run_one_terminal_output_life_cycle_1 = require("./life-cycles/dynamic-run-one-terminal-output-life-cycle");
|
20
|
-
const
|
21
|
-
const
|
22
|
-
const task_graph_utils_1 = require("./task-graph-utils");
|
23
|
-
const params_1 = require("../utils/params");
|
24
|
-
const hash_task_1 = require("../hasher/hash-task");
|
25
|
-
const client_1 = require("../daemon/client/client");
|
22
|
+
const static_run_many_terminal_output_life_cycle_1 = require("./life-cycles/static-run-many-terminal-output-life-cycle");
|
23
|
+
const static_run_one_terminal_output_life_cycle_1 = require("./life-cycles/static-run-one-terminal-output-life-cycle");
|
26
24
|
const store_run_information_life_cycle_1 = require("./life-cycles/store-run-information-life-cycle");
|
27
|
-
const create_task_hasher_1 = require("../hasher/create-task-hasher");
|
28
25
|
const task_history_life_cycle_1 = require("./life-cycles/task-history-life-cycle");
|
29
|
-
const
|
26
|
+
const task_profiling_life_cycle_1 = require("./life-cycles/task-profiling-life-cycle");
|
27
|
+
const task_timings_life_cycle_1 = require("./life-cycles/task-timings-life-cycle");
|
28
|
+
const task_graph_utils_1 = require("./task-graph-utils");
|
29
|
+
const utils_1 = require("./utils");
|
30
30
|
async function getTerminalOutputLifeCycle(initiatingProject, projectNames, tasks, nxArgs, nxJson, overrides) {
|
31
31
|
const { runnerOptions } = getRunner(nxArgs, nxJson);
|
32
32
|
const isRunOne = initiatingProject != null;
|
@@ -64,7 +64,7 @@ async function getTerminalOutputLifeCycle(initiatingProject, projectNames, tasks
|
|
64
64
|
}
|
65
65
|
}
|
66
66
|
}
|
67
|
-
function
|
67
|
+
function createTaskGraphAndRunValidations(projectGraph, extraTargetDependencies, projectNames, nxArgs, overrides, extraOptions) {
|
68
68
|
const taskGraph = (0, create_task_graph_1.createTaskGraph)(projectGraph, extraTargetDependencies, projectNames, nxArgs.targets, nxArgs.configuration, overrides, extraOptions.excludeTaskDependencies);
|
69
69
|
const cycle = (0, task_graph_utils_1.findCycle)(taskGraph);
|
70
70
|
if (cycle) {
|
@@ -83,12 +83,17 @@ function createTaskGraphAndValidateCycles(projectGraph, extraTargetDependencies,
|
|
83
83
|
process.exit(1);
|
84
84
|
}
|
85
85
|
}
|
86
|
+
// validate that no atomized tasks like e2e-ci are used without Nx Cloud
|
87
|
+
if (!(0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)()) &&
|
88
|
+
!process.env['NX_SKIP_ATOMIZER_VALIDATION']) {
|
89
|
+
(0, task_graph_utils_1.validateNoAtomizedTasks)(taskGraph, projectGraph);
|
90
|
+
}
|
86
91
|
return taskGraph;
|
87
92
|
}
|
88
93
|
async function runCommand(projectsToRun, projectGraph, { nxJson }, nxArgs, overrides, initiatingProject, extraTargetDependencies, extraOptions) {
|
89
94
|
const status = await (0, params_1.handleErrors)(process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
90
95
|
const projectNames = projectsToRun.map((t) => t.name);
|
91
|
-
const taskGraph =
|
96
|
+
const taskGraph = createTaskGraphAndRunValidations(projectGraph, extraTargetDependencies ?? {}, projectNames, nxArgs, overrides, extraOptions);
|
92
97
|
const tasks = Object.values(taskGraph.tasks);
|
93
98
|
const { lifeCycle, renderIsDone } = await getTerminalOutputLifeCycle(initiatingProject, projectNames, tasks, nxArgs, nxJson, overrides);
|
94
99
|
const status = await invokeTasksRunner({
|
@@ -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
|
}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { ProjectGraph } from '../config/project-graph';
|
2
|
+
import { TaskGraph } from '../config/task-graph';
|
1
3
|
export declare function findCycle(graph: {
|
2
4
|
dependencies: Record<string, string[]>;
|
3
5
|
}): string[] | null;
|
@@ -5,3 +7,4 @@ export declare function makeAcyclic(graph: {
|
|
5
7
|
roots: string[];
|
6
8
|
dependencies: Record<string, string[]>;
|
7
9
|
}): void;
|
10
|
+
export declare function validateNoAtomizedTasks(taskGraph: TaskGraph, projectGraph: ProjectGraph): void;
|
@@ -2,6 +2,8 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.findCycle = findCycle;
|
4
4
|
exports.makeAcyclic = makeAcyclic;
|
5
|
+
exports.validateNoAtomizedTasks = validateNoAtomizedTasks;
|
6
|
+
const output_1 = require("../utils/output");
|
5
7
|
function _findCycle(graph, id, visited, path) {
|
6
8
|
if (visited[id])
|
7
9
|
return null;
|
@@ -52,3 +54,35 @@ function makeAcyclic(graph) {
|
|
52
54
|
}
|
53
55
|
graph.roots = Object.keys(graph.dependencies).filter((t) => graph.dependencies[t].length === 0);
|
54
56
|
}
|
57
|
+
function validateNoAtomizedTasks(taskGraph, projectGraph) {
|
58
|
+
const getNonAtomizedTargetForTask = (task) => projectGraph.nodes[task.target.project]?.data?.targets?.[task.target.target]
|
59
|
+
?.metadata?.nonAtomizedTarget;
|
60
|
+
const atomizedRootTasks = Object.values(taskGraph.tasks).filter((task) => getNonAtomizedTargetForTask(task) !== undefined);
|
61
|
+
if (atomizedRootTasks.length === 0) {
|
62
|
+
return;
|
63
|
+
}
|
64
|
+
const nonAtomizedTasks = atomizedRootTasks
|
65
|
+
.map((t) => `"${getNonAtomizedTargetForTask(t)}"`)
|
66
|
+
.filter((item, index, arr) => arr.indexOf(item) === index);
|
67
|
+
const moreInfoLines = [
|
68
|
+
`Please enable Nx Cloud or use the slower ${nonAtomizedTasks.join(',')} task${nonAtomizedTasks.length > 1 ? 's' : ''}.`,
|
69
|
+
'Learn more at https://nx.dev/ci/features/split-e2e-tasks#nx-cloud-is-required-to-run-atomized-tasks',
|
70
|
+
];
|
71
|
+
if (atomizedRootTasks.length === 1) {
|
72
|
+
output_1.output.error({
|
73
|
+
title: `The ${atomizedRootTasks[0].id} task should only be run with Nx Cloud.`,
|
74
|
+
bodyLines: [...moreInfoLines],
|
75
|
+
});
|
76
|
+
}
|
77
|
+
else {
|
78
|
+
output_1.output.error({
|
79
|
+
title: `The following tasks should only be run with Nx Cloud:`,
|
80
|
+
bodyLines: [
|
81
|
+
...atomizedRootTasks.map((task) => ` - ${task.id}`),
|
82
|
+
'',
|
83
|
+
...moreInfoLines,
|
84
|
+
],
|
85
|
+
});
|
86
|
+
}
|
87
|
+
process.exit(1);
|
88
|
+
}
|
@@ -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[];
|