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
|
@@ -27,4 +27,5 @@ export { registerTsProject } from './plugins/js/utils/register';
|
|
|
27
27
|
export { interpolate } from './tasks-runner/utils';
|
|
28
28
|
export { isCI } from './utils/is-ci';
|
|
29
29
|
export { isUsingPrettierInTree } from './utils/is-using-prettier';
|
|
30
|
+
export { readYamlFile } from './utils/fileutils';
|
|
30
31
|
//# sourceMappingURL=devkit-internals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devkit-internals.d.ts","sourceRoot":"","sources":["../../../../packages/nx/src/devkit-internals.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EACL,sBAAsB,EACtB,aAAa,GACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,gDAAgD,EAAE,MAAM,gDAAgD,CAAC;AAClH,OAAO,EAAE,yBAAyB,EAAE,MAAM,mDAAmD,CAAC;AAC9F,OAAO,EACL,oCAAoC,EACpC,uBAAuB,GACxB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,wBAAwB,EACxB,iCAAiC,GAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,kDAAkD,EAClD,kBAAkB,GACnB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"devkit-internals.d.ts","sourceRoot":"","sources":["../../../../packages/nx/src/devkit-internals.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EACL,sBAAsB,EACtB,aAAa,GACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,gDAAgD,EAAE,MAAM,gDAAgD,CAAC;AAClH,OAAO,EAAE,yBAAyB,EAAE,MAAM,mDAAmD,CAAC;AAC9F,OAAO,EACL,oCAAoC,EACpC,uBAAuB,GACxB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,wBAAwB,EACxB,iCAAiC,GAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,kDAAkD,EAClD,kBAAkB,GACnB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
package/src/devkit-internals.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isUsingPrettierInTree = exports.isCI = exports.interpolate = exports.registerTsProject = exports.LoadedNxPlugin = exports.retrieveProjectConfigurations = exports.findProjectForPath = exports.createProjectRootMappingsFromProjectConfigurations = exports.hashMultiGlobWithWorkspaceContext = exports.hashWithWorkspaceContext = exports.hashObject = exports.splitByColons = exports.installPackageToTmp = exports.readModulePackageJson = exports.stripIndent = exports.sortObjectByKeys = exports.combineOptionsForExecutor = exports.splitTarget = exports.getIgnoreObjectForTree = exports.findMatchingConfigFiles = exports.readProjectConfigurationsFromRootMap = exports.mergeTargetConfigurations = exports.retrieveProjectConfigurationsWithAngularProjects = exports.calculateDefaultProjectName = exports.readNxJsonFromDisk = exports.parseExecutor = exports.getExecutorInformation = exports.createTempNpmDirectory = void 0;
|
|
3
|
+
exports.readYamlFile = exports.isUsingPrettierInTree = exports.isCI = exports.interpolate = exports.registerTsProject = exports.LoadedNxPlugin = exports.retrieveProjectConfigurations = exports.findProjectForPath = exports.createProjectRootMappingsFromProjectConfigurations = exports.hashMultiGlobWithWorkspaceContext = exports.hashWithWorkspaceContext = exports.hashObject = exports.splitByColons = exports.installPackageToTmp = exports.readModulePackageJson = exports.stripIndent = exports.sortObjectByKeys = exports.combineOptionsForExecutor = exports.splitTarget = exports.getIgnoreObjectForTree = exports.findMatchingConfigFiles = exports.readProjectConfigurationsFromRootMap = exports.mergeTargetConfigurations = exports.retrieveProjectConfigurationsWithAngularProjects = exports.calculateDefaultProjectName = exports.readNxJsonFromDisk = exports.parseExecutor = exports.getExecutorInformation = exports.createTempNpmDirectory = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
/**
|
|
6
6
|
* Note to developers: STOP! These exports are available via requireNx in @nx/devkit.
|
|
@@ -59,3 +59,5 @@ var is_ci_1 = require("./utils/is-ci");
|
|
|
59
59
|
Object.defineProperty(exports, "isCI", { enumerable: true, get: function () { return is_ci_1.isCI; } });
|
|
60
60
|
var is_using_prettier_1 = require("./utils/is-using-prettier");
|
|
61
61
|
Object.defineProperty(exports, "isUsingPrettierInTree", { enumerable: true, get: function () { return is_using_prettier_1.isUsingPrettierInTree; } });
|
|
62
|
+
var fileutils_1 = require("./utils/fileutils");
|
|
63
|
+
Object.defineProperty(exports, "readYamlFile", { enumerable: true, get: function () { return fileutils_1.readYamlFile; } });
|
|
@@ -181,9 +181,21 @@ function readAndCombineAllProjectConfigurations(tree) {
|
|
|
181
181
|
if ((0, path_1.basename)(projectFile) === 'project.json') {
|
|
182
182
|
const json = (0, json_1.readJson)(tree, projectFile);
|
|
183
183
|
const config = (0, project_json_1.buildProjectFromProjectJson)(json, projectFile);
|
|
184
|
+
if (!config.name) {
|
|
185
|
+
try {
|
|
186
|
+
const packageJson = (0, json_1.readJson)(tree, (0, path_2.joinPathFragments)(config.root, 'package.json'));
|
|
187
|
+
if (packageJson.name) {
|
|
188
|
+
config.name = packageJson.name;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
// Maybe no package json, is ok.
|
|
193
|
+
}
|
|
194
|
+
config.name ??= (0, to_project_name_1.toProjectName)(projectFile);
|
|
195
|
+
}
|
|
184
196
|
(0, project_configuration_utils_1.mergeProjectConfigurationIntoRootMap)(rootMap, config, undefined, undefined, true);
|
|
185
197
|
}
|
|
186
|
-
|
|
198
|
+
if ((0, path_1.basename)(projectFile) === 'package.json') {
|
|
187
199
|
const packageJson = (0, json_1.readJson)(tree, projectFile);
|
|
188
200
|
// We don't want to have all of the extra inferred stuff in here, as
|
|
189
201
|
// when generators update the project they shouldn't inline that stuff.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefix-outputs.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/migrations/update-15-0-0/prefix-outputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAgB7C,yBAA+B,IAAI,EAAE,IAAI,iBAoDxC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
|
5
|
+
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
|
6
|
+
const nx_json_1 = require("../../generators/utils/nx-json");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const utils_1 = require("../../tasks-runner/utils");
|
|
9
|
+
const json_1 = require("../../generators/utils/json");
|
|
10
|
+
async function default_1(tree) {
|
|
11
|
+
// If the workspace doesn't have a nx.json, don't make any changes
|
|
12
|
+
if (!tree.exists('nx.json')) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
|
16
|
+
for (const [projectName, project] of (0, project_configuration_1.getProjects)(tree)) {
|
|
17
|
+
for (const [_, target] of Object.entries(project.targets ?? {})) {
|
|
18
|
+
if (!target.outputs) {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
target.outputs = (0, utils_1.transformLegacyOutputs)(project.root, target.outputs);
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
(0, project_configuration_1.updateProjectConfiguration)(tree, projectName, project);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
if (tree.exists((0, path_1.join)(project.root, 'package.json'))) {
|
|
28
|
+
(0, json_1.updateJson)(tree, (0, path_1.join)(project.root, 'package.json'), (json) => {
|
|
29
|
+
for (const target of Object.values(json.nx?.targets ?? {})) {
|
|
30
|
+
if (target.outputs) {
|
|
31
|
+
target.outputs = (0, utils_1.transformLegacyOutputs)(project.root, target.outputs);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return json;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (nxJson.targetDefaults) {
|
|
40
|
+
for (const [_, target] of Object.entries(nxJson.targetDefaults)) {
|
|
41
|
+
if (!target.outputs) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
target.outputs = (0, utils_1.transformLegacyOutputs)('{projectRoot}', target.outputs);
|
|
45
|
+
}
|
|
46
|
+
(0, nx_json_1.updateNxJson)(tree, nxJson);
|
|
47
|
+
}
|
|
48
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-nrwl-cli.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/migrations/update-16-0-0/remove-nrwl-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAI7C,yBAA+B,IAAI,EAAE,IAAI,iBAYxC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
|
5
|
+
const json_1 = require("../../generators/utils/json");
|
|
6
|
+
async function default_1(tree) {
|
|
7
|
+
(0, json_1.updateJson)(tree, 'package.json', (json) => {
|
|
8
|
+
for (const deps of [json.dependencies, json.devDependencies]) {
|
|
9
|
+
if (deps) {
|
|
10
|
+
delete deps['@nrwl/cli'];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return json;
|
|
14
|
+
});
|
|
15
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-depends-on-to-tokens.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/migrations/update-16-0-0/update-depends-on-to-tokens.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAG7C,yBAA+B,IAAI,EAAE,IAAI,iBAyDxC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
|
5
|
+
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
|
6
|
+
async function default_1(tree) {
|
|
7
|
+
updateDependsOnAndInputsInsideNxJson(tree);
|
|
8
|
+
const projectsConfigurations = (0, project_configuration_1.getProjects)(tree);
|
|
9
|
+
for (const [projectName, projectConfiguration] of projectsConfigurations) {
|
|
10
|
+
let projectChanged = false;
|
|
11
|
+
for (const [targetName, targetConfiguration] of Object.entries(projectConfiguration.targets ?? {})) {
|
|
12
|
+
for (const dependency of targetConfiguration.dependsOn ?? []) {
|
|
13
|
+
if (typeof dependency !== 'string') {
|
|
14
|
+
if (dependency.projects === 'self' ||
|
|
15
|
+
dependency.projects === '{self}') {
|
|
16
|
+
delete dependency.projects;
|
|
17
|
+
projectChanged = true;
|
|
18
|
+
}
|
|
19
|
+
else if (dependency.projects === 'dependencies' ||
|
|
20
|
+
dependency.projects === '{dependencies}') {
|
|
21
|
+
delete dependency.projects;
|
|
22
|
+
dependency.dependencies = true;
|
|
23
|
+
projectChanged = true;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
for (let i = 0; i < (targetConfiguration.inputs?.length ?? 0); i++) {
|
|
28
|
+
const input = targetConfiguration.inputs[i];
|
|
29
|
+
if (typeof input !== 'string') {
|
|
30
|
+
if ('projects' in input &&
|
|
31
|
+
(input.projects === 'self' || input.projects === '{self}')) {
|
|
32
|
+
delete input.projects;
|
|
33
|
+
projectChanged = true;
|
|
34
|
+
}
|
|
35
|
+
else if ('projects' in input &&
|
|
36
|
+
(input.projects === 'dependencies' ||
|
|
37
|
+
input.projects === '{dependencies}')) {
|
|
38
|
+
delete input.projects;
|
|
39
|
+
targetConfiguration.inputs[i] = {
|
|
40
|
+
...input,
|
|
41
|
+
dependencies: true,
|
|
42
|
+
};
|
|
43
|
+
projectChanged = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (projectChanged) {
|
|
49
|
+
(0, project_configuration_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
|
53
|
+
}
|
|
54
|
+
function updateDependsOnAndInputsInsideNxJson(tree) {
|
|
55
|
+
const nxJson = (0, project_configuration_1.readNxJson)(tree);
|
|
56
|
+
let nxJsonChanged = false;
|
|
57
|
+
for (const [target, defaults] of Object.entries(nxJson?.targetDefaults ?? {})) {
|
|
58
|
+
for (const dependency of defaults.dependsOn ?? []) {
|
|
59
|
+
if (typeof dependency !== 'string') {
|
|
60
|
+
if (dependency.projects === 'self' ||
|
|
61
|
+
dependency.projects === '{self}') {
|
|
62
|
+
delete dependency.projects;
|
|
63
|
+
nxJsonChanged = true;
|
|
64
|
+
}
|
|
65
|
+
else if (dependency.projects === 'dependencies' ||
|
|
66
|
+
dependency.projects === '{dependencies}') {
|
|
67
|
+
delete dependency.projects;
|
|
68
|
+
dependency.dependencies = true;
|
|
69
|
+
nxJsonChanged = true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
for (let i = 0; i < (defaults.inputs?.length ?? 0); i++) {
|
|
74
|
+
const input = defaults.inputs[i];
|
|
75
|
+
if (typeof input !== 'string') {
|
|
76
|
+
if ('projects' in input &&
|
|
77
|
+
(input.projects === 'self' || input.projects === '{self}')) {
|
|
78
|
+
delete input.projects;
|
|
79
|
+
nxJsonChanged = true;
|
|
80
|
+
}
|
|
81
|
+
else if ('projects' in input &&
|
|
82
|
+
(input.projects === 'dependencies' ||
|
|
83
|
+
input.projects === '{dependencies}')) {
|
|
84
|
+
delete input.projects;
|
|
85
|
+
defaults.inputs[i] = {
|
|
86
|
+
...input,
|
|
87
|
+
dependencies: true,
|
|
88
|
+
};
|
|
89
|
+
nxJsonChanged = true;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (nxJsonChanged) {
|
|
95
|
+
(0, project_configuration_1.updateNxJson)(tree, nxJson);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-nx-cloud-runner.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/migrations/update-16-0-0/update-nx-cloud-runner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAI7C,yBAA+B,IAAI,EAAE,IAAI,iBAyBxC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
|
5
|
+
const json_1 = require("../../generators/utils/json");
|
|
6
|
+
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
|
7
|
+
async function default_1(tree) {
|
|
8
|
+
(0, json_1.updateJson)(tree, 'package.json', (json) => {
|
|
9
|
+
if (json.dependencies && json.dependencies['@nrwl/nx-cloud']) {
|
|
10
|
+
json.dependencies['nx-cloud'] = json.dependencies['@nrwl/nx-cloud'];
|
|
11
|
+
delete json.dependencies['@nrwl/nx-cloud'];
|
|
12
|
+
}
|
|
13
|
+
if (json.devDependencies && json.devDependencies['@nrwl/nx-cloud']) {
|
|
14
|
+
json.devDependencies['nx-cloud'] = json.devDependencies['@nrwl/nx-cloud'];
|
|
15
|
+
delete json.devDependencies['@nrwl/nx-cloud'];
|
|
16
|
+
}
|
|
17
|
+
return json;
|
|
18
|
+
});
|
|
19
|
+
const nxJson = (0, project_configuration_1.readNxJson)(tree);
|
|
20
|
+
if (!nxJson)
|
|
21
|
+
return;
|
|
22
|
+
for (let opts of Object.values(nxJson.tasksRunnerOptions ?? {})) {
|
|
23
|
+
if (opts.runner === '@nrwl/nx-cloud') {
|
|
24
|
+
opts.runner = 'nx-cloud';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
(0, project_configuration_1.updateNxJson)(tree, nxJson);
|
|
28
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-run-commands-output-path.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/migrations/update-16-2-0/remove-run-commands-output-path.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAO7C,wBAA8B,2BAA2B,CAAC,IAAI,EAAE,IAAI,iBAoBnE"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = removeRunCommandsOutputPath;
|
|
4
|
+
const path_1 = require("../../utils/path");
|
|
5
|
+
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
|
6
|
+
const json_1 = require("../../generators/utils/json");
|
|
7
|
+
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
|
8
|
+
async function removeRunCommandsOutputPath(tree) {
|
|
9
|
+
for (const [project, configuration] of (0, project_configuration_1.getProjects)(tree).entries()) {
|
|
10
|
+
const targets = configuration.targets ?? {};
|
|
11
|
+
let changed = false;
|
|
12
|
+
for (const [, target] of Object.entries(targets)) {
|
|
13
|
+
changed ||= updateTargetBlock(target);
|
|
14
|
+
}
|
|
15
|
+
if (changed) {
|
|
16
|
+
(0, project_configuration_1.updateProjectConfiguration)(tree, project, configuration);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (tree.exists('nx.json')) {
|
|
20
|
+
(0, json_1.updateJson)(tree, 'nx.json', (json) => {
|
|
21
|
+
for (const [, target] of Object.entries(json.targetDefaults ?? {})) {
|
|
22
|
+
updateTargetBlock(target);
|
|
23
|
+
}
|
|
24
|
+
return json;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
|
28
|
+
}
|
|
29
|
+
function updateTargetBlock(target) {
|
|
30
|
+
let changed = false;
|
|
31
|
+
if (target.executor === 'nx:run-commands' && target.options?.outputPath) {
|
|
32
|
+
changed = true;
|
|
33
|
+
const outputs = new Set(target.outputs ?? []);
|
|
34
|
+
outputs.delete('{options.outputPath}');
|
|
35
|
+
const newOutputs = Array.isArray(target.options.outputPath)
|
|
36
|
+
? target.options.outputPath.map((p) => (0, path_1.joinPathFragments)('{workspaceRoot}', p))
|
|
37
|
+
: [(0, path_1.joinPathFragments)('{workspaceRoot}', target.options.outputPath)];
|
|
38
|
+
for (const outputPath of newOutputs) {
|
|
39
|
+
outputs.add(outputPath);
|
|
40
|
+
}
|
|
41
|
+
delete target.options.outputPath;
|
|
42
|
+
target.outputs = Array.from(outputs);
|
|
43
|
+
}
|
|
44
|
+
return changed;
|
|
45
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Tree } from '../../generators/tree';
|
|
2
|
+
/**
|
|
3
|
+
* This function escapes dollar sign in env variables
|
|
4
|
+
* It will go through:
|
|
5
|
+
* - '.env', '.local.env', '.env.local'
|
|
6
|
+
* - .env.[target-name], .[target-name].env
|
|
7
|
+
* - .env.[target-name].[configuration-name], .[target-name].[configuration-name].env
|
|
8
|
+
* - .env.[configuration-name], .[configuration-name].env
|
|
9
|
+
* at each project root and workspace root
|
|
10
|
+
* @param tree
|
|
11
|
+
*/
|
|
12
|
+
export default function escapeDollarSignEnvVariables(tree: Tree): void;
|
|
13
|
+
//# sourceMappingURL=escape-dollar-sign-env-variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escape-dollar-sign-env-variables.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAG7C;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAAC,IAAI,EAAE,IAAI,QAoC9D"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = escapeDollarSignEnvVariables;
|
|
4
|
+
const logger_1 = require("../../utils/logger");
|
|
5
|
+
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
|
6
|
+
/**
|
|
7
|
+
* This function escapes dollar sign in env variables
|
|
8
|
+
* It will go through:
|
|
9
|
+
* - '.env', '.local.env', '.env.local'
|
|
10
|
+
* - .env.[target-name], .[target-name].env
|
|
11
|
+
* - .env.[target-name].[configuration-name], .[target-name].[configuration-name].env
|
|
12
|
+
* - .env.[configuration-name], .[configuration-name].env
|
|
13
|
+
* at each project root and workspace root
|
|
14
|
+
* @param tree
|
|
15
|
+
*/
|
|
16
|
+
function escapeDollarSignEnvVariables(tree) {
|
|
17
|
+
const envFiles = ['.env', '.local.env', '.env.local'];
|
|
18
|
+
for (const [_, configuration] of (0, project_configuration_1.getProjects)(tree).entries()) {
|
|
19
|
+
envFiles.push(`${configuration.root}/.env`, `${configuration.root}/.local.env`, `${configuration.root}/.env.local`);
|
|
20
|
+
for (const targetName in configuration.targets) {
|
|
21
|
+
const task = configuration.targets[targetName];
|
|
22
|
+
envFiles.push(`.env.${targetName}`, `.${targetName}.env`, `${configuration.root}/.env.${targetName}`, `${configuration.root}/.${targetName}.env`);
|
|
23
|
+
if (task.configurations) {
|
|
24
|
+
for (const configurationName in task.configurations) {
|
|
25
|
+
envFiles.push(`.env.${targetName}.${configurationName}`, `.${targetName}.${configurationName}.env`, `.env.${configurationName}`, `.${configurationName}.env`, `${configuration.root}/.env.${targetName}.${configurationName}`, `${configuration.root}/.${targetName}.${configurationName}.env`, `${configuration.root}/.env.${configurationName}`, `${configuration.root}/.${configurationName}.env`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
for (const envFile of new Set(envFiles)) {
|
|
31
|
+
parseEnvFile(tree, envFile);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* This function parse the env file and escape dollar sign
|
|
36
|
+
* @param tree
|
|
37
|
+
* @param envFilePath
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
function parseEnvFile(tree, envFilePath) {
|
|
41
|
+
if (!tree.exists(envFilePath)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
let envFileContent = tree.read(envFilePath, 'utf-8');
|
|
45
|
+
if (!envFileContent) {
|
|
46
|
+
// envFileContent is null if we fail to read the file for any reason
|
|
47
|
+
// e.g. the file is not utf-8 encoded
|
|
48
|
+
logger_1.logger.info(`Unable to update ${envFilePath}. Nx interpolates environment variables in the form of $VAR_NAME. To escape the dollar sign, use \\$VAR_NAME.`);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
envFileContent = envFileContent
|
|
52
|
+
.split('\n')
|
|
53
|
+
.map((line) => {
|
|
54
|
+
line = line.trim();
|
|
55
|
+
if (!line || !line.includes('$')) {
|
|
56
|
+
return line;
|
|
57
|
+
}
|
|
58
|
+
const declarations = line.split('=');
|
|
59
|
+
if (declarations[1].includes('$') && !declarations[1].includes(`\\$`)) {
|
|
60
|
+
declarations[1] = declarations[1].replace('$', `\\$`);
|
|
61
|
+
line = declarations.join('=');
|
|
62
|
+
}
|
|
63
|
+
return line;
|
|
64
|
+
})
|
|
65
|
+
.join('\n');
|
|
66
|
+
tree.write(envFilePath, envFileContent);
|
|
67
|
+
}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lock-file.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/lock-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACL,YAAY,EACZ,wBAAwB,EACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAGzF,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAEL,cAAc,EACf,MAAM,gCAAgC,CAAC;AA8BxC,eAAO,MAAM,SAAS,UAMrB,CAAC;AAQF;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,oBAAoB,GAC5B,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAqC1C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,yBAAyB,GACjC,yBAAyB,EAAE,CA8B7B;AAED,wBAAgB,cAAc,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAgBtE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,CAiBtE;AAED,wBAAgB,eAAe,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,CAgCtE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,YAAY,EACnB,cAAc,GAAE,cAAoD,GACnE,MAAM,
|
|
1
|
+
{"version":3,"file":"lock-file.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/lock-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACL,YAAY,EACZ,wBAAwB,EACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAGzF,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAEL,cAAc,EACf,MAAM,gCAAgC,CAAC;AA8BxC,eAAO,MAAM,SAAS,UAMrB,CAAC;AAQF;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,oBAAoB,GAC5B,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAqC1C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,yBAAyB,GACjC,yBAAyB,EAAE,CA8B7B;AAED,wBAAgB,cAAc,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAgBtE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,CAiBtE;AAED,wBAAgB,eAAe,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,CAgCtE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,YAAY,EACnB,cAAc,GAAE,cAAoD,GACnE,MAAM,CAmDR"}
|
|
@@ -204,7 +204,7 @@ function createLockFile(packageJson, graph, packageManager = (0, package_manager
|
|
|
204
204
|
}
|
|
205
205
|
if (packageManager === 'pnpm') {
|
|
206
206
|
const prunedGraph = (0, project_graph_pruning_1.pruneProjectGraph)(graph, packageJson);
|
|
207
|
-
return (0, pnpm_parser_1.stringifyPnpmLockfile)(prunedGraph, content, normalizedPackageJson);
|
|
207
|
+
return (0, pnpm_parser_1.stringifyPnpmLockfile)(prunedGraph, content, normalizedPackageJson, workspace_root_1.workspaceRoot);
|
|
208
208
|
}
|
|
209
209
|
if (packageManager === 'npm') {
|
|
210
210
|
const prunedGraph = (0, project_graph_pruning_1.pruneProjectGraph)(graph, packageJson);
|
|
@@ -4,5 +4,5 @@ import { ProjectGraph, ProjectGraphExternalNode } from '../../../config/project-
|
|
|
4
4
|
import { CreateDependenciesContext } from '../../../project-graph/plugins';
|
|
5
5
|
export declare function getPnpmLockfileNodes(lockFileContent: string, lockFileHash: string): Record<string, ProjectGraphExternalNode>;
|
|
6
6
|
export declare function getPnpmLockfileDependencies(lockFileContent: string, lockFileHash: string, ctx: CreateDependenciesContext): RawProjectGraphDependency[];
|
|
7
|
-
export declare function stringifyPnpmLockfile(graph: ProjectGraph, rootLockFileContent: string, packageJson: NormalizedPackageJson): string;
|
|
7
|
+
export declare function stringifyPnpmLockfile(graph: ProjectGraph, rootLockFileContent: string, packageJson: NormalizedPackageJson, workspaceRoot: string): string;
|
|
8
8
|
//# sourceMappingURL=pnpm-parser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pnpm-parser.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/pnpm-parser.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,yBAAyB,EAE1B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAEL,YAAY,EACZ,wBAAwB,EACzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"pnpm-parser.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/pnpm-parser.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,yBAAyB,EAE1B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAEL,YAAY,EACZ,wBAAwB,EACzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AA2B3E,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,GACnB,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAS1C;AAED,wBAAgB,2BAA2B,CACzC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,yBAAyB,+BAU/B;AAkUD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,YAAY,EACnB,mBAAmB,EAAE,MAAM,EAC3B,WAAW,EAAE,qBAAqB,EAClC,aAAa,EAAE,MAAM,GACpB,MAAM,CAqCR"}
|
|
@@ -9,6 +9,7 @@ const object_sort_1 = require("../../../utils/object-sort");
|
|
|
9
9
|
const project_graph_builder_1 = require("../../../project-graph/project-graph-builder");
|
|
10
10
|
const project_graph_1 = require("../../../config/project-graph");
|
|
11
11
|
const file_hasher_1 = require("../../../hasher/file-hasher");
|
|
12
|
+
const catalog_1 = require("../../../utils/catalog");
|
|
12
13
|
const project_graph_pruning_1 = require("./project-graph-pruning");
|
|
13
14
|
const path_1 = require("path");
|
|
14
15
|
const get_workspace_packages_from_graph_1 = require("../utils/get-workspace-packages-from-graph");
|
|
@@ -278,10 +279,10 @@ function getDependencies(data, keyMap, isV5, ctx) {
|
|
|
278
279
|
function parseBaseVersion(rawVersion, isV5) {
|
|
279
280
|
return isV5 ? rawVersion.split('_')[0] : rawVersion.split('(')[0];
|
|
280
281
|
}
|
|
281
|
-
function stringifyPnpmLockfile(graph, rootLockFileContent, packageJson) {
|
|
282
|
+
function stringifyPnpmLockfile(graph, rootLockFileContent, packageJson, workspaceRoot) {
|
|
282
283
|
const data = (0, pnpm_normalizer_1.parseAndNormalizePnpmLockfile)(rootLockFileContent);
|
|
283
284
|
const { lockfileVersion, packages, importers } = data;
|
|
284
|
-
const { snapshot: rootSnapshot, importers: requiredImporters } = mapRootSnapshot(packageJson, importers, packages, graph, +lockfileVersion);
|
|
285
|
+
const { snapshot: rootSnapshot, importers: requiredImporters } = mapRootSnapshot(packageJson, importers, packages, graph, +lockfileVersion, workspaceRoot);
|
|
285
286
|
const snapshots = mapSnapshots(data.packages, graph.externalNodes, +lockfileVersion);
|
|
286
287
|
const workspaceDependencyImporters = {};
|
|
287
288
|
for (const [packageName, importerPath] of Object.entries(requiredImporters)) {
|
|
@@ -407,7 +408,7 @@ function versionIsAlias(key, versionExpr, lockfileVersion) {
|
|
|
407
408
|
? key.startsWith(`${packageName}/${version}`)
|
|
408
409
|
: key.startsWith(`${packageName}@${version}`);
|
|
409
410
|
}
|
|
410
|
-
function mapRootSnapshot(packageJson, rootImporters, packages, graph, lockfileVersion) {
|
|
411
|
+
function mapRootSnapshot(packageJson, rootImporters, packages, graph, lockfileVersion, workspaceRoot) {
|
|
411
412
|
const workspaceModules = (0, get_workspace_packages_from_graph_1.getWorkspacePackagesFromGraph)(graph);
|
|
412
413
|
const snapshot = { specifiers: {} };
|
|
413
414
|
const importers = {};
|
|
@@ -419,7 +420,14 @@ function mapRootSnapshot(packageJson, rootImporters, packages, graph, lockfileVe
|
|
|
419
420
|
].forEach((depType) => {
|
|
420
421
|
if (packageJson[depType]) {
|
|
421
422
|
Object.keys(packageJson[depType]).forEach((packageName) => {
|
|
422
|
-
|
|
423
|
+
let version = packageJson[depType][packageName];
|
|
424
|
+
const manager = (0, catalog_1.getCatalogManager)(workspaceRoot);
|
|
425
|
+
if (manager?.isCatalogReference(version)) {
|
|
426
|
+
version = manager.resolveCatalogReference(packageName, version, workspaceRoot);
|
|
427
|
+
if (!version) {
|
|
428
|
+
throw new Error(`Could not resolve catalog reference for package ${packageName}@${version}.`);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
423
431
|
if (workspaceModules.has(packageName)) {
|
|
424
432
|
for (const [importerPath, importerSnapshot] of Object.entries(rootImporters)) {
|
|
425
433
|
const workspaceDep = importerSnapshot.dependencies &&
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ProjectGraph, ProjectGraphExternalNode, ProjectGraphProjectNode } from '../../../config/project-graph';
|
|
2
|
-
import { PackageJson } from '../../../utils/package-json';
|
|
3
2
|
import { ProjectGraphBuilder } from '../../../project-graph/project-graph-builder';
|
|
3
|
+
import { PackageJson } from '../../../utils/package-json';
|
|
4
4
|
/**
|
|
5
5
|
* Prune project graph's external nodes and their dependencies
|
|
6
6
|
* based on the pruned package.json
|
|
7
7
|
*/
|
|
8
|
-
export declare function pruneProjectGraph(graph: ProjectGraph, prunedPackageJson: PackageJson): ProjectGraph;
|
|
8
|
+
export declare function pruneProjectGraph(graph: ProjectGraph, prunedPackageJson: PackageJson, workspaceRootPath?: string): ProjectGraph;
|
|
9
9
|
export declare function findNodeMatchingVersion(graph: ProjectGraph, packageName: string, versionExpr: string): ProjectGraphExternalNode;
|
|
10
10
|
export declare function addNodesAndDependencies(graph: ProjectGraph, packageJsonDeps: Record<string, string>, workspacePackages: Map<string, ProjectGraphProjectNode>, builder: ProjectGraphBuilder): void;
|
|
11
11
|
export declare function rehoistNodes(graph: ProjectGraph, packageJsonDeps: Record<string, string>, builder: ProjectGraphBuilder): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-graph-pruning.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/project-graph-pruning.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project-graph-pruning.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/project-graph-pruning.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnF,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAI1D;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,YAAY,EACnB,iBAAiB,EAAE,WAAW,EAC9B,iBAAiB,GAAE,MAAsB,GACxC,YAAY,CA2Bd;AA0ED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,YAAY,EACnB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,4BAsBpB;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,YAAY,EACnB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,EACvD,OAAO,EAAE,mBAAmB,QAgB7B;AA+BD,wBAAgB,YAAY,CAC1B,KAAK,EAAE,YAAY,EACnB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,OAAO,EAAE,mBAAmB,QAiD7B"}
|
|
@@ -5,17 +5,19 @@ exports.findNodeMatchingVersion = findNodeMatchingVersion;
|
|
|
5
5
|
exports.addNodesAndDependencies = addNodesAndDependencies;
|
|
6
6
|
exports.rehoistNodes = rehoistNodes;
|
|
7
7
|
const semver_1 = require("semver");
|
|
8
|
-
const project_graph_builder_1 = require("../../../project-graph/project-graph-builder");
|
|
9
8
|
const operators_1 = require("../../../project-graph/operators");
|
|
9
|
+
const project_graph_builder_1 = require("../../../project-graph/project-graph-builder");
|
|
10
|
+
const catalog_1 = require("../../../utils/catalog");
|
|
11
|
+
const workspace_root_1 = require("../../../utils/workspace-root");
|
|
10
12
|
const get_workspace_packages_from_graph_1 = require("../utils/get-workspace-packages-from-graph");
|
|
11
13
|
/**
|
|
12
14
|
* Prune project graph's external nodes and their dependencies
|
|
13
15
|
* based on the pruned package.json
|
|
14
16
|
*/
|
|
15
|
-
function pruneProjectGraph(graph, prunedPackageJson) {
|
|
17
|
+
function pruneProjectGraph(graph, prunedPackageJson, workspaceRootPath = workspace_root_1.workspaceRoot) {
|
|
16
18
|
const builder = new project_graph_builder_1.ProjectGraphBuilder();
|
|
17
19
|
const workspacePackages = (0, get_workspace_packages_from_graph_1.getWorkspacePackagesFromGraph)(graph);
|
|
18
|
-
const combinedDependencies = normalizeDependencies(prunedPackageJson, graph, workspacePackages);
|
|
20
|
+
const combinedDependencies = normalizeDependencies(prunedPackageJson, graph, workspacePackages, workspaceRootPath);
|
|
19
21
|
addNodesAndDependencies(graph, combinedDependencies, workspacePackages, builder);
|
|
20
22
|
for (const project of workspacePackages.values()) {
|
|
21
23
|
const node = graph.nodes[project.name];
|
|
@@ -28,7 +30,7 @@ function pruneProjectGraph(graph, prunedPackageJson) {
|
|
|
28
30
|
}
|
|
29
31
|
// ensure that dependency ranges from package.json (e.g. ^1.0.0)
|
|
30
32
|
// are replaced with the actual version based on the available nodes (e.g. 1.0.1)
|
|
31
|
-
function normalizeDependencies(packageJson, graph, workspacePackages) {
|
|
33
|
+
function normalizeDependencies(packageJson, graph, workspacePackages, workspaceRootPath) {
|
|
32
34
|
const { dependencies, devDependencies, optionalDependencies, peerDependencies, } = packageJson;
|
|
33
35
|
const combinedDependencies = {
|
|
34
36
|
...dependencies,
|
|
@@ -37,24 +39,35 @@ function normalizeDependencies(packageJson, graph, workspacePackages) {
|
|
|
37
39
|
...peerDependencies,
|
|
38
40
|
};
|
|
39
41
|
Object.entries(combinedDependencies).forEach(([packageName, versionRange]) => {
|
|
40
|
-
|
|
42
|
+
let resolvedVersionRange = versionRange;
|
|
43
|
+
const manager = (0, catalog_1.getCatalogManager)(workspaceRootPath);
|
|
44
|
+
if (manager?.isCatalogReference(versionRange)) {
|
|
45
|
+
const resolvedVersionRange = manager.resolveCatalogReference(packageName, versionRange, workspaceRootPath);
|
|
46
|
+
if (!resolvedVersionRange) {
|
|
47
|
+
throw new Error(`Could not resolve catalog reference for ${packageName}@${versionRange}.`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (graph.externalNodes[`npm:${packageName}@${resolvedVersionRange}`]) {
|
|
51
|
+
combinedDependencies[packageName] = resolvedVersionRange;
|
|
41
52
|
return;
|
|
42
53
|
}
|
|
43
54
|
if (graph.externalNodes[`npm:${packageName}`] &&
|
|
44
|
-
graph.externalNodes[`npm:${packageName}`].data.version ===
|
|
55
|
+
graph.externalNodes[`npm:${packageName}`].data.version ===
|
|
56
|
+
resolvedVersionRange) {
|
|
57
|
+
combinedDependencies[packageName] = resolvedVersionRange;
|
|
45
58
|
return;
|
|
46
59
|
}
|
|
47
60
|
// otherwise we need to find the correct version
|
|
48
|
-
const node = findNodeMatchingVersion(graph, packageName,
|
|
61
|
+
const node = findNodeMatchingVersion(graph, packageName, resolvedVersionRange);
|
|
49
62
|
if (node) {
|
|
50
63
|
combinedDependencies[packageName] = node.data.version;
|
|
51
64
|
}
|
|
52
65
|
else if (workspacePackages.has(packageName)) {
|
|
53
66
|
// workspace module, leave as is
|
|
54
|
-
combinedDependencies[packageName] =
|
|
67
|
+
combinedDependencies[packageName] = resolvedVersionRange;
|
|
55
68
|
}
|
|
56
69
|
else {
|
|
57
|
-
throw new Error(`Pruned lock file creation failed. The following package was not found in the root lock file: ${packageName}@${
|
|
70
|
+
throw new Error(`Pruned lock file creation failed. The following package was not found in the root lock file: ${packageName}@${resolvedVersionRange}`);
|
|
58
71
|
}
|
|
59
72
|
});
|
|
60
73
|
return combinedDependencies;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-package-json.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/package-json/create-package-json.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,cAAc,EACd,YAAY,EACZ,uBAAuB,EACxB,MAAM,+BAA+B,CAAC;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"create-package-json.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/package-json/create-package-json.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,cAAc,EACd,YAAY,EACZ,uBAAuB,EACxB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,WAAW,EACZ,MAAM,6BAA6B,CAAC;AAYrC,UAAU,OAAO;IACf,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClD,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACtE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,YAAY,EACnB,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;CACpB,EACN,OAAO,GAAE,cAAqB,GAC7B,WAAW,CA6Mb;AAED,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,uBAAuB,EACpC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,WAAW,EAC5B,OAAO,EAAE;IACP,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,EACD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CA8CT"}
|