nx 22.0.0-canary.20251015-f37c13b → 22.0.0-canary.20251018-6549d2a
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/migrations.json +37 -0
- package/package.json +11 -11
- package/release/changelog-renderer/index.d.ts +4 -0
- package/release/changelog-renderer/index.d.ts.map +1 -1
- package/release/changelog-renderer/index.js +2 -1
- package/src/command-line/init/implementation/angular/index.d.ts.map +1 -1
- package/src/command-line/init/implementation/angular/index.js +4 -6
- package/src/command-line/migrate/migrate.d.ts.map +1 -1
- package/src/command-line/migrate/migrate.js +41 -8
- package/src/command-line/release/changelog.d.ts +1 -1
- package/src/command-line/release/changelog.d.ts.map +1 -1
- package/src/command-line/release/changelog.js +8 -6
- package/src/command-line/release/command-object.d.ts +1 -0
- package/src/command-line/release/command-object.d.ts.map +1 -1
- package/src/command-line/release/command-object.js +5 -0
- package/src/command-line/release/config/config.d.ts.map +1 -1
- package/src/command-line/release/config/config.js +6 -3
- package/src/command-line/release/index.d.ts +14 -2
- package/src/command-line/release/index.d.ts.map +1 -1
- package/src/command-line/release/index.js +13 -6
- package/src/command-line/release/publish.d.ts +1 -1
- package/src/command-line/release/publish.d.ts.map +1 -1
- package/src/command-line/release/publish.js +6 -3
- package/src/command-line/release/release.d.ts +1 -1
- package/src/command-line/release/release.d.ts.map +1 -1
- package/src/command-line/release/release.js +9 -7
- package/src/command-line/release/utils/resolve-changelog-renderer.d.ts +1 -1
- package/src/command-line/release/utils/resolve-changelog-renderer.d.ts.map +1 -1
- package/src/command-line/release/utils/resolve-changelog-renderer.js +6 -2
- package/src/command-line/release/version.d.ts +1 -1
- package/src/command-line/release/version.d.ts.map +1 -1
- package/src/command-line/release/version.js +6 -4
- package/src/config/nx-json.d.ts +10 -4
- package/src/config/nx-json.d.ts.map +1 -1
- package/src/core/graph/main.js +1 -1
- package/src/devkit-internals.d.ts +1 -0
- package/src/devkit-internals.d.ts.map +1 -1
- package/src/devkit-internals.js +3 -1
- package/src/generators/utils/project-configuration.js +13 -1
- package/src/migrations/update-15-0-0/prefix-outputs.d.ts +3 -0
- package/src/migrations/update-15-0-0/prefix-outputs.d.ts.map +1 -0
- package/src/migrations/update-15-0-0/prefix-outputs.js +49 -0
- package/src/migrations/update-16-0-0/remove-nrwl-cli.d.ts +3 -0
- package/src/migrations/update-16-0-0/remove-nrwl-cli.d.ts.map +1 -0
- package/src/migrations/update-16-0-0/remove-nrwl-cli.js +16 -0
- package/src/migrations/update-16-0-0/update-depends-on-to-tokens.d.ts +3 -0
- package/src/migrations/update-16-0-0/update-depends-on-to-tokens.d.ts.map +1 -0
- package/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +97 -0
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.d.ts +3 -0
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.d.ts.map +1 -0
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +29 -0
- package/src/migrations/update-16-2-0/remove-run-commands-output-path.d.ts +3 -0
- package/src/migrations/update-16-2-0/remove-run-commands-output-path.d.ts.map +1 -0
- package/src/migrations/update-16-2-0/remove-run-commands-output-path.js +45 -0
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.d.ts +13 -0
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.d.ts.map +1 -0
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +67 -0
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/plugins/js/lock-file/lock-file.d.ts.map +1 -1
- package/src/plugins/js/lock-file/lock-file.js +1 -1
- package/src/plugins/js/lock-file/pnpm-parser.d.ts +1 -1
- package/src/plugins/js/lock-file/pnpm-parser.d.ts.map +1 -1
- package/src/plugins/js/lock-file/pnpm-parser.js +12 -4
- package/src/plugins/js/lock-file/project-graph-pruning.d.ts +2 -2
- package/src/plugins/js/lock-file/project-graph-pruning.d.ts.map +1 -1
- package/src/plugins/js/lock-file/project-graph-pruning.js +22 -9
- package/src/plugins/js/package-json/create-package-json.d.ts.map +1 -1
- package/src/plugins/js/package-json/create-package-json.js +17 -5
- package/src/plugins/package-json/create-nodes.js +1 -1
- package/src/plugins/project-json/build-nodes/project-json.d.ts +0 -1
- package/src/plugins/project-json/build-nodes/project-json.d.ts.map +1 -1
- package/src/plugins/project-json/build-nodes/project-json.js +1 -13
- package/src/project-graph/utils/project-configuration-utils.d.ts.map +1 -1
- package/src/project-graph/utils/project-configuration-utils.js +9 -0
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.d.ts +1 -1
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.d.ts.map +1 -1
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +83 -55
- package/src/utils/catalog/index.d.ts +10 -0
- package/src/utils/catalog/index.d.ts.map +1 -0
- package/src/utils/catalog/index.js +38 -0
- package/src/utils/catalog/manager-factory.d.ts +6 -0
- package/src/utils/catalog/manager-factory.d.ts.map +1 -0
- package/src/utils/catalog/manager-factory.js +17 -0
- package/src/utils/catalog/manager.d.ts +41 -0
- package/src/utils/catalog/manager.d.ts.map +1 -0
- package/src/utils/catalog/manager.js +2 -0
- package/src/utils/catalog/pnpm-manager.d.ts +23 -0
- package/src/utils/catalog/pnpm-manager.d.ts.map +1 -0
- package/src/utils/catalog/pnpm-manager.js +260 -0
- package/src/utils/catalog/types.d.ts +5 -0
- package/src/utils/catalog/types.d.ts.map +1 -0
- package/src/utils/catalog/types.js +2 -0
- package/src/utils/package-json.d.ts +79 -0
- package/src/utils/package-json.d.ts.map +1 -1
- package/src/utils/package-json.js +81 -2
- package/src/utils/package-manager.d.ts.map +1 -1
- package/src/utils/package-manager.js +23 -6
- package/src/utils/pnpm-workspace.d.ts +9 -0
- package/src/utils/pnpm-workspace.d.ts.map +1 -0
- package/src/utils/pnpm-workspace.js +2 -0
|
@@ -5,6 +5,7 @@ exports.findProjectsNpmDependencies = findProjectsNpmDependencies;
|
|
|
5
5
|
const fileutils_1 = require("../../../utils/fileutils");
|
|
6
6
|
const object_sort_1 = require("../../../utils/object-sort");
|
|
7
7
|
const project_graph_1 = require("../../../config/project-graph");
|
|
8
|
+
const package_json_1 = require("../../../utils/package-json");
|
|
8
9
|
const fs_1 = require("fs");
|
|
9
10
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
|
10
11
|
const configuration_1 = require("../../../config/configuration");
|
|
@@ -21,7 +22,8 @@ const output_1 = require("../../../utils/output");
|
|
|
21
22
|
function createPackageJson(projectName, graph, options = {}, fileMap = null) {
|
|
22
23
|
const projectNode = graph.nodes[projectName];
|
|
23
24
|
const isLibrary = projectNode.type === 'lib';
|
|
24
|
-
const
|
|
25
|
+
const root = options.root ?? workspace_root_1.workspaceRoot;
|
|
26
|
+
const rootPackageJson = (0, fileutils_1.readJsonFile)((0, path_1.join)(root, 'package.json'));
|
|
25
27
|
const npmDeps = findProjectsNpmDependencies(projectNode, graph, options.target, rootPackageJson, {
|
|
26
28
|
helperDependencies: options.helperDependencies,
|
|
27
29
|
isProduction: options.isProduction,
|
|
@@ -31,7 +33,7 @@ function createPackageJson(projectName, graph, options = {}, fileMap = null) {
|
|
|
31
33
|
name: projectName,
|
|
32
34
|
version: '0.0.1',
|
|
33
35
|
};
|
|
34
|
-
const projectPackageJsonPath = (0, path_1.join)(
|
|
36
|
+
const projectPackageJsonPath = (0, path_1.join)(root, projectNode.data.root, 'package.json');
|
|
35
37
|
if ((0, fs_1.existsSync)(projectPackageJsonPath)) {
|
|
36
38
|
try {
|
|
37
39
|
packageJson = (0, fileutils_1.readJsonFile)(projectPackageJsonPath);
|
|
@@ -55,9 +57,19 @@ function createPackageJson(projectName, graph, options = {}, fileMap = null) {
|
|
|
55
57
|
catch (e) { }
|
|
56
58
|
}
|
|
57
59
|
const getVersion = (packageName, version, section) => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
// Try project package.json first (single section)
|
|
61
|
+
const projectVersion = (0, package_json_1.getDependencyVersionFromPackageJson)(packageName, root, packageJson, [section]);
|
|
62
|
+
if (projectVersion) {
|
|
63
|
+
return projectVersion;
|
|
64
|
+
}
|
|
65
|
+
// For libraries, fall back to root package.json (single section)
|
|
66
|
+
if (isLibrary) {
|
|
67
|
+
const rootVersion = (0, package_json_1.getDependencyVersionFromPackageJson)(packageName, root, rootPackageJson, [section]);
|
|
68
|
+
if (rootVersion) {
|
|
69
|
+
return rootVersion;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return version;
|
|
61
73
|
};
|
|
62
74
|
Object.entries(npmDeps.dependencies).forEach(([packageName, version]) => {
|
|
63
75
|
if (rootPackageJson.devDependencies?.[packageName] &&
|
|
@@ -125,7 +125,7 @@ function buildProjectConfigurationFromPackageJson(packageJson, workspaceRoot, pa
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
if (!packageJson.name && projectRoot === '.') {
|
|
128
|
+
if (!packageJson.name && projectRoot === '.' && !packageJson.nx?.name) {
|
|
129
129
|
throw new Error('Nx requires the root package.json to specify a name if it is being used as an Nx project.');
|
|
130
130
|
}
|
|
131
131
|
let name = packageJson.name ?? (0, to_project_name_1.toProjectName)(normalizedPath);
|
|
@@ -3,5 +3,4 @@ import { NxPluginV2 } from '../../../project-graph/plugins';
|
|
|
3
3
|
export declare const ProjectJsonProjectsPlugin: NxPluginV2;
|
|
4
4
|
export default ProjectJsonProjectsPlugin;
|
|
5
5
|
export declare function buildProjectFromProjectJson(json: Partial<ProjectConfiguration>, path: string): ProjectConfiguration;
|
|
6
|
-
export declare function readNameFromPackageJson(path: string): string;
|
|
7
6
|
//# sourceMappingURL=project-json.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-json.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/project-json/build-nodes/project-json.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"project-json.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/project-json/build-nodes/project-json.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAEnF,OAAO,EAEL,UAAU,EACX,MAAM,gCAAgC,CAAC;AAExC,eAAO,MAAM,yBAAyB,EAAE,UAyBvC,CAAC;AAEF,eAAe,yBAAyB,CAAC;AAEzC,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,OAAO,CAAC,oBAAoB,CAAC,EACnC,IAAI,EAAE,MAAM,GACX,oBAAoB,CAOtB"}
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProjectJsonProjectsPlugin = void 0;
|
|
4
4
|
exports.buildProjectFromProjectJson = buildProjectFromProjectJson;
|
|
5
|
-
exports.readNameFromPackageJson = readNameFromPackageJson;
|
|
6
5
|
const node_path_1 = require("node:path");
|
|
7
|
-
const to_project_name_1 = require("../../../config/to-project-name");
|
|
8
6
|
const fileutils_1 = require("../../../utils/fileutils");
|
|
9
7
|
const plugins_1 = require("../../../project-graph/plugins");
|
|
10
8
|
exports.ProjectJsonProjectsPlugin = {
|
|
@@ -26,20 +24,10 @@ exports.ProjectJsonProjectsPlugin = {
|
|
|
26
24
|
};
|
|
27
25
|
exports.default = exports.ProjectJsonProjectsPlugin;
|
|
28
26
|
function buildProjectFromProjectJson(json, path) {
|
|
29
|
-
const packageJsonPath = (0, node_path_1.join)((0, node_path_1.dirname)(path), 'package.json');
|
|
30
27
|
const { name, root, ...rest } = json;
|
|
31
28
|
return {
|
|
32
|
-
name
|
|
29
|
+
name,
|
|
33
30
|
root: root ?? (0, node_path_1.dirname)(path),
|
|
34
31
|
...rest,
|
|
35
32
|
};
|
|
36
33
|
}
|
|
37
|
-
function readNameFromPackageJson(path) {
|
|
38
|
-
try {
|
|
39
|
-
const json = (0, fileutils_1.readJsonFile)(path);
|
|
40
|
-
return json.nx?.name ?? json.name;
|
|
41
|
-
}
|
|
42
|
-
catch {
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-configuration-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/project-graph/utils/project-configuration-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACf,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"project-configuration-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/project-graph/utils/project-configuration-utils.ts"],"names":[],"mappings":"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"}
|
|
@@ -18,10 +18,12 @@ const workspace_root_1 = require("../../utils/workspace-root");
|
|
|
18
18
|
const minimatch_1 = require("minimatch");
|
|
19
19
|
const path_1 = require("path");
|
|
20
20
|
const perf_hooks_1 = require("perf_hooks");
|
|
21
|
+
const node_fs_1 = require("node:fs");
|
|
21
22
|
const error_types_1 = require("../error-types");
|
|
22
23
|
const globs_1 = require("../../utils/globs");
|
|
23
24
|
const delayed_spinner_1 = require("../../utils/delayed-spinner");
|
|
24
25
|
const executor_utils_1 = require("../../command-line/run/executor-utils");
|
|
26
|
+
const to_project_name_1 = require("../../config/to-project-name");
|
|
25
27
|
function mergeProjectConfigurationIntoRootMap(projectRootMap, project, configurationSourceMaps, sourceInformation,
|
|
26
28
|
// This function is used when reading project configuration
|
|
27
29
|
// in generators, where we don't want to do this.
|
|
@@ -442,6 +444,13 @@ function validateAndNormalizeProjectRootMap(workspaceRoot, projectRootMap, nxJso
|
|
|
442
444
|
// Strip it before returning configuration for usage.
|
|
443
445
|
if (project['// targets'])
|
|
444
446
|
delete project['// targets'];
|
|
447
|
+
// We initially did this in the project.json plugin, but
|
|
448
|
+
// that resulted in project.json files without names causing
|
|
449
|
+
// the resulting project to change names from earlier plugins...
|
|
450
|
+
if (!project.name &&
|
|
451
|
+
(0, node_fs_1.existsSync)((0, path_1.join)(workspaceRoot, project.root, 'project.json'))) {
|
|
452
|
+
project.name = (0, to_project_name_1.toProjectName)((0, path_1.join)(root, 'project.json'));
|
|
453
|
+
}
|
|
445
454
|
try {
|
|
446
455
|
validateProject(project, projects);
|
|
447
456
|
projects[project.name] = project;
|
|
@@ -14,7 +14,7 @@ export declare function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, ta
|
|
|
14
14
|
initiatingTasks: Task[];
|
|
15
15
|
resolveRenderIsDonePromise: (value: void) => void;
|
|
16
16
|
}): {
|
|
17
|
-
lifeCycle:
|
|
17
|
+
lifeCycle: LifeCycle;
|
|
18
18
|
printSummary: () => void;
|
|
19
19
|
};
|
|
20
20
|
//# sourceMappingURL=tui-summary-life-cycle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui-summary-life-cycle.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/tasks-runner/life-cycles/tui-summary-life-cycle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAa/C,wBAAgB,8BAA8B,CAAC,EAC7C,YAAY,EACZ,KAAK,EACL,SAAS,EACT,IAAI,EACJ,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,0BAA0B,GAC3B,EAAE;IACD,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,IAAI,EAAE,CAAC;IACxB,0BAA0B,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,CAAC;CACnD
|
|
1
|
+
{"version":3,"file":"tui-summary-life-cycle.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/tasks-runner/life-cycles/tui-summary-life-cycle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAa/C,wBAAgB,8BAA8B,CAAC,EAC7C,YAAY,EACZ,KAAK,EACL,SAAS,EACT,IAAI,EACJ,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,0BAA0B,GAC3B,EAAE;IACD,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,IAAI,EAAE,CAAC;IACxB,0BAA0B,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,CAAC;CACnD;eAqekC,SAAS;;EAC3C"}
|
|
@@ -39,8 +39,13 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
|
39
39
|
tasksToTerminalOutputs[taskId] += output;
|
|
40
40
|
};
|
|
41
41
|
// TODO(@AgentEnder): The following 2 methods should be one but will need more refactoring
|
|
42
|
-
lifeCycle.printTaskTerminalOutput = (task, taskStatus) => {
|
|
42
|
+
lifeCycle.printTaskTerminalOutput = (task, taskStatus, output) => {
|
|
43
43
|
tasksToTaskStatus[task.id] = taskStatus;
|
|
44
|
+
// Store the complete output for display in the summary
|
|
45
|
+
// This is called with the full output for cached and executed tasks
|
|
46
|
+
if (output) {
|
|
47
|
+
tasksToTerminalOutputs[task.id] = output;
|
|
48
|
+
}
|
|
44
49
|
};
|
|
45
50
|
lifeCycle.setTaskStatus = (taskId, taskStatus) => {
|
|
46
51
|
if (taskStatus === 9 /* NativeTaskStatus.Stopped */) {
|
|
@@ -106,7 +111,6 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
|
106
111
|
(0, task_history_life_cycle_1.getTasksHistoryLifeCycle)().printFlakyTasksMessage();
|
|
107
112
|
};
|
|
108
113
|
const printRunOneSummary = ({ failure, cancelled, }) => {
|
|
109
|
-
let lines = [];
|
|
110
114
|
// Prints task outputs in the order they were completed
|
|
111
115
|
// above the summary, since run-one should print all task results.
|
|
112
116
|
for (const taskId of taskIdsInTheOrderTheyStart) {
|
|
@@ -114,62 +118,71 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
|
114
118
|
const terminalOutput = tasksToTerminalOutputs[taskId];
|
|
115
119
|
output_1.output.logCommandOutput(taskId, taskStatus, terminalOutput);
|
|
116
120
|
}
|
|
117
|
-
|
|
121
|
+
// Print vertical separator
|
|
122
|
+
const separatorLines = output_1.output.getVerticalSeparatorLines(failure ? 'red' : 'green');
|
|
123
|
+
for (const line of separatorLines) {
|
|
124
|
+
console.log(line);
|
|
125
|
+
}
|
|
118
126
|
if (!failure && !cancelled) {
|
|
119
127
|
const text = `Successfully ran ${(0, formatting_utils_1.formatTargetsAndProjects)([initiatingProject], targets, tasks)}`;
|
|
120
|
-
|
|
128
|
+
// Build success message with color applied to the entire block
|
|
129
|
+
const messageLines = [
|
|
130
|
+
output_1.output.applyNxPrefix('green', output_1.output.colors.green(text) + output_1.output.dim(` (${timeTakenText})`)),
|
|
131
|
+
];
|
|
121
132
|
const filteredOverrides = Object.entries(overrides).filter(
|
|
122
133
|
// Don't print the data passed through from the version subcommand to the publish executor options, it could be quite large and it's an implementation detail.
|
|
123
134
|
([flag]) => flag !== 'nxReleaseVersionData');
|
|
124
135
|
if (filteredOverrides.length > 0) {
|
|
125
|
-
|
|
126
|
-
|
|
136
|
+
messageLines.push('');
|
|
137
|
+
messageLines.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.green('With additional flags:')}`);
|
|
127
138
|
filteredOverrides
|
|
128
139
|
.map(([flag, value]) => output_1.output.dim.green((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
|
|
129
|
-
.forEach((arg) =>
|
|
140
|
+
.forEach((arg) => messageLines.push(arg));
|
|
130
141
|
}
|
|
131
|
-
lines.push(output_1.output.applyNxPrefix('green', output_1.output.colors.green(text) + output_1.output.dim(` (${timeTakenText})`)), ...taskOverridesLines);
|
|
132
142
|
if (totalCachedTasks > 0) {
|
|
133
|
-
|
|
143
|
+
messageLines.push(output_1.output.dim(`${node_os_1.EOL}Nx read the output from the cache instead of running the command for ${totalCachedTasks} out of ${totalTasks} tasks.`));
|
|
134
144
|
}
|
|
135
|
-
|
|
145
|
+
// Print the entire success message block with green color
|
|
146
|
+
console.log(output_1.output.colors.green(messageLines.join(node_os_1.EOL)));
|
|
136
147
|
}
|
|
137
148
|
else if (!cancelled) {
|
|
138
149
|
let text = `Ran target ${output_1.output.bold(targets[0])} for project ${output_1.output.bold(initiatingProject)}`;
|
|
139
150
|
if (tasks.length > 1) {
|
|
140
151
|
text += ` and ${output_1.output.bold(tasks.length - 1)} task(s) they depend on`;
|
|
141
152
|
}
|
|
142
|
-
|
|
153
|
+
// Build failure message lines
|
|
154
|
+
const messageLines = [
|
|
155
|
+
output_1.output.applyNxPrefix('red', output_1.output.colors.red(text) + output_1.output.dim(` (${timeTakenText})`)),
|
|
156
|
+
];
|
|
143
157
|
const filteredOverrides = Object.entries(overrides).filter(
|
|
144
158
|
// Don't print the data passed through from the version subcommand to the publish executor options, it could be quite large and it's an implementation detail.
|
|
145
159
|
([flag]) => flag !== 'nxReleaseVersionData');
|
|
146
160
|
if (filteredOverrides.length > 0) {
|
|
147
|
-
|
|
148
|
-
|
|
161
|
+
messageLines.push('');
|
|
162
|
+
messageLines.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.red('With additional flags:')}`);
|
|
149
163
|
filteredOverrides
|
|
150
164
|
.map(([flag, value]) => output_1.output.dim.red((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
|
|
151
|
-
.forEach((arg) =>
|
|
165
|
+
.forEach((arg) => messageLines.push(arg));
|
|
152
166
|
}
|
|
167
|
+
messageLines.push('');
|
|
168
|
+
messageLines.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} failed`);
|
|
169
|
+
messageLines.push(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`);
|
|
153
170
|
const viewLogs = (0, view_logs_utils_1.viewLogsFooterRows)(totalFailedTasks);
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
'',
|
|
158
|
-
`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} failed`,
|
|
159
|
-
`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`,
|
|
160
|
-
...viewLogs,
|
|
161
|
-
].join(node_os_1.EOL)));
|
|
171
|
+
messageLines.push(...viewLogs);
|
|
172
|
+
// Print the entire failure message block with red color
|
|
173
|
+
console.log(output_1.output.colors.red(messageLines.join(node_os_1.EOL)));
|
|
162
174
|
}
|
|
163
175
|
else {
|
|
164
|
-
|
|
176
|
+
console.log(output_1.output.applyNxPrefix('red', output_1.output.colors.red(`Cancelled running target ${output_1.output.bold(targets[0])} for project ${output_1.output.bold(initiatingProject)}`) + output_1.output.dim(` (${timeTakenText})`)));
|
|
165
177
|
}
|
|
166
178
|
// adds some vertical space after the summary to avoid bunching against terminal
|
|
167
|
-
|
|
168
|
-
console.log(lines.join(node_os_1.EOL));
|
|
179
|
+
console.log('');
|
|
169
180
|
};
|
|
170
181
|
const printRunManySummary = ({ failure, cancelled, }) => {
|
|
171
182
|
console.log('');
|
|
172
|
-
|
|
183
|
+
// Collect checklist lines to print after task outputs
|
|
184
|
+
const checklistLines = [];
|
|
185
|
+
// First pass: Print task outputs and collect checklist lines
|
|
173
186
|
for (const taskId of taskIdsInTheOrderTheyStart) {
|
|
174
187
|
const taskStatus = tasksToTaskStatus[taskId];
|
|
175
188
|
const terminalOutput = tasksToTerminalOutputs[taskId];
|
|
@@ -177,66 +190,82 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
|
177
190
|
if (!taskStatus) {
|
|
178
191
|
output_1.output.logCommandOutput(taskId, taskStatus, terminalOutput);
|
|
179
192
|
output_1.output.addNewline();
|
|
180
|
-
|
|
193
|
+
checklistLines.push(`${LEFT_PAD}${output_1.output.colors.cyan(figures.squareSmallFilled)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
|
|
181
194
|
}
|
|
182
195
|
else if (taskStatus === 'failure') {
|
|
183
196
|
output_1.output.logCommandOutput(taskId, taskStatus, terminalOutput);
|
|
184
197
|
output_1.output.addNewline();
|
|
185
|
-
|
|
198
|
+
checklistLines.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
|
|
199
|
+
}
|
|
200
|
+
else if (taskStatus === 'local-cache') {
|
|
201
|
+
checklistLines.push(`${LEFT_PAD}${output_1.output.colors.green(figures.tick)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId} ${output_1.output.dim('[local cache]')}`);
|
|
202
|
+
}
|
|
203
|
+
else if (taskStatus === 'local-cache-kept-existing') {
|
|
204
|
+
checklistLines.push(`${LEFT_PAD}${output_1.output.colors.green(figures.tick)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId} ${output_1.output.dim('[existing outputs match the cache, left as is]')}`);
|
|
205
|
+
}
|
|
206
|
+
else if (taskStatus === 'remote-cache') {
|
|
207
|
+
checklistLines.push(`${LEFT_PAD}${output_1.output.colors.green(figures.tick)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId} ${output_1.output.dim('[remote cache]')}`);
|
|
208
|
+
}
|
|
209
|
+
else if (taskStatus === 'success') {
|
|
210
|
+
checklistLines.push(`${LEFT_PAD}${output_1.output.colors.green(figures.tick)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
|
|
186
211
|
}
|
|
187
212
|
else {
|
|
188
|
-
|
|
213
|
+
checklistLines.push(`${LEFT_PAD}${output_1.output.colors.green(figures.tick)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
|
|
189
214
|
}
|
|
190
215
|
}
|
|
191
|
-
|
|
216
|
+
// Print all checklist lines together
|
|
217
|
+
console.log();
|
|
218
|
+
for (const line of checklistLines) {
|
|
219
|
+
console.log(line);
|
|
220
|
+
}
|
|
221
|
+
// Print vertical separator
|
|
222
|
+
const separatorLines = output_1.output.getVerticalSeparatorLines(failure ? 'red' : 'green');
|
|
223
|
+
for (const line of separatorLines) {
|
|
224
|
+
console.log(line);
|
|
225
|
+
}
|
|
192
226
|
if (totalSuccessfulTasks + stoppedTasks.size === totalTasks) {
|
|
193
|
-
const successSummaryRows = [];
|
|
194
227
|
const text = `Successfully ran ${(0, formatting_utils_1.formatTargetsAndProjects)(projectNames, targets, tasks)}`;
|
|
195
|
-
const
|
|
228
|
+
const successSummaryRows = [
|
|
229
|
+
output_1.output.applyNxPrefix('green', output_1.output.colors.green(text) + output_1.output.dim.white(` (${timeTakenText})`)),
|
|
230
|
+
];
|
|
196
231
|
const filteredOverrides = Object.entries(overrides).filter(
|
|
197
232
|
// Don't print the data passed through from the version subcommand to the publish executor options, it could be quite large and it's an implementation detail.
|
|
198
233
|
([flag]) => flag !== 'nxReleaseVersionData');
|
|
199
234
|
if (filteredOverrides.length > 0) {
|
|
200
|
-
|
|
201
|
-
|
|
235
|
+
successSummaryRows.push('');
|
|
236
|
+
successSummaryRows.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.green('With additional flags:')}`);
|
|
202
237
|
filteredOverrides
|
|
203
238
|
.map(([flag, value]) => output_1.output.dim.green((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
|
|
204
|
-
.forEach((arg) =>
|
|
239
|
+
.forEach((arg) => successSummaryRows.push(arg));
|
|
205
240
|
}
|
|
206
|
-
successSummaryRows.push(...[
|
|
207
|
-
output_1.output.applyNxPrefix('green', output_1.output.colors.green(text) + output_1.output.dim.white(` (${timeTakenText})`)),
|
|
208
|
-
...taskOverridesRows,
|
|
209
|
-
]);
|
|
210
241
|
if (totalCachedTasks > 0) {
|
|
211
242
|
successSummaryRows.push(output_1.output.dim(`${node_os_1.EOL}Nx read the output from the cache instead of running the command for ${totalCachedTasks} out of ${totalTasks} tasks.`));
|
|
212
243
|
}
|
|
213
|
-
|
|
244
|
+
console.log(successSummaryRows.join(node_os_1.EOL));
|
|
214
245
|
}
|
|
215
246
|
else {
|
|
216
247
|
const text = `${cancelled ? 'Cancelled while running' : 'Ran'} ${(0, formatting_utils_1.formatTargetsAndProjects)(projectNames, targets, tasks)}`;
|
|
217
|
-
const
|
|
248
|
+
const failureSummaryRows = [
|
|
249
|
+
output_1.output.applyNxPrefix('red', output_1.output.colors.red(text) + output_1.output.dim.white(` (${timeTakenText})`)),
|
|
250
|
+
];
|
|
218
251
|
const filteredOverrides = Object.entries(overrides).filter(
|
|
219
252
|
// Don't print the data passed through from the version subcommand to the publish executor options, it could be quite large and it's an implementation detail.
|
|
220
253
|
([flag]) => flag !== 'nxReleaseVersionData');
|
|
221
254
|
if (filteredOverrides.length > 0) {
|
|
222
|
-
|
|
223
|
-
|
|
255
|
+
failureSummaryRows.push('');
|
|
256
|
+
failureSummaryRows.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.red('With additional flags:')}`);
|
|
224
257
|
filteredOverrides
|
|
225
258
|
.map(([flag, value]) => output_1.output.dim.red((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
|
|
226
|
-
.forEach((arg) =>
|
|
259
|
+
.forEach((arg) => failureSummaryRows.push(arg));
|
|
227
260
|
}
|
|
228
|
-
|
|
229
|
-
const failedTasksForPrinting = Array.from(failedTasks).slice(0, numFailedToPrint);
|
|
230
|
-
const failureSummaryRows = [
|
|
231
|
-
output_1.output.applyNxPrefix('red', output_1.output.colors.red(text) + output_1.output.dim.white(` (${timeTakenText})`)),
|
|
232
|
-
...taskOverridesRows,
|
|
233
|
-
'',
|
|
234
|
-
];
|
|
261
|
+
failureSummaryRows.push('');
|
|
235
262
|
if (totalCompletedTasks > 0) {
|
|
236
263
|
if (totalSuccessfulTasks > 0) {
|
|
237
264
|
failureSummaryRows.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`), '');
|
|
238
265
|
}
|
|
239
266
|
if (totalFailedTasks > 0) {
|
|
267
|
+
const numFailedToPrint = 5;
|
|
268
|
+
const failedTasksForPrinting = Array.from(failedTasks).slice(0, numFailedToPrint);
|
|
240
269
|
failureSummaryRows.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} targets failed, including the following:`, '', `${failedTasksForPrinting
|
|
241
270
|
.map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
|
|
242
271
|
.join('\n')}`, '');
|
|
@@ -256,12 +285,11 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
|
256
285
|
}
|
|
257
286
|
}
|
|
258
287
|
failureSummaryRows.push(...(0, view_logs_utils_1.viewLogsFooterRows)(failedTasks.size));
|
|
259
|
-
lines.push(output_1.output.colors.red(failureSummaryRows.join(node_os_1.EOL)));
|
|
260
288
|
}
|
|
289
|
+
console.log(output_1.output.colors.red(failureSummaryRows.join(node_os_1.EOL)));
|
|
261
290
|
}
|
|
262
291
|
// adds some vertical space after the summary to avoid bunching against terminal
|
|
263
|
-
|
|
264
|
-
console.log(lines.join(node_os_1.EOL));
|
|
292
|
+
console.log('');
|
|
265
293
|
};
|
|
266
|
-
return { lifeCycle, printSummary };
|
|
294
|
+
return { lifeCycle: lifeCycle, printSummary };
|
|
267
295
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Tree } from '../../generators/tree';
|
|
2
|
+
import type { CatalogManager } from './manager';
|
|
3
|
+
import { getCatalogManager } from './manager-factory';
|
|
4
|
+
export { type CatalogManager, getCatalogManager };
|
|
5
|
+
/**
|
|
6
|
+
* Detects which packages in a package.json use catalog references
|
|
7
|
+
* Returns Map of package name -> catalog name (undefined for default catalog)
|
|
8
|
+
*/
|
|
9
|
+
export declare function getCatalogDependenciesFromPackageJson(tree: Tree, packageJsonPath: string, manager: CatalogManager): Map<string, string | undefined>;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/utils/catalog/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,KAAK,cAAc,EAAE,iBAAiB,EAAE,CAAC;AAElD;;;GAGG;AACH,wBAAgB,qCAAqC,CACnD,IAAI,EAAE,IAAI,EACV,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,cAAc,GACtB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CA+BjC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCatalogManager = void 0;
|
|
4
|
+
exports.getCatalogDependenciesFromPackageJson = getCatalogDependenciesFromPackageJson;
|
|
5
|
+
const json_1 = require("../../generators/utils/json");
|
|
6
|
+
const manager_factory_1 = require("./manager-factory");
|
|
7
|
+
Object.defineProperty(exports, "getCatalogManager", { enumerable: true, get: function () { return manager_factory_1.getCatalogManager; } });
|
|
8
|
+
/**
|
|
9
|
+
* Detects which packages in a package.json use catalog references
|
|
10
|
+
* Returns Map of package name -> catalog name (undefined for default catalog)
|
|
11
|
+
*/
|
|
12
|
+
function getCatalogDependenciesFromPackageJson(tree, packageJsonPath, manager) {
|
|
13
|
+
const catalogDeps = new Map();
|
|
14
|
+
if (!tree.exists(packageJsonPath)) {
|
|
15
|
+
return catalogDeps;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
const packageJson = (0, json_1.readJson)(tree, packageJsonPath);
|
|
19
|
+
const allDependencies = {
|
|
20
|
+
...packageJson.dependencies,
|
|
21
|
+
...packageJson.devDependencies,
|
|
22
|
+
...packageJson.peerDependencies,
|
|
23
|
+
...packageJson.optionalDependencies,
|
|
24
|
+
};
|
|
25
|
+
for (const [packageName, version] of Object.entries(allDependencies || {})) {
|
|
26
|
+
if (manager.isCatalogReference(version)) {
|
|
27
|
+
const catalogRef = manager.parseCatalogReference(version);
|
|
28
|
+
if (catalogRef) {
|
|
29
|
+
catalogDeps.set(packageName, catalogRef.catalogName);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
// If we can't read the package.json, return empty map
|
|
36
|
+
}
|
|
37
|
+
return catalogDeps;
|
|
38
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CatalogManager } from './manager';
|
|
2
|
+
/**
|
|
3
|
+
* Factory function to get the appropriate catalog manager based on the package manager
|
|
4
|
+
*/
|
|
5
|
+
export declare function getCatalogManager(workspaceRoot: string): CatalogManager | null;
|
|
6
|
+
//# sourceMappingURL=manager-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager-factory.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/utils/catalog/manager-factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGhD;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,MAAM,GACpB,cAAc,GAAG,IAAI,CASvB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCatalogManager = getCatalogManager;
|
|
4
|
+
const package_manager_1 = require("../package-manager");
|
|
5
|
+
const pnpm_manager_1 = require("./pnpm-manager");
|
|
6
|
+
/**
|
|
7
|
+
* Factory function to get the appropriate catalog manager based on the package manager
|
|
8
|
+
*/
|
|
9
|
+
function getCatalogManager(workspaceRoot) {
|
|
10
|
+
const packageManager = (0, package_manager_1.detectPackageManager)(workspaceRoot);
|
|
11
|
+
switch (packageManager) {
|
|
12
|
+
case 'pnpm':
|
|
13
|
+
return new pnpm_manager_1.PnpmCatalogManager();
|
|
14
|
+
default:
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Tree } from '../../generators/tree';
|
|
2
|
+
import type { PnpmWorkspaceYaml } from '../pnpm-workspace';
|
|
3
|
+
import type { CatalogReference } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Interface for catalog managers that handle package manager-specific catalog implementations.
|
|
6
|
+
*/
|
|
7
|
+
export interface CatalogManager {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
isCatalogReference(version: string): boolean;
|
|
10
|
+
parseCatalogReference(version: string): CatalogReference | null;
|
|
11
|
+
getCatalogDefinitionFilePaths(): string[];
|
|
12
|
+
/**
|
|
13
|
+
* Get catalog definitions from the workspace.
|
|
14
|
+
*/
|
|
15
|
+
getCatalogDefinitions(workspaceRoot: string): PnpmWorkspaceYaml | null;
|
|
16
|
+
getCatalogDefinitions(tree: Tree): PnpmWorkspaceYaml | null;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve a catalog reference to an actual version.
|
|
19
|
+
*/
|
|
20
|
+
resolveCatalogReference(workspaceRoot: string, packageName: string, version: string): string | null;
|
|
21
|
+
resolveCatalogReference(tree: Tree, packageName: string, version: string): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Check that a catalog reference is valid.
|
|
24
|
+
*/
|
|
25
|
+
validateCatalogReference(workspaceRoot: string, packageName: string, version: string): void;
|
|
26
|
+
validateCatalogReference(tree: Tree, packageName: string, version: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Updates catalog definitions for specified packages in their respective catalogs.
|
|
29
|
+
*/
|
|
30
|
+
updateCatalogVersions(tree: Tree, updates: Array<{
|
|
31
|
+
packageName: string;
|
|
32
|
+
version: string;
|
|
33
|
+
catalogName?: string;
|
|
34
|
+
}>): void;
|
|
35
|
+
updateCatalogVersions(workspaceRoot: string, updates: Array<{
|
|
36
|
+
packageName: string;
|
|
37
|
+
version: string;
|
|
38
|
+
catalogName?: string;
|
|
39
|
+
}>): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/utils/catalog/manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAE7C,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAAC;IAEhE,6BAA6B,IAAI,MAAM,EAAE,CAAC;IAE1C;;OAEG;IACH,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAAC;IACvE,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,iBAAiB,GAAG,IAAI,CAAC;IAE5D;;OAEG;IACH,uBAAuB,CACrB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,IAAI,CAAC;IACjB,uBAAuB,CACrB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,IAAI,CAAC;IAEjB;;OAEG;IACH,wBAAwB,CACtB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GACd,IAAI,CAAC;IACR,wBAAwB,CACtB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GACd,IAAI,CAAC;IAER;;OAEG;IACH,qBAAqB,CACnB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,KAAK,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC,GACD,IAAI,CAAC;IACR,qBAAqB,CACnB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,KAAK,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC,GACD,IAAI,CAAC;CACT"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Tree } from '../../generators/tree';
|
|
2
|
+
import type { PnpmWorkspaceYaml } from '../pnpm-workspace';
|
|
3
|
+
import type { CatalogManager } from './manager';
|
|
4
|
+
import type { CatalogReference } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* PNPM-specific catalog manager implementation
|
|
7
|
+
*/
|
|
8
|
+
export declare class PnpmCatalogManager implements CatalogManager {
|
|
9
|
+
readonly name = "pnpm";
|
|
10
|
+
readonly catalogProtocol = "catalog:";
|
|
11
|
+
isCatalogReference(version: string): boolean;
|
|
12
|
+
parseCatalogReference(version: string): CatalogReference | null;
|
|
13
|
+
getCatalogDefinitionFilePaths(): string[];
|
|
14
|
+
getCatalogDefinitions(treeOrRoot: Tree | string): PnpmWorkspaceYaml | null;
|
|
15
|
+
resolveCatalogReference(treeOrRoot: Tree | string, packageName: string, version: string): string | null;
|
|
16
|
+
validateCatalogReference(treeOrRoot: Tree | string, packageName: string, version: string): void;
|
|
17
|
+
updateCatalogVersions(treeOrRoot: Tree | string, updates: Array<{
|
|
18
|
+
packageName: string;
|
|
19
|
+
version: string;
|
|
20
|
+
catalogName?: string;
|
|
21
|
+
}>): void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=pnpm-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pnpm-manager.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/utils/catalog/pnpm-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAGlD,OAAO,KAAK,EAAoB,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;GAEG;AACH,qBAAa,kBAAmB,YAAW,cAAc;IACvD,QAAQ,CAAC,IAAI,UAAU;IACvB,QAAQ,CAAC,eAAe,cAAc;IAEtC,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAI5C,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAe/D,6BAA6B,IAAI,MAAM,EAAE;IAIzC,qBAAqB,CAAC,UAAU,EAAE,IAAI,GAAG,MAAM,GAAG,iBAAiB,GAAG,IAAI;IAe1E,uBAAuB,CACrB,UAAU,EAAE,IAAI,GAAG,MAAM,EACzB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,IAAI;IAuBhB,wBAAwB,CACtB,UAAU,EAAE,IAAI,GAAG,MAAM,EACzB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GACd,IAAI;IA0HP,qBAAqB,CACnB,UAAU,EAAE,IAAI,GAAG,MAAM,EACzB,OAAO,EAAE,KAAK,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC,GACD,IAAI;CAgFR"}
|