nx 21.0.0-beta.7 → 21.0.0-beta.8
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/package.json +11 -11
- package/schemas/project-schema.json +5 -0
- package/src/command-line/run/executor-utils.d.ts +6 -1
- package/src/command-line/run/executor-utils.js +10 -1
- package/src/command-line/run/run.js +1 -1
- package/src/config/misc-interfaces.d.ts +1 -0
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.css +1 -1
- package/src/devkit-internals.d.ts +1 -1
- package/src/devkit-internals.js +2 -1
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/plugins/package-json/create-nodes.js +1 -1
- package/src/project-graph/plugins/public-api.d.ts +1 -1
- package/src/project-graph/utils/project-configuration-utils.d.ts +2 -2
- package/src/project-graph/utils/project-configuration-utils.js +29 -10
- package/src/tasks-runner/batch/run-batch.js +1 -1
- package/src/tasks-runner/create-task-graph.d.ts +0 -1
- package/src/tasks-runner/create-task-graph.js +0 -1
- package/src/tasks-runner/init-tasks-runner.d.ts +1 -1
- package/src/tasks-runner/init-tasks-runner.js +8 -2
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +2 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +8 -5
- package/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +5 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle.js +29 -4
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +2 -0
- package/src/tasks-runner/run-command.d.ts +1 -0
- package/src/tasks-runner/run-command.js +4 -6
- package/src/tasks-runner/task-orchestrator.d.ts +2 -1
- package/src/tasks-runner/task-orchestrator.js +9 -6
- package/src/tasks-runner/utils.js +1 -1
- package/src/utils/package-json.d.ts +1 -1
- package/src/utils/package-json.js +16 -2
@@ -7,6 +7,7 @@ const formatting_utils_1 = require("./formatting-utils");
|
|
7
7
|
const pretty_time_1 = require("./pretty-time");
|
8
8
|
const view_logs_utils_1 = require("./view-logs-utils");
|
9
9
|
const figures = require("figures");
|
10
|
+
const task_history_life_cycle_1 = require("./task-history-life-cycle");
|
10
11
|
const LEFT_PAD = ` `;
|
11
12
|
const SPACER = ` `;
|
12
13
|
const EXTENDED_LEFT_PAD = ` `;
|
@@ -78,6 +79,7 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, args, overrides,
|
|
78
79
|
else {
|
79
80
|
printRunManySummary();
|
80
81
|
}
|
82
|
+
(0, task_history_life_cycle_1.getTasksHistoryLifeCycle)()?.printFlakyTasksMessage();
|
81
83
|
};
|
82
84
|
const printRunOneSummary = () => {
|
83
85
|
let lines = [];
|
@@ -17,6 +17,7 @@ export declare function runCommandForTasks(projectsToRun: ProjectGraphProjectNod
|
|
17
17
|
excludeTaskDependencies: boolean;
|
18
18
|
loadDotEnvFiles: boolean;
|
19
19
|
}): Promise<TaskResults>;
|
20
|
+
export declare function setEnvVarsBasedOnArgs(nxArgs: NxArgs, loadDotEnvFiles: boolean): void;
|
20
21
|
export declare function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nxJson, nxArgs, loadDotEnvFiles, initiatingProject, initiatingTasks, }: {
|
21
22
|
tasks: Task[];
|
22
23
|
projectGraph: ProjectGraph;
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.runCommand = runCommand;
|
4
4
|
exports.runCommandForTasks = runCommandForTasks;
|
5
|
+
exports.setEnvVarsBasedOnArgs = setEnvVarsBasedOnArgs;
|
5
6
|
exports.invokeTasksRunner = invokeTasksRunner;
|
6
7
|
exports.constructLifeCycles = constructLifeCycles;
|
7
8
|
exports.getRunner = getRunner;
|
@@ -14,7 +15,6 @@ const nx_json_1 = require("../config/nx-json");
|
|
14
15
|
const client_1 = require("../daemon/client/client");
|
15
16
|
const create_task_hasher_1 = require("../hasher/create-task-hasher");
|
16
17
|
const hash_task_1 = require("../hasher/hash-task");
|
17
|
-
const native_1 = require("../native");
|
18
18
|
const tasks_execution_hooks_1 = require("../project-graph/plugins/tasks-execution-hooks");
|
19
19
|
const project_graph_1 = require("../project-graph/project-graph");
|
20
20
|
const fileutils_1 = require("../utils/fileutils");
|
@@ -34,7 +34,6 @@ const static_run_many_terminal_output_life_cycle_1 = require("./life-cycles/stat
|
|
34
34
|
const static_run_one_terminal_output_life_cycle_1 = require("./life-cycles/static-run-one-terminal-output-life-cycle");
|
35
35
|
const store_run_information_life_cycle_1 = require("./life-cycles/store-run-information-life-cycle");
|
36
36
|
const task_history_life_cycle_1 = require("./life-cycles/task-history-life-cycle");
|
37
|
-
const task_history_life_cycle_old_1 = require("./life-cycles/task-history-life-cycle-old");
|
38
37
|
const task_profiling_life_cycle_1 = require("./life-cycles/task-profiling-life-cycle");
|
39
38
|
const task_results_life_cycle_1 = require("./life-cycles/task-results-life-cycle");
|
40
39
|
const task_timings_life_cycle_1 = require("./life-cycles/task-timings-life-cycle");
|
@@ -633,10 +632,9 @@ function constructLifeCycles(lifeCycle) {
|
|
633
632
|
if (process.env.NX_PROFILE) {
|
634
633
|
lifeCycles.push(new task_profiling_life_cycle_1.TaskProfilingLifeCycle(process.env.NX_PROFILE));
|
635
634
|
}
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
: new task_history_life_cycle_old_1.LegacyTaskHistoryLifeCycle());
|
635
|
+
const historyLifeCycle = (0, task_history_life_cycle_1.getTasksHistoryLifeCycle)();
|
636
|
+
if (historyLifeCycle) {
|
637
|
+
lifeCycles.push(historyLifeCycle);
|
640
638
|
}
|
641
639
|
return lifeCycles;
|
642
640
|
}
|
@@ -42,7 +42,8 @@ export declare class TaskOrchestrator {
|
|
42
42
|
[id: string]: TaskStatus;
|
43
43
|
}>;
|
44
44
|
private executeNextBatchOfTasksUsingTaskSchedule;
|
45
|
-
|
45
|
+
processTasks(taskIds: string[]): void;
|
46
|
+
private processTask;
|
46
47
|
private processScheduledBatch;
|
47
48
|
private processAllScheduledTasks;
|
48
49
|
private applyCachedResults;
|
@@ -124,6 +124,14 @@ class TaskOrchestrator {
|
|
124
124
|
// block until some other task completes, then try again
|
125
125
|
return new Promise((res) => this.waitingForTasks.push(res)).then(() => this.executeNextBatchOfTasksUsingTaskSchedule());
|
126
126
|
}
|
127
|
+
processTasks(taskIds) {
|
128
|
+
for (const taskId of taskIds) {
|
129
|
+
// Task is already handled or being handled
|
130
|
+
if (!this.processedTasks.has(taskId)) {
|
131
|
+
this.processedTasks.set(taskId, this.processTask(taskId));
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
127
135
|
// region Processing Scheduled Tasks
|
128
136
|
async processTask(taskId) {
|
129
137
|
const task = this.taskGraph.tasks[taskId];
|
@@ -147,12 +155,7 @@ class TaskOrchestrator {
|
|
147
155
|
for (const batch of scheduledBatches) {
|
148
156
|
this.processedBatches.set(batch, this.processScheduledBatch(batch));
|
149
157
|
}
|
150
|
-
|
151
|
-
// Task is already handled or being handled
|
152
|
-
if (!this.processedTasks.has(taskId)) {
|
153
|
-
this.processedTasks.set(taskId, this.processTask(taskId));
|
154
|
-
}
|
155
|
-
}
|
158
|
+
this.processTasks(scheduledTasks);
|
156
159
|
}
|
157
160
|
// endregion Processing Scheduled Tasks
|
158
161
|
// region Applying Cache
|
@@ -294,7 +294,7 @@ function getExecutorNameForTask(task, projectGraph) {
|
|
294
294
|
}
|
295
295
|
function getExecutorForTask(task, projectGraph) {
|
296
296
|
const executor = getExecutorNameForTask(task, projectGraph);
|
297
|
-
const [nodeModule, executorName] =
|
297
|
+
const [nodeModule, executorName] = (0, executor_utils_1.parseExecutor)(executor);
|
298
298
|
return (0, executor_utils_1.getExecutorInformation)(nodeModule, executorName, workspace_root_1.workspaceRoot, (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph).projects);
|
299
299
|
}
|
300
300
|
function getCustomHasher(task, projectGraph) {
|
@@ -74,7 +74,7 @@ export declare function readNxMigrateConfig(json: Partial<PackageJson>): NxMigra
|
|
74
74
|
export declare function buildTargetFromScript(script: string, scripts: Record<string, string>, packageManagerCommand: PackageManagerCommands): TargetConfiguration;
|
75
75
|
export declare function getMetadataFromPackageJson(packageJson: PackageJson, isInPackageManagerWorkspaces: boolean): ProjectMetadata;
|
76
76
|
export declare function getTagsFromPackageJson(packageJson: PackageJson): string[];
|
77
|
-
export declare function readTargetsFromPackageJson(packageJson: PackageJson, nxJson: NxJsonConfiguration): Record<string, TargetConfiguration<any>>;
|
77
|
+
export declare function readTargetsFromPackageJson(packageJson: PackageJson, nxJson: NxJsonConfiguration, projectRoot: string, workspaceRoot: string): Record<string, TargetConfiguration<any>>;
|
78
78
|
/**
|
79
79
|
* Uses `require.resolve` to read the package.json for a module.
|
80
80
|
*
|
@@ -83,7 +83,7 @@ function getTagsFromPackageJson(packageJson) {
|
|
83
83
|
}
|
84
84
|
return tags;
|
85
85
|
}
|
86
|
-
function readTargetsFromPackageJson(packageJson, nxJson) {
|
86
|
+
function readTargetsFromPackageJson(packageJson, nxJson, projectRoot, workspaceRoot) {
|
87
87
|
const { scripts, nx, private: isPrivate } = packageJson ?? {};
|
88
88
|
const res = {};
|
89
89
|
const includedScripts = nx?.includedScripts || Object.keys(scripts ?? {});
|
@@ -102,7 +102,9 @@ function readTargetsFromPackageJson(packageJson, nxJson) {
|
|
102
102
|
* Any targetDefaults for the nx-release-publish target set by the user should
|
103
103
|
* be merged with the implicit target.
|
104
104
|
*/
|
105
|
-
if (!isPrivate &&
|
105
|
+
if (!isPrivate &&
|
106
|
+
!res['nx-release-publish'] &&
|
107
|
+
hasNxJsPlugin(projectRoot, workspaceRoot)) {
|
106
108
|
const nxReleasePublishTargetDefaults = nxJson?.targetDefaults?.['nx-release-publish'] ?? {};
|
107
109
|
res['nx-release-publish'] = {
|
108
110
|
executor: '@nx/js:release-publish',
|
@@ -119,6 +121,18 @@ function readTargetsFromPackageJson(packageJson, nxJson) {
|
|
119
121
|
}
|
120
122
|
return res;
|
121
123
|
}
|
124
|
+
function hasNxJsPlugin(projectRoot, workspaceRoot) {
|
125
|
+
try {
|
126
|
+
// nx-ignore-next-line
|
127
|
+
require.resolve('@nx/js', {
|
128
|
+
paths: [projectRoot, ...(0, installation_directory_1.getNxRequirePaths)(workspaceRoot), __dirname],
|
129
|
+
});
|
130
|
+
return true;
|
131
|
+
}
|
132
|
+
catch {
|
133
|
+
return false;
|
134
|
+
}
|
135
|
+
}
|
122
136
|
/**
|
123
137
|
* Uses `require.resolve` to read the package.json for a module.
|
124
138
|
*
|