nx 18.1.0-canary.20240307-84d96cc → 18.1.0-canary.20240309-235ca8c
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/init-local.js +13 -1
- package/bin/post-install.js +7 -5
- package/package.json +12 -12
- package/src/core/graph/3rdpartylicenses.txt +0 -51
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/polyfills.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/server/plugins.d.ts +3 -0
- package/src/daemon/server/plugins.js +22 -0
- package/src/daemon/server/project-graph-incremental-recomputation.js +8 -6
- package/src/daemon/server/shutdown-utils.js +2 -0
- package/src/devkit-internals.d.ts +0 -1
- package/src/devkit-internals.js +1 -3
- package/src/executors/utils/convert-nx-executor.js +4 -1
- package/src/migrations/update-15-1-0/set-project-names.js +1 -3
- package/src/migrations/update-17-2-0/move-default-base.d.ts +1 -1
- package/src/migrations/update-17-2-0/move-default-base.js +2 -2
- package/src/project-graph/affected/locators/project-glob-changes.js +2 -1
- package/src/project-graph/build-project-graph.d.ts +2 -1
- package/src/project-graph/build-project-graph.js +5 -9
- package/src/project-graph/plugins/internal-api.d.ts +7 -3
- package/src/project-graph/plugins/internal-api.js +27 -11
- package/src/project-graph/plugins/plugin-pool.d.ts +1 -2
- package/src/project-graph/plugins/plugin-pool.js +38 -62
- package/src/project-graph/plugins/plugin-worker.js +2 -16
- package/src/project-graph/plugins/worker-api.d.ts +8 -6
- package/src/project-graph/plugins/worker-api.js +33 -15
- package/src/project-graph/project-graph.js +19 -12
- package/src/project-graph/utils/project-configuration-utils.js +1 -4
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +4 -10
- package/src/project-graph/utils/retrieve-workspace-files.js +8 -13
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +16 -13
- package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +8 -7
- package/src/utils/plugins/plugin-capabilities.js +4 -4
@@ -1,12 +1,7 @@
|
|
1
1
|
import { ProjectConfiguration } from '../../config/workspace-json-project-json';
|
2
|
-
import { PluginConfiguration } from '../../config/nx-json';
|
3
2
|
import { PackageJson } from '../../utils/package-json';
|
4
3
|
import { NxPlugin } from './public-api';
|
5
|
-
|
6
|
-
plugin: NxPlugin;
|
7
|
-
options?: unknown;
|
8
|
-
};
|
9
|
-
export declare function loadNxPluginAsync(pluginConfiguration: PluginConfiguration, paths: string[], projects: Record<string, ProjectConfiguration>, root: string): Promise<LoadedNxPlugin>;
|
4
|
+
import { PluginConfiguration } from '../../config/nx-json';
|
10
5
|
export declare function readPluginPackageJson(pluginName: string, projects: Record<string, ProjectConfiguration>, paths?: string[]): {
|
11
6
|
path: string;
|
12
7
|
json: PackageJson;
|
@@ -24,3 +19,10 @@ export declare function getPluginPathAndName(moduleName: string, paths: string[]
|
|
24
19
|
pluginPath: string;
|
25
20
|
name: any;
|
26
21
|
};
|
22
|
+
export declare function loadPlugins(plugins: PluginConfiguration[], root: string): Promise<LoadedNxPlugin[]>;
|
23
|
+
export declare function loadPlugin(plugin: PluginConfiguration, root: string): Promise<LoadedNxPlugin>;
|
24
|
+
export type LoadedNxPlugin = {
|
25
|
+
plugin: NxPlugin;
|
26
|
+
options?: unknown;
|
27
|
+
};
|
28
|
+
export declare function loadNxPluginAsync(pluginConfiguration: PluginConfiguration, paths: string[], projects: Record<string, ProjectConfiguration>, root: string): Promise<LoadedNxPlugin>;
|
@@ -1,12 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
// This file contains methods and utilities that should **only** be used by the plugin worker.
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.
|
4
|
+
exports.loadNxPluginAsync = exports.loadPlugin = exports.loadPlugins = exports.getPluginPathAndName = exports.registerPluginTSTranspiler = exports.resolveLocalNxPlugin = exports.readPluginPackageJson = void 0;
|
5
5
|
const posix_1 = require("node:path/posix");
|
6
6
|
const installation_directory_1 = require("../../utils/installation-directory");
|
7
7
|
const package_json_1 = require("../../utils/package-json");
|
8
8
|
const fileutils_1 = require("../../utils/fileutils");
|
9
|
-
const path = require("node:path/posix");
|
10
9
|
const workspace_root_1 = require("../../utils/workspace-root");
|
11
10
|
const node_fs_1 = require("node:fs");
|
12
11
|
const typescript_1 = require("../../utils/typescript");
|
@@ -15,20 +14,9 @@ const find_project_for_path_1 = require("../utils/find-project-for-path");
|
|
15
14
|
const path_1 = require("../../utils/path");
|
16
15
|
const logger_1 = require("../../utils/logger");
|
17
16
|
const node_path_1 = require("node:path");
|
17
|
+
const path = require("node:path/posix");
|
18
|
+
const retrieve_workspace_files_1 = require("../utils/retrieve-workspace-files");
|
18
19
|
const utils_1 = require("./utils");
|
19
|
-
async function loadNxPluginAsync(pluginConfiguration, paths, projects, root) {
|
20
|
-
const { plugin: moduleName, options } = typeof pluginConfiguration === 'object'
|
21
|
-
? pluginConfiguration
|
22
|
-
: { plugin: pluginConfiguration, options: undefined };
|
23
|
-
performance.mark(`Load Nx Plugin: ${moduleName} - start`);
|
24
|
-
let { pluginPath, name } = await getPluginPathAndName(moduleName, paths, projects, root);
|
25
|
-
const plugin = (0, utils_1.normalizeNxPlugin)(await importPluginModule(pluginPath));
|
26
|
-
plugin.name ??= name;
|
27
|
-
performance.mark(`Load Nx Plugin: ${moduleName} - end`);
|
28
|
-
performance.measure(`Load Nx Plugin: ${moduleName}`, `Load Nx Plugin: ${moduleName} - start`, `Load Nx Plugin: ${moduleName} - end`);
|
29
|
-
return { plugin, options };
|
30
|
-
}
|
31
|
-
exports.loadNxPluginAsync = loadNxPluginAsync;
|
32
20
|
function readPluginPackageJson(pluginName, projects, paths = (0, installation_directory_1.getNxRequirePaths)()) {
|
33
21
|
try {
|
34
22
|
const result = (0, package_json_1.readModulePackageJsonWithoutFallbacks)(pluginName, paths);
|
@@ -167,6 +155,36 @@ function getPluginPathAndName(moduleName, paths, projects, root) {
|
|
167
155
|
return { pluginPath, name };
|
168
156
|
}
|
169
157
|
exports.getPluginPathAndName = getPluginPathAndName;
|
158
|
+
let projectsWithoutInference;
|
159
|
+
async function loadPlugins(plugins, root) {
|
160
|
+
return await Promise.all(plugins.map((p) => loadPlugin(p, root)));
|
161
|
+
}
|
162
|
+
exports.loadPlugins = loadPlugins;
|
163
|
+
async function loadPlugin(plugin, root) {
|
164
|
+
try {
|
165
|
+
require.resolve(typeof plugin === 'string' ? plugin : plugin.plugin);
|
166
|
+
}
|
167
|
+
catch {
|
168
|
+
// If a plugin cannot be resolved, we will need projects to resolve it
|
169
|
+
projectsWithoutInference ??=
|
170
|
+
await (0, retrieve_workspace_files_1.retrieveProjectConfigurationsWithoutPluginInference)(root);
|
171
|
+
}
|
172
|
+
return await loadNxPluginAsync(plugin, (0, installation_directory_1.getNxRequirePaths)(root), projectsWithoutInference, root);
|
173
|
+
}
|
174
|
+
exports.loadPlugin = loadPlugin;
|
175
|
+
async function loadNxPluginAsync(pluginConfiguration, paths, projects, root) {
|
176
|
+
const { plugin: moduleName, options } = typeof pluginConfiguration === 'object'
|
177
|
+
? pluginConfiguration
|
178
|
+
: { plugin: pluginConfiguration, options: undefined };
|
179
|
+
performance.mark(`Load Nx Plugin: ${moduleName} - start`);
|
180
|
+
let { pluginPath, name } = await getPluginPathAndName(moduleName, paths, projects, root);
|
181
|
+
const plugin = (0, utils_1.normalizeNxPlugin)(await importPluginModule(pluginPath));
|
182
|
+
plugin.name ??= name;
|
183
|
+
performance.mark(`Load Nx Plugin: ${moduleName} - end`);
|
184
|
+
performance.measure(`Load Nx Plugin: ${moduleName}`, `Load Nx Plugin: ${moduleName} - start`, `Load Nx Plugin: ${moduleName} - end`);
|
185
|
+
return { plugin, options };
|
186
|
+
}
|
187
|
+
exports.loadNxPluginAsync = loadNxPluginAsync;
|
170
188
|
async function importPluginModule(pluginPath) {
|
171
189
|
const m = await Promise.resolve(`${pluginPath}`).then(s => require(s));
|
172
190
|
if (m.default &&
|
@@ -12,6 +12,7 @@ const workspace_root_1 = require("../utils/workspace-root");
|
|
12
12
|
const perf_hooks_1 = require("perf_hooks");
|
13
13
|
const retrieve_workspace_files_1 = require("./utils/retrieve-workspace-files");
|
14
14
|
const nx_json_1 = require("../config/nx-json");
|
15
|
+
const internal_api_1 = require("./plugins/internal-api");
|
15
16
|
/**
|
16
17
|
* Synchronously reads the latest cached copy of the workspace's ProjectGraph.
|
17
18
|
* @throws {Error} if there is no cached ProjectGraph to read from
|
@@ -67,18 +68,24 @@ exports.readProjectsConfigurationFromProjectGraph = readProjectsConfigurationFro
|
|
67
68
|
async function buildProjectGraphAndSourceMapsWithoutDaemon() {
|
68
69
|
global.NX_GRAPH_CREATION = true;
|
69
70
|
const nxJson = (0, nx_json_1.readNxJson)();
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
71
|
+
const [plugins, cleanup] = await (0, internal_api_1.loadNxPluginsInIsolation)(nxJson.plugins);
|
72
|
+
try {
|
73
|
+
perf_hooks_1.performance.mark('retrieve-project-configurations:start');
|
74
|
+
const { projects, externalNodes, sourceMaps, projectRootMap } = await (0, retrieve_workspace_files_1.retrieveProjectConfigurations)(plugins, workspace_root_1.workspaceRoot, nxJson);
|
75
|
+
perf_hooks_1.performance.mark('retrieve-project-configurations:end');
|
76
|
+
perf_hooks_1.performance.mark('retrieve-workspace-files:start');
|
77
|
+
const { allWorkspaceFiles, fileMap, rustReferences } = await (0, retrieve_workspace_files_1.retrieveWorkspaceFiles)(workspace_root_1.workspaceRoot, projectRootMap);
|
78
|
+
perf_hooks_1.performance.mark('retrieve-workspace-files:end');
|
79
|
+
const cacheEnabled = process.env.NX_CACHE_PROJECT_GRAPH !== 'false';
|
80
|
+
perf_hooks_1.performance.mark('build-project-graph-using-project-file-map:start');
|
81
|
+
const projectGraph = (await (0, build_project_graph_1.buildProjectGraphUsingProjectFileMap)(projects, externalNodes, fileMap, allWorkspaceFiles, rustReferences, cacheEnabled ? (0, nx_deps_cache_1.readFileMapCache)() : null, cacheEnabled, plugins)).projectGraph;
|
82
|
+
perf_hooks_1.performance.mark('build-project-graph-using-project-file-map:end');
|
83
|
+
delete global.NX_GRAPH_CREATION;
|
84
|
+
return { projectGraph, sourceMaps };
|
85
|
+
}
|
86
|
+
finally {
|
87
|
+
cleanup();
|
88
|
+
}
|
82
89
|
}
|
83
90
|
exports.buildProjectGraphAndSourceMapsWithoutDaemon = buildProjectGraphAndSourceMapsWithoutDaemon;
|
84
91
|
function handleProjectGraphError(opts, e) {
|
@@ -8,7 +8,6 @@ const target_defaults_plugin_1 = require("../../plugins/target-defaults/target-d
|
|
8
8
|
const minimatch_1 = require("minimatch");
|
9
9
|
const path_1 = require("path");
|
10
10
|
const utils_1 = require("../plugins/utils");
|
11
|
-
const plugin_pool_1 = require("../plugins/plugin-pool");
|
12
11
|
function mergeProjectConfigurationIntoRootMap(projectRootMap, project, configurationSourceMaps, sourceInformation,
|
13
12
|
// This function is used when reading project configuration
|
14
13
|
// in generators, where we don't want to do this.
|
@@ -149,9 +148,7 @@ plugins, root = workspace_root_1.workspaceRoot) {
|
|
149
148
|
let r = createNodes(matchedFiles, {
|
150
149
|
nxJsonConfiguration: nxJson,
|
151
150
|
workspaceRoot: root,
|
152
|
-
})
|
153
|
-
throw e;
|
154
|
-
}));
|
151
|
+
});
|
155
152
|
results.push(r);
|
156
153
|
}
|
157
154
|
return Promise.all(results).then((results) => {
|
@@ -3,6 +3,7 @@ import { NxJsonConfiguration } from '../../config/nx-json';
|
|
3
3
|
import { ProjectGraphExternalNode } from '../../config/project-graph';
|
4
4
|
import { ConfigurationSourceMaps } from './project-configuration-utils';
|
5
5
|
import { RemotePlugin } from '../plugins/internal-api';
|
6
|
+
import { NxPlugin } from '../plugins';
|
6
7
|
/**
|
7
8
|
* Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
|
8
9
|
* @throws
|
@@ -19,11 +20,8 @@ export declare function retrieveWorkspaceFiles(workspaceRoot: string, projectRoo
|
|
19
20
|
}>;
|
20
21
|
/**
|
21
22
|
* Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
|
22
|
-
*
|
23
|
-
* @param workspaceRoot
|
24
|
-
* @param nxJson
|
25
23
|
*/
|
26
|
-
export declare function retrieveProjectConfigurations(workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<RetrievedGraphNodes>;
|
24
|
+
export declare function retrieveProjectConfigurations(plugins: RemotePlugin[], workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<RetrievedGraphNodes>;
|
27
25
|
export declare function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<RetrievedGraphNodes>;
|
28
26
|
export type RetrievedGraphNodes = {
|
29
27
|
externalNodes: Record<string, ProjectGraphExternalNode>;
|
@@ -31,11 +29,7 @@ export type RetrievedGraphNodes = {
|
|
31
29
|
sourceMaps: ConfigurationSourceMaps;
|
32
30
|
projectRootMap: Record<string, string>;
|
33
31
|
};
|
34
|
-
export declare function retrieveProjectConfigurationPaths(root: string, plugins:
|
32
|
+
export declare function retrieveProjectConfigurationPaths(root: string, plugins: NxPlugin[]): string[];
|
35
33
|
export declare function retrieveProjectConfigurationsWithoutPluginInference(root: string): Promise<Record<string, ProjectConfiguration>>;
|
36
34
|
export declare function createProjectConfigurations(workspaceRoot: string, nxJson: NxJsonConfiguration, configFiles: string[], plugins: RemotePlugin[]): Promise<RetrievedGraphNodes>;
|
37
|
-
|
38
|
-
createNodes?: readonly [string, ...unknown[]];
|
39
|
-
}>;
|
40
|
-
export declare function configurationGlobs(plugins: PluginGlobsOnly): string[];
|
41
|
-
export {};
|
35
|
+
export declare function configurationGlobs(plugins: Array<NxPlugin>): string[];
|
@@ -9,7 +9,6 @@ const internal_api_1 = require("../plugins/internal-api");
|
|
9
9
|
const workspace_context_1 = require("../../utils/workspace-context");
|
10
10
|
const build_all_workspace_files_1 = require("./build-all-workspace-files");
|
11
11
|
const path_1 = require("path");
|
12
|
-
const plugin_pool_1 = require("../plugins/plugin-pool");
|
13
12
|
/**
|
14
13
|
* Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
|
15
14
|
* @throws
|
@@ -36,16 +35,9 @@ async function retrieveWorkspaceFiles(workspaceRoot, projectRootMap) {
|
|
36
35
|
exports.retrieveWorkspaceFiles = retrieveWorkspaceFiles;
|
37
36
|
/**
|
38
37
|
* Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
|
39
|
-
*
|
40
|
-
* @param workspaceRoot
|
41
|
-
* @param nxJson
|
42
38
|
*/
|
43
|
-
async function retrieveProjectConfigurations(workspaceRoot, nxJson) {
|
44
|
-
const plugins = await (0, internal_api_1.loadNxPlugins)(nxJson?.plugins ?? [], workspaceRoot);
|
39
|
+
async function retrieveProjectConfigurations(plugins, workspaceRoot, nxJson) {
|
45
40
|
const projects = await _retrieveProjectConfigurations(workspaceRoot, nxJson, plugins);
|
46
|
-
if (!global.NX_GRAPH_CREATION) {
|
47
|
-
await (0, plugin_pool_1.shutdownPluginWorkers)();
|
48
|
-
}
|
49
41
|
return projects;
|
50
42
|
}
|
51
43
|
exports.retrieveProjectConfigurations = retrieveProjectConfigurations;
|
@@ -56,8 +48,10 @@ async function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot, n
|
|
56
48
|
(typeof p === 'object' && p.plugin === angular_json_1.NX_ANGULAR_JSON_PLUGIN_NAME))) {
|
57
49
|
pluginsToLoad.push((0, path_1.join)(__dirname, '../../adapter/angular-json'));
|
58
50
|
}
|
59
|
-
const plugins = await (0, internal_api_1.
|
60
|
-
|
51
|
+
const [plugins, cleanup] = await (0, internal_api_1.loadNxPluginsInIsolation)(nxJson?.plugins ?? [], workspaceRoot);
|
52
|
+
const res = _retrieveProjectConfigurations(workspaceRoot, nxJson, await plugins);
|
53
|
+
cleanup();
|
54
|
+
return res;
|
61
55
|
}
|
62
56
|
exports.retrieveProjectConfigurationsWithAngularProjects = retrieveProjectConfigurationsWithAngularProjects;
|
63
57
|
function _retrieveProjectConfigurations(workspaceRoot, nxJson, plugins) {
|
@@ -74,7 +68,7 @@ const projectsWithoutPluginCache = new Map();
|
|
74
68
|
// TODO: This function is called way too often, it should be optimized without this cache
|
75
69
|
async function retrieveProjectConfigurationsWithoutPluginInference(root) {
|
76
70
|
const nxJson = (0, nx_json_1.readNxJson)(root);
|
77
|
-
const plugins = await (0, internal_api_1.
|
71
|
+
const [plugins, cleanup] = await (0, internal_api_1.loadNxPluginsInIsolation)([]); // only load default plugins
|
78
72
|
const projectGlobPatterns = retrieveProjectConfigurationPaths(root, plugins);
|
79
73
|
const cacheKey = root + ',' + projectGlobPatterns.join(',');
|
80
74
|
if (projectsWithoutPluginCache.has(cacheKey)) {
|
@@ -83,6 +77,7 @@ async function retrieveProjectConfigurationsWithoutPluginInference(root) {
|
|
83
77
|
const projectFiles = (0, workspace_context_1.globWithWorkspaceContext)(root, projectGlobPatterns);
|
84
78
|
const { projects } = await createProjectConfigurations(root, nxJson, projectFiles, plugins);
|
85
79
|
projectsWithoutPluginCache.set(cacheKey, projects);
|
80
|
+
cleanup();
|
86
81
|
return projects;
|
87
82
|
}
|
88
83
|
exports.retrieveProjectConfigurationsWithoutPluginInference = retrieveProjectConfigurationsWithoutPluginInference;
|
@@ -102,7 +97,7 @@ exports.createProjectConfigurations = createProjectConfigurations;
|
|
102
97
|
function configurationGlobs(plugins) {
|
103
98
|
const globPatterns = [];
|
104
99
|
for (const plugin of plugins) {
|
105
|
-
if (plugin.createNodes) {
|
100
|
+
if ('createNodes' in plugin && plugin.createNodes) {
|
106
101
|
globPatterns.push(plugin.createNodes[0]);
|
107
102
|
}
|
108
103
|
}
|
@@ -9,8 +9,9 @@ const output_1 = require("../../utils/output");
|
|
9
9
|
const pretty_time_1 = require("./pretty-time");
|
10
10
|
const formatting_utils_1 = require("./formatting-utils");
|
11
11
|
const view_logs_utils_1 = require("./view-logs-utils");
|
12
|
-
const LEFT_PAD = `
|
13
|
-
const
|
12
|
+
const LEFT_PAD = ` `;
|
13
|
+
const SPACER = ` `;
|
14
|
+
const EXTENDED_LEFT_PAD = ` `;
|
14
15
|
/**
|
15
16
|
* The following function is responsible for creating a life cycle with dynamic
|
16
17
|
* outputs, meaning previous outputs can be rewritten or modified as new outputs
|
@@ -92,7 +93,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
92
93
|
switch (status) {
|
93
94
|
case 'local-cache':
|
94
95
|
writeCompletedTaskResultLine(`${output_1.output.colors.green(figures.tick) +
|
95
|
-
|
96
|
+
SPACER +
|
96
97
|
output_1.output.formatCommand(task.id)} ${output_1.output.dim('[local cache]')}`);
|
97
98
|
if (isVerbose) {
|
98
99
|
writeCommandOutputBlock(tasksToTerminalOutputs[task.id]);
|
@@ -100,7 +101,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
100
101
|
break;
|
101
102
|
case 'local-cache-kept-existing':
|
102
103
|
writeCompletedTaskResultLine(`${output_1.output.colors.green(figures.tick) +
|
103
|
-
|
104
|
+
SPACER +
|
104
105
|
output_1.output.formatCommand(task.id)} ${output_1.output.dim('[existing outputs match the cache, left as is]')}`);
|
105
106
|
if (isVerbose) {
|
106
107
|
writeCommandOutputBlock(tasksToTerminalOutputs[task.id]);
|
@@ -108,7 +109,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
108
109
|
break;
|
109
110
|
case 'remote-cache':
|
110
111
|
writeCompletedTaskResultLine(`${output_1.output.colors.green(figures.tick) +
|
111
|
-
|
112
|
+
SPACER +
|
112
113
|
output_1.output.formatCommand(task.id)} ${output_1.output.dim('[remote cache]')}`);
|
113
114
|
if (isVerbose) {
|
114
115
|
writeCommandOutputBlock(tasksToTerminalOutputs[task.id]);
|
@@ -117,7 +118,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
117
118
|
case 'success': {
|
118
119
|
const timeTakenText = (0, pretty_time_1.prettyTime)(process.hrtime(tasksToProcessStartTimes[task.id]));
|
119
120
|
writeCompletedTaskResultLine(output_1.output.colors.green(figures.tick) +
|
120
|
-
|
121
|
+
SPACER +
|
121
122
|
output_1.output.formatCommand(task.id) +
|
122
123
|
output_1.output.dim(` (${timeTakenText})`));
|
123
124
|
if (isVerbose) {
|
@@ -126,9 +127,10 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
126
127
|
break;
|
127
128
|
}
|
128
129
|
case 'failure':
|
130
|
+
output_1.output.addNewline();
|
129
131
|
output_1.output.addNewline();
|
130
132
|
writeCompletedTaskResultLine(output_1.output.colors.red(figures.cross) +
|
131
|
-
|
133
|
+
SPACER +
|
132
134
|
output_1.output.formatCommand(output_1.output.colors.red(task.id)));
|
133
135
|
writeCommandOutputBlock(tasksToTerminalOutputs[task.id]);
|
134
136
|
break;
|
@@ -145,10 +147,10 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
145
147
|
const runningTasks = taskRows.filter((row) => row.status === 'running');
|
146
148
|
const remainingTasks = totalTasks - totalCompletedTasks;
|
147
149
|
if (runningTasks.length > 0) {
|
148
|
-
additionalFooterRows.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.colors.cyan(figures.arrowRight)}
|
150
|
+
additionalFooterRows.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.colors.cyan(figures.arrowRight)}${SPACER}Executing ${runningTasks.length}/${remainingTasks} remaining tasks${runningTasks.length > 1 ? ' in parallel' : ''}...`));
|
149
151
|
additionalFooterRows.push('');
|
150
152
|
for (const runningTask of runningTasks) {
|
151
|
-
additionalFooterRows.push(`${LEFT_PAD}${output_1.output.dim.cyan(cli_spinners_1.dots.frames[currentFrame])}
|
153
|
+
additionalFooterRows.push(`${LEFT_PAD}${output_1.output.dim.cyan(cli_spinners_1.dots.frames[currentFrame])}${SPACER}${output_1.output.formatCommand(runningTask.task.id)}`);
|
152
154
|
}
|
153
155
|
/**
|
154
156
|
* Reduce layout thrashing by ensuring that there is a relatively consistent
|
@@ -172,10 +174,10 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
172
174
|
additionalFooterRows.push('');
|
173
175
|
}
|
174
176
|
if (totalSuccessfulTasks > 0) {
|
175
|
-
additionalFooterRows.push(`${LEFT_PAD}${output_1.output.colors.green(figures.tick)}
|
177
|
+
additionalFooterRows.push(`${LEFT_PAD}${output_1.output.colors.green(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`);
|
176
178
|
}
|
177
179
|
if (totalFailedTasks > 0) {
|
178
|
-
additionalFooterRows.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}
|
180
|
+
additionalFooterRows.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} failed`);
|
179
181
|
}
|
180
182
|
moveCursorToStartOfPinnedFooter();
|
181
183
|
if (additionalFooterRows.length > 1) {
|
@@ -253,9 +255,10 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
253
255
|
output_1.output.applyNxPrefix('red', output_1.output.colors.red(text) + output_1.output.dim.white(` (${timeTakenText})`)),
|
254
256
|
...taskOverridesRows,
|
255
257
|
'',
|
256
|
-
output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}
|
258
|
+
output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`),
|
259
|
+
'',
|
260
|
+
`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} targets failed, including the following:`,
|
257
261
|
'',
|
258
|
-
`${LEFT_PAD}${output_1.output.colors.red(figures.cross)} ${totalFailedTasks}${`/${totalCompletedTasks}`} targets failed, including the following:`,
|
259
262
|
`${failedTasksForPrinting
|
260
263
|
.map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
|
261
264
|
.join('\n ')}`,
|
@@ -9,8 +9,9 @@ const output_1 = require("../../utils/output");
|
|
9
9
|
const pretty_time_1 = require("./pretty-time");
|
10
10
|
const formatting_utils_1 = require("./formatting-utils");
|
11
11
|
const view_logs_utils_1 = require("./view-logs-utils");
|
12
|
-
const LEFT_PAD = `
|
13
|
-
const
|
12
|
+
const LEFT_PAD = ` `;
|
13
|
+
const SPACER = ` `;
|
14
|
+
const EXTENDED_LEFT_PAD = ` `;
|
14
15
|
/**
|
15
16
|
* The following function is responsible for creating a life cycle with dynamic
|
16
17
|
* outputs, meaning previous outputs can be rewritten or modified as new outputs
|
@@ -88,7 +89,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
88
89
|
switch (state) {
|
89
90
|
case 'EXECUTING_DEPENDENT_TARGETS':
|
90
91
|
if (totalFailedTasks === 0) {
|
91
|
-
linesToRender.push(`${LEFT_PAD}${output_1.output.colors.cyan(cli_spinners_1.dots.frames[dependentTargetsCurrentFrame])}
|
92
|
+
linesToRender.push(`${LEFT_PAD}${output_1.output.colors.cyan(cli_spinners_1.dots.frames[dependentTargetsCurrentFrame])}${SPACER}${output_1.output.dim(`Nx is waiting on ${remainingDependentTasksNotFromInitiatingProject} dependent project tasks before running tasks from`)} ${initiatingProject}${output_1.output.dim('...')}`);
|
92
93
|
if (totalSuccessfulTasks > 0) {
|
93
94
|
linesToRender.push('');
|
94
95
|
}
|
@@ -96,10 +97,10 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
96
97
|
break;
|
97
98
|
}
|
98
99
|
if (totalFailedTasks > 0) {
|
99
|
-
linesToRender.push(output_1.output.colors.red.dim(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}
|
100
|
+
linesToRender.push(output_1.output.colors.red.dim(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} dependent project tasks failed (see below)`));
|
100
101
|
}
|
101
102
|
if (totalSuccessfulTasks > 0) {
|
102
|
-
linesToRender.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}
|
103
|
+
linesToRender.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} dependent project tasks succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`));
|
103
104
|
}
|
104
105
|
moveCursorToStartOfDependentTargetLines();
|
105
106
|
if (linesToRender.length > 1) {
|
@@ -212,8 +213,8 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
212
213
|
output_1.output.applyNxPrefix('red', output_1.output.colors.red(text) + output_1.output.dim(` (${timeTakenText})`)),
|
213
214
|
...taskOverridesLines,
|
214
215
|
'',
|
215
|
-
`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}
|
216
|
-
`${LEFT_PAD}${output_1.output.dim(figures.tick)}
|
216
|
+
`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} failed`,
|
217
|
+
`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`,
|
217
218
|
...viewLogs,
|
218
219
|
], 'red');
|
219
220
|
}
|
@@ -4,7 +4,7 @@ exports.listPluginCapabilities = exports.getPluginCapabilities = void 0;
|
|
4
4
|
const chalk = require("chalk");
|
5
5
|
const path_1 = require("path");
|
6
6
|
const plugins_1 = require("../../project-graph/plugins");
|
7
|
-
const
|
7
|
+
const internal_api_1 = require("../../project-graph/plugins/internal-api");
|
8
8
|
const fileutils_1 = require("../fileutils");
|
9
9
|
const installation_directory_1 = require("../installation-directory");
|
10
10
|
const output_1 = require("../output");
|
@@ -27,7 +27,7 @@ async function getPluginCapabilities(workspaceRoot, pluginName, projects, includ
|
|
27
27
|
try {
|
28
28
|
const { json: packageJson, path: packageJsonPath } = await (0, plugins_1.readPluginPackageJson)(pluginName, projects, (0, installation_directory_1.getNxRequirePaths)(workspaceRoot));
|
29
29
|
const pluginModule = includeRuntimeCapabilities
|
30
|
-
? await tryGetModule(packageJson, workspaceRoot
|
30
|
+
? await tryGetModule(packageJson, workspaceRoot)
|
31
31
|
: {};
|
32
32
|
return {
|
33
33
|
name: pluginName,
|
@@ -57,14 +57,14 @@ async function getPluginCapabilities(workspaceRoot, pluginName, projects, includ
|
|
57
57
|
}
|
58
58
|
}
|
59
59
|
exports.getPluginCapabilities = getPluginCapabilities;
|
60
|
-
async function tryGetModule(packageJson, workspaceRoot
|
60
|
+
async function tryGetModule(packageJson, workspaceRoot) {
|
61
61
|
try {
|
62
62
|
return (packageJson.generators ??
|
63
63
|
packageJson.executors ??
|
64
64
|
packageJson['nx-migrations'] ??
|
65
65
|
packageJson['schematics'] ??
|
66
66
|
packageJson['builders'])
|
67
|
-
? await (0,
|
67
|
+
? (await (0, internal_api_1.loadPlugin)(packageJson.name, workspaceRoot)).plugin
|
68
68
|
: {
|
69
69
|
name: packageJson.name,
|
70
70
|
};
|