nx 23.1.0 → 23.1.2
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/dist/bin/nx.js +2 -1
- package/dist/release/changelog-renderer/index.js +4 -5
- package/dist/release/index.d.ts +1 -1
- package/dist/src/ai/configure-ai-agents-disclaimer.d.ts +5 -0
- package/dist/src/ai/configure-ai-agents-disclaimer.js +31 -0
- package/dist/src/analytics/analytics.d.ts +6 -0
- package/dist/src/analytics/analytics.js +16 -8
- package/dist/src/analytics/index.d.ts +1 -1
- package/dist/src/analytics/index.js +2 -1
- package/dist/src/command-line/add/add.js +13 -1
- package/dist/src/command-line/affected/affected.js +1 -0
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +2 -2
- package/dist/src/command-line/graph/graph.d.ts +1 -0
- package/dist/src/command-line/graph/graph.js +15 -6
- package/dist/src/command-line/import/import.js +2 -3
- package/dist/src/command-line/init/ai-agent-prompts.d.ts +1 -1
- package/dist/src/command-line/init/ai-agent-prompts.js +7 -6
- package/dist/src/command-line/init/command-object.js +10 -2
- package/dist/src/command-line/init/configure-plugins.js +3 -2
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +4 -2
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +4 -3
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +4 -3
- package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +4 -3
- package/dist/src/command-line/init/implementation/angular/index.js +4 -2
- package/dist/src/command-line/init/implementation/angular/integrated-workspace.js +2 -5
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +3 -0
- package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +4 -1
- package/dist/src/command-line/init/implementation/utils.d.ts +3 -3
- package/dist/src/command-line/init/implementation/utils.js +22 -3
- package/dist/src/command-line/init/init-v2.js +4 -5
- package/dist/src/command-line/migrate/execute-migration.d.ts +72 -0
- package/dist/src/command-line/migrate/execute-migration.js +389 -0
- package/dist/src/command-line/migrate/migrate-ui-api.js +17 -12
- package/dist/src/command-line/migrate/migrate.d.ts +5 -45
- package/dist/src/command-line/migrate/migrate.js +122 -402
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +1 -1
- package/dist/src/command-line/nx-cloud/connect/view-logs.js +2 -0
- package/dist/src/command-line/release/changelog.js +5 -0
- package/dist/src/command-line/release/index.d.ts +1 -1
- package/dist/src/command-line/release/utils/git.js +7 -3
- package/dist/src/command-line/release/utils/release-graph.d.ts +19 -2
- package/dist/src/command-line/release/utils/release-graph.js +71 -19
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +7 -1
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +1 -1
- package/dist/src/command-line/release/utils/shared.d.ts +2 -2
- package/dist/src/command-line/release/version/release-group-processor.d.ts +24 -0
- package/dist/src/command-line/release/version/release-group-processor.js +80 -6
- package/dist/src/command-line/release/version/version-actions.d.ts +27 -2
- package/dist/src/command-line/release/version/version-actions.js +9 -1
- package/dist/src/command-line/release/version.js +9 -5
- package/dist/src/command-line/reset/reset.js +6 -1
- package/dist/src/command-line/run/run-one.js +1 -0
- package/dist/src/command-line/run-many/run-many.js +1 -0
- package/dist/src/command-line/show/show-target/info.js +11 -2
- package/dist/src/command-line/show/show-target/inputs.js +50 -153
- package/dist/src/command-line/show/show-target/outputs.js +48 -173
- package/dist/src/command-line/show/show-target/utils.d.ts +28 -0
- package/dist/src/command-line/show/show-target/utils.js +83 -3
- package/dist/src/command-line/watch/watch.js +13 -0
- package/dist/src/command-line/yargs-utils/shared-options.d.ts +1 -1
- package/dist/src/commands-runner/create-command-graph.js +5 -0
- package/dist/src/config/nx-json.d.ts +5 -3
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +52 -3
- package/dist/src/daemon/client/client.js +177 -55
- package/dist/src/daemon/client/daemon-environment.d.ts +17 -0
- package/dist/src/daemon/client/daemon-environment.js +110 -2
- package/dist/src/daemon/client/daemon-socket-messenger.js +4 -0
- package/dist/src/daemon/message-types/daemon-message.d.ts +32 -0
- package/dist/src/daemon/message-types/daemon-message.js +25 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.d.ts +5 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +16 -0
- package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +1 -1
- package/dist/src/daemon/server/latest-nx.js +5 -2
- package/dist/src/daemon/server/server.js +31 -4
- package/dist/src/daemon/server/shutdown-utils.d.ts +5 -0
- package/dist/src/daemon/server/shutdown-utils.js +11 -4
- package/dist/src/daemon/socket-utils.d.ts +1 -0
- package/dist/src/daemon/socket-utils.js +24 -3
- package/dist/src/daemon/tmp-dir.d.ts +43 -3
- package/dist/src/daemon/tmp-dir.js +437 -15
- package/dist/src/devkit-internals.d.ts +96 -3
- package/dist/src/devkit-internals.js +200 -4
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +5 -0
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +9 -2
- package/dist/src/generators/tree.d.ts +4 -2
- package/dist/src/generators/utils/nx-json.js +13 -3
- package/dist/src/hasher/check-task-files.d.ts +86 -0
- package/dist/src/hasher/check-task-files.js +378 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +12 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +250 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +50 -0
- package/dist/src/native/index.d.ts +31 -2
- package/dist/src/native/index.js +71 -28
- package/dist/src/native/native-bindings.js +3 -0
- package/dist/src/native/native-file-cache-location.d.ts +17 -1
- package/dist/src/native/native-file-cache-location.js +86 -12
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/nx-cloud/utilities/get-cloud-options.js +5 -2
- package/dist/src/nx-cloud/utilities/onboarding.js +5 -2
- package/dist/src/plugins/js/lock-file/bun-parser.js +43 -10
- package/dist/src/plugins/js/lock-file/npm-parser.js +71 -27
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +110 -17
- package/dist/src/plugins/js/lock-file/project-graph-pruning.js +15 -9
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +3 -0
- package/dist/src/plugins/js/lock-file/yarn-parser.js +32 -5
- package/dist/src/plugins/js/project-graph/affected/npm-packages.js +51 -20
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +14 -4
- package/dist/src/plugins/js/utils/register.d.ts +18 -0
- package/dist/src/plugins/js/utils/register.js +81 -0
- package/dist/src/plugins/js/utils/typescript.d.ts +9 -0
- package/dist/src/plugins/js/utils/typescript.js +15 -0
- package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +1 -1
- package/dist/src/project-graph/affected/affected-project-graph.d.ts +1 -1
- package/dist/src/project-graph/affected/affected-project-graph.js +2 -2
- package/dist/src/project-graph/affected/locators/project-glob-changes.js +5 -2
- package/dist/src/project-graph/build-project-graph.js +7 -1
- package/dist/src/project-graph/error-types.d.ts +12 -1
- package/dist/src/project-graph/error-types.js +68 -3
- package/dist/src/project-graph/file-utils.js +6 -1
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +22 -1
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +16 -3
- package/dist/src/project-graph/plugins/isolation/messaging.js +3 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +58 -8
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +1 -0
- package/dist/src/project-graph/plugins/transpiler.js +4 -0
- package/dist/src/project-graph/project-graph.js +23 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +10 -12
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.js +93 -63
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +5 -8
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +16 -15
- package/dist/src/project-graph/utils/project-configuration/source-maps.d.ts +12 -5
- package/dist/src/project-graph/utils/project-configuration/source-maps.js +21 -7
- package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-defaults.js +26 -27
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +50 -8
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +149 -6
- package/dist/src/project-graph/utils/project-configuration/utils.d.ts +15 -0
- package/dist/src/project-graph/utils/project-configuration/utils.js +42 -6
- package/dist/src/project-graph/utils/project-configuration-utils.d.ts +15 -12
- package/dist/src/project-graph/utils/project-configuration-utils.js +79 -101
- package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +11 -4
- package/dist/src/tasks-runner/life-cycles/performance-analysis.js +15 -6
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +5 -4
- package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +18 -8
- package/dist/src/tasks-runner/life-cycles/performance-report.js +66 -29
- package/dist/src/tasks-runner/run-command.js +4 -2
- package/dist/src/tasks-runner/task-env.d.ts +9 -0
- package/dist/src/tasks-runner/task-env.js +31 -4
- package/dist/src/tasks-runner/task-orchestrator.d.ts +4 -1
- package/dist/src/tasks-runner/task-orchestrator.js +23 -10
- package/dist/src/tasks-runner/utils.js +2 -6
- package/dist/src/utils/acknowledge-build-scripts.d.ts +13 -0
- package/dist/src/utils/acknowledge-build-scripts.js +102 -0
- package/dist/src/utils/analytics-prompt.d.ts +0 -6
- package/dist/src/utils/analytics-prompt.js +0 -51
- package/dist/src/utils/assert-workspace-validity.js +7 -2
- package/dist/src/utils/catalog/manager-utils.d.ts +1 -2
- package/dist/src/utils/catalog/manager-utils.js +22 -5
- package/dist/src/utils/catalog/pnpm-manager.d.ts +1 -0
- package/dist/src/utils/catalog/pnpm-manager.js +3 -15
- package/dist/src/utils/catalog/yarn-manager.d.ts +1 -0
- package/dist/src/utils/catalog/yarn-manager.js +3 -15
- package/dist/src/utils/command-line-utils.js +30 -20
- package/dist/src/utils/fileutils.d.ts +5 -0
- package/dist/src/utils/fileutils.js +7 -2
- package/dist/src/utils/git-revision.d.ts +12 -0
- package/dist/src/utils/git-revision.js +25 -0
- package/dist/src/utils/git-utils.d.ts +16 -3
- package/dist/src/utils/git-utils.js +146 -52
- package/dist/src/utils/git-worktrees.d.ts +30 -0
- package/dist/src/utils/git-worktrees.js +212 -0
- package/dist/src/utils/ignore.d.ts +128 -1
- package/dist/src/utils/ignore.js +182 -12
- package/dist/src/utils/long-running-target.d.ts +10 -0
- package/dist/src/utils/long-running-target.js +19 -0
- package/dist/src/utils/min-release-age/behavior/bun.js +7 -11
- package/dist/src/utils/min-release-age/behavior/npm.js +5 -2
- package/dist/src/utils/min-release-age/behavior/pnpm.js +9 -7
- package/dist/src/utils/min-release-age/packument.js +1 -1
- package/dist/src/utils/nx-tmp-dir.d.ts +18 -0
- package/dist/src/utils/nx-tmp-dir.js +40 -0
- package/dist/src/utils/owned-private-dir.d.ts +132 -0
- package/dist/src/utils/owned-private-dir.js +323 -0
- package/dist/src/utils/package-json.js +11 -7
- package/dist/src/utils/package-manager-config/bunfig.d.ts +14 -0
- package/dist/src/utils/package-manager-config/bunfig.js +49 -0
- package/dist/src/utils/package-manager-config/npmrc.d.ts +23 -0
- package/dist/src/utils/package-manager-config/npmrc.js +124 -0
- package/dist/src/utils/package-manager-config/pnpm-config.d.ts +17 -0
- package/dist/src/utils/package-manager-config/pnpm-config.js +60 -0
- package/dist/src/utils/package-manager.d.ts +23 -2
- package/dist/src/utils/package-manager.js +264 -43
- package/dist/src/utils/provenance.js +18 -16
- package/dist/src/utils/registry-config/bun.d.ts +2 -0
- package/dist/src/utils/registry-config/bun.js +257 -0
- package/dist/src/utils/registry-config/index.d.ts +13 -0
- package/dist/src/utils/registry-config/index.js +102 -0
- package/dist/src/utils/registry-config/pnpm.d.ts +2 -0
- package/dist/src/utils/registry-config/pnpm.js +1551 -0
- package/dist/src/utils/registry-config/utils.d.ts +195 -0
- package/dist/src/utils/registry-config/utils.js +496 -0
- package/dist/src/utils/registry-config/yarn-berry.d.ts +2 -0
- package/dist/src/utils/registry-config/yarn-berry.js +612 -0
- package/dist/src/utils/registry-config/yarn-classic.d.ts +2 -0
- package/dist/src/utils/registry-config/yarn-classic.js +1001 -0
- package/dist/src/utils/safe-spawn.d.ts +24 -0
- package/dist/src/utils/safe-spawn.js +104 -0
- package/dist/src/utils/shell-quoting.d.ts +15 -0
- package/dist/src/utils/shell-quoting.js +35 -0
- package/dist/src/utils/wait-for-socket-connection.d.ts +11 -0
- package/dist/src/utils/wait-for-socket-connection.js +14 -8
- package/dist/src/utils/workspace-id.d.ts +20 -0
- package/dist/src/utils/workspace-id.js +54 -0
- package/migrations.json +13 -1
- package/package.json +22 -17
- package/dist/src/migrations/update-17-3-0/nx-release-path.d.ts +0 -3
- package/dist/src/migrations/update-17-3-0/nx-release-path.js +0 -47
- package/dist/src/utils/min-release-age/npmrc.d.ts +0 -15
- package/dist/src/utils/min-release-age/npmrc.js +0 -45
|
@@ -26,7 +26,6 @@ const workspace_root_1 = require("../../../utils/workspace-root");
|
|
|
26
26
|
const git_utils_1 = require("../../../utils/git-utils");
|
|
27
27
|
const pc = tslib_1.__importStar(require("picocolors"));
|
|
28
28
|
const ora = require('ora');
|
|
29
|
-
const open = require('open');
|
|
30
29
|
function onlyDefaultRunnerIsUsed(nxJson) {
|
|
31
30
|
const defaultRunner = nxJson.tasksRunnerOptions?.default?.runner;
|
|
32
31
|
if (!defaultRunner) {
|
|
@@ -161,6 +160,7 @@ async function runConnectToNxCloud(options, command) {
|
|
|
161
160
|
try {
|
|
162
161
|
const cloudConnectSpinner = ora(`Opening Nx Cloud ${connectCloudUrl} in your browser to connect your workspace.`).start();
|
|
163
162
|
await sleep(2000);
|
|
163
|
+
const { default: open } = await new Function('return import("open")')();
|
|
164
164
|
await open(connectCloudUrl);
|
|
165
165
|
cloudConnectSpinner.succeed();
|
|
166
166
|
}
|
|
@@ -39,6 +39,8 @@ async function viewLogs() {
|
|
|
39
39
|
return 1;
|
|
40
40
|
}
|
|
41
41
|
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
|
42
|
+
// Intentionally not runNxSync: this invokes the separate `nx-cloud` binary,
|
|
43
|
+
// not the nx CLI that runNxSync resolves.
|
|
42
44
|
(0, child_process_1.execSync)(`${pmc.exec} nx-cloud upload-and-show-run-details`, {
|
|
43
45
|
stdio: [0, 1, 2],
|
|
44
46
|
windowsHide: true,
|
|
@@ -305,6 +305,11 @@ function createAPI(overrideReleaseConfig, ignoreNxJsonConfig) {
|
|
|
305
305
|
const projectNodes = projects.map((name) => projectGraph.nodes[name]);
|
|
306
306
|
if (releaseGroup.projectsRelationship === 'independent') {
|
|
307
307
|
for (const project of projectNodes) {
|
|
308
|
+
if (!projectsVersionData[project.name] ||
|
|
309
|
+
(projectsVersionData[project.name].newVersion === null &&
|
|
310
|
+
!projectsVersionData[project.name].dockerVersion)) {
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
308
313
|
let changes = null;
|
|
309
314
|
if (releaseGroup.resolvedVersionPlans) {
|
|
310
315
|
changes = (0, version_plan_utils_1.createChangesFromProjectsVersionPlans)(releaseGroup.resolvedVersionPlans, project.name);
|
|
@@ -46,4 +46,4 @@ export declare const release: typeof defaultClient.release;
|
|
|
46
46
|
/**
|
|
47
47
|
* @public
|
|
48
48
|
*/
|
|
49
|
-
export { AfterAllProjectsVersioned, VersionActions, } from './version/version-actions';
|
|
49
|
+
export { AfterAllProjectsVersioned, ResolveVersionForDependency, VersionActions, } from './version/version-actions';
|
|
@@ -443,8 +443,10 @@ function extractReferencesFromCommit(commit) {
|
|
|
443
443
|
references.push({ type: 'issue', value: m[1] });
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
|
-
// Extract issue references from commit body
|
|
447
|
-
|
|
446
|
+
// Extract issue references from commit body, only when linked via a closing
|
|
447
|
+
// keyword so that other repos' issue numbers mentioned in prose are not
|
|
448
|
+
// picked up (e.g. "web-infra-dev/rspack#2292")
|
|
449
|
+
for (const m of commit.body.matchAll(IssueClosingKeywordRE)) {
|
|
448
450
|
if (!references.some((i) => i.value === m[1])) {
|
|
449
451
|
references.push({ type: 'issue', value: m[1] });
|
|
450
452
|
}
|
|
@@ -466,13 +468,15 @@ function getAllAuthorsForCommit(commit) {
|
|
|
466
468
|
}
|
|
467
469
|
// https://www.conventionalcommits.org/en/v1.0.0/
|
|
468
470
|
// https://regex101.com/r/FSfNvA/1
|
|
469
|
-
const ConventionalCommitRegex =
|
|
471
|
+
const ConventionalCommitRegex = /^(?<type>[^\s():!]+)(?:\s*\((?<scope>.+)\))?(?<breaking>!)?: (?<description>.+)$/u;
|
|
470
472
|
const CoAuthoredByRegex = /co-authored-by:\s*(?<name>.+)(<(?<email>.+)>)/gim;
|
|
471
473
|
// GitHub style PR references
|
|
472
474
|
const PullRequestRE = /\([ a-z]*(#\d+)\s*\)/gm;
|
|
473
475
|
// GitLab style merge request references
|
|
474
476
|
const GitLabMergeRequestRE = /See merge request (?:[a-z0-9/-]+)?(![\d]+)/gim;
|
|
475
477
|
const IssueRE = /(#\d+)/gm;
|
|
478
|
+
// GitHub style issue closing keywords, e.g. "Fixes #1234"
|
|
479
|
+
const IssueClosingKeywordRE = /\b(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?):?\s+(#\d+)/gim;
|
|
476
480
|
const ChangedFileRegex = /(A|M|D|R\d*|C\d*)\t([^\t\n]*)\t?(.*)?/gm;
|
|
477
481
|
const RevertHashRE = /This reverts commit (?<hash>[\da-f]{40})./gm;
|
|
478
482
|
function parseVersionPlanCommit(commit) {
|
|
@@ -86,8 +86,8 @@ export declare class ReleaseGraph {
|
|
|
86
86
|
source: string;
|
|
87
87
|
target: string;
|
|
88
88
|
type: string;
|
|
89
|
-
dependencyCollection: string;
|
|
90
|
-
rawVersionSpec: string;
|
|
89
|
+
dependencyCollection: string | null;
|
|
90
|
+
rawVersionSpec: string | null;
|
|
91
91
|
}[]>;
|
|
92
92
|
readonly releaseGroupToFilteredProjects: Map<ReleaseGroupWithName, Set<string>>;
|
|
93
93
|
private originalFilteredProjects;
|
|
@@ -161,6 +161,23 @@ export declare class ReleaseGraph {
|
|
|
161
161
|
* Resolve current versions for all projects that will be processed
|
|
162
162
|
*/
|
|
163
163
|
private resolveCurrentVersionsForProjects;
|
|
164
|
+
/**
|
|
165
|
+
* Resolve the current version of a single project via its configured
|
|
166
|
+
* `currentVersionResolver` (honoring `fallbackCurrentVersionResolver`),
|
|
167
|
+
* performing the git-tag lookup when applicable.
|
|
168
|
+
*
|
|
169
|
+
* Extracted from `resolveCurrentVersionsForProjects` so it can also be
|
|
170
|
+
* invoked on-demand for projects that are NOT part of `allProjectsToProcess`.
|
|
171
|
+
*/
|
|
172
|
+
private resolveCurrentVersionForProject;
|
|
173
|
+
/**
|
|
174
|
+
* Resolve and cache the current version of a dependency that is not already
|
|
175
|
+
* being versioned. Ecosystem-specific VersionActions call this lazily when
|
|
176
|
+
* they need a concrete version that is absent from `dependenciesToUpdate`.
|
|
177
|
+
*
|
|
178
|
+
* @internal
|
|
179
|
+
*/
|
|
180
|
+
resolveCurrentVersionForDependency(tree: Tree, projectGraph: ProjectGraph, projectName: string, preid: string): Promise<string>;
|
|
164
181
|
/**
|
|
165
182
|
* Build dependency relationships between release groups
|
|
166
183
|
*/
|
|
@@ -373,31 +373,79 @@ class ReleaseGraph {
|
|
|
373
373
|
async resolveCurrentVersionsForProjects(tree, projectGraph, preid) {
|
|
374
374
|
for (const [, releaseGroupNode] of this.groupGraph) {
|
|
375
375
|
for (const projectName of releaseGroupNode.group.projects) {
|
|
376
|
-
const projectGraphNode = projectGraph.nodes[projectName];
|
|
377
376
|
if (!this.allProjectsToProcess.has(projectName)) {
|
|
378
377
|
continue;
|
|
379
378
|
}
|
|
380
|
-
const
|
|
381
|
-
const finalConfigForProject = this.finalConfigsByProject.get(projectName);
|
|
382
|
-
let latestMatchingGitTag;
|
|
383
|
-
const releaseTagPattern = releaseGroupNode.group.releaseTag.pattern;
|
|
384
|
-
if (finalConfigForProject.currentVersionResolver === 'git-tag') {
|
|
385
|
-
latestMatchingGitTag = await (0, git_1.getLatestGitTagForPattern)(releaseTagPattern, {
|
|
386
|
-
projectName: (0, git_1.sanitizeProjectNameForGitTag)(projectGraphNode.name),
|
|
387
|
-
releaseGroupName: releaseGroupNode.group.name,
|
|
388
|
-
}, this.resolveRepositoryTags.bind(this), {
|
|
389
|
-
checkAllBranchesWhen: releaseGroupNode.group.releaseTag.checkAllBranchesWhen,
|
|
390
|
-
preid: preid,
|
|
391
|
-
requireSemver: releaseGroupNode.group.releaseTag.requireSemver,
|
|
392
|
-
strictPreid: releaseGroupNode.group.releaseTag.strictPreid,
|
|
393
|
-
});
|
|
394
|
-
this.cachedLatestMatchingGitTag.set(projectName, latestMatchingGitTag);
|
|
395
|
-
}
|
|
396
|
-
const currentVersion = await (0, resolve_current_version_1.resolveCurrentVersion)(tree, projectGraphNode, releaseGroupNode.group, versionActions, this.projectLoggers.get(projectName), this.currentVersionsPerFixedReleaseGroup, finalConfigForProject, releaseTagPattern, latestMatchingGitTag);
|
|
379
|
+
const currentVersion = await this.resolveCurrentVersionForProject(tree, projectGraph, releaseGroupNode.group, projectName, preid);
|
|
397
380
|
this.cachedCurrentVersions.set(projectName, currentVersion);
|
|
398
381
|
}
|
|
399
382
|
}
|
|
400
383
|
}
|
|
384
|
+
/**
|
|
385
|
+
* Resolve the current version of a single project via its configured
|
|
386
|
+
* `currentVersionResolver` (honoring `fallbackCurrentVersionResolver`),
|
|
387
|
+
* performing the git-tag lookup when applicable.
|
|
388
|
+
*
|
|
389
|
+
* Extracted from `resolveCurrentVersionsForProjects` so it can also be
|
|
390
|
+
* invoked on-demand for projects that are NOT part of `allProjectsToProcess`.
|
|
391
|
+
*/
|
|
392
|
+
async resolveCurrentVersionForProject(tree, projectGraph, releaseGroup, projectName, preid) {
|
|
393
|
+
const projectGraphNode = projectGraph.nodes[projectName];
|
|
394
|
+
const versionActions = this.projectsToVersionActions.get(projectName);
|
|
395
|
+
const finalConfigForProject = this.finalConfigsByProject.get(projectName);
|
|
396
|
+
let latestMatchingGitTag;
|
|
397
|
+
const releaseTagPattern = releaseGroup.releaseTag.pattern;
|
|
398
|
+
if (finalConfigForProject.currentVersionResolver === 'git-tag') {
|
|
399
|
+
latestMatchingGitTag = await (0, git_1.getLatestGitTagForPattern)(releaseTagPattern, {
|
|
400
|
+
projectName: (0, git_1.sanitizeProjectNameForGitTag)(projectGraphNode.name),
|
|
401
|
+
releaseGroupName: releaseGroup.name,
|
|
402
|
+
}, this.resolveRepositoryTags.bind(this), {
|
|
403
|
+
checkAllBranchesWhen: releaseGroup.releaseTag.checkAllBranchesWhen,
|
|
404
|
+
preid: preid,
|
|
405
|
+
requireSemver: releaseGroup.releaseTag.requireSemver,
|
|
406
|
+
strictPreid: releaseGroup.releaseTag.strictPreid,
|
|
407
|
+
});
|
|
408
|
+
this.cachedLatestMatchingGitTag.set(projectName, latestMatchingGitTag);
|
|
409
|
+
}
|
|
410
|
+
return (0, resolve_current_version_1.resolveCurrentVersion)(tree, projectGraphNode, releaseGroup, versionActions, this.projectLoggers.get(projectName), this.currentVersionsPerFixedReleaseGroup, finalConfigForProject, releaseTagPattern, latestMatchingGitTag);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Resolve and cache the current version of a dependency that is not already
|
|
414
|
+
* being versioned. Ecosystem-specific VersionActions call this lazily when
|
|
415
|
+
* they need a concrete version that is absent from `dependenciesToUpdate`.
|
|
416
|
+
*
|
|
417
|
+
* @internal
|
|
418
|
+
*/
|
|
419
|
+
async resolveCurrentVersionForDependency(tree, projectGraph, projectName, preid) {
|
|
420
|
+
if (this.cachedCurrentVersions.has(projectName)) {
|
|
421
|
+
const currentVersion = this.cachedCurrentVersions.get(projectName);
|
|
422
|
+
if (currentVersion) {
|
|
423
|
+
return currentVersion;
|
|
424
|
+
}
|
|
425
|
+
const currentVersionResolver = this.finalConfigsByProject.get(projectName)?.currentVersionResolver;
|
|
426
|
+
throw new Error(`Cannot resolve a concrete current version for dependency project "${projectName}" because its "currentVersionResolver" is set to "${currentVersionResolver}" and did not resolve a version. Configure a resolver that can determine the current version.`);
|
|
427
|
+
}
|
|
428
|
+
const releaseGroup = this.projectToReleaseGroup.get(projectName);
|
|
429
|
+
if (!releaseGroup ||
|
|
430
|
+
!this.projectsToVersionActions.has(projectName) ||
|
|
431
|
+
!this.finalConfigsByProject.has(projectName)) {
|
|
432
|
+
throw new Error(`Cannot resolve a concrete current version for dependency project "${projectName}" because it is not configured for Nx Release. Include the project in an Nx Release group so that its current version resolver can be configured.`);
|
|
433
|
+
}
|
|
434
|
+
let currentVersion;
|
|
435
|
+
try {
|
|
436
|
+
currentVersion = await this.resolveCurrentVersionForProject(tree, projectGraph, releaseGroup, projectName, preid);
|
|
437
|
+
}
|
|
438
|
+
catch (err) {
|
|
439
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
440
|
+
throw new Error(`Cannot resolve a concrete current version for dependency project "${projectName}". ${errorMessage}`);
|
|
441
|
+
}
|
|
442
|
+
if (!currentVersion) {
|
|
443
|
+
const finalConfigForProject = this.finalConfigsByProject.get(projectName);
|
|
444
|
+
throw new Error(`Cannot resolve a concrete current version for dependency project "${projectName}" because its "currentVersionResolver" is set to "${finalConfigForProject.currentVersionResolver}" and did not resolve a version. Configure a resolver that can determine the current version.`);
|
|
445
|
+
}
|
|
446
|
+
this.cachedCurrentVersions.set(projectName, currentVersion);
|
|
447
|
+
return currentVersion;
|
|
448
|
+
}
|
|
401
449
|
/**
|
|
402
450
|
* Build dependency relationships between release groups
|
|
403
451
|
*/
|
|
@@ -662,7 +710,11 @@ Valid values are: ${exports.validReleaseVersionPrefixes
|
|
|
662
710
|
head: commit.shortHash,
|
|
663
711
|
});
|
|
664
712
|
// Use the same affected detection logic as `nx affected`
|
|
665
|
-
affectedGraph = await (0, affected_project_graph_1.filterAffected)(projectGraph, touchedFiles
|
|
713
|
+
affectedGraph = await (0, affected_project_graph_1.filterAffected)(projectGraph, touchedFiles, undefined, undefined,
|
|
714
|
+
// Release evaluates historical commits against the current project
|
|
715
|
+
// graph. A project configuration which no longer exists must not make
|
|
716
|
+
// every surviving release project relevant to that commit.
|
|
717
|
+
false);
|
|
666
718
|
this.affectedGraphPerCommit.set(shortHash, affectedGraph);
|
|
667
719
|
return affectedGraph;
|
|
668
720
|
}
|
|
@@ -104,6 +104,12 @@ class GithubRemoteReleaseClient extends remote_release_client_1.RemoteReleaseCli
|
|
|
104
104
|
await Promise.all([...authors.keys()].map(async (authorName) => {
|
|
105
105
|
const meta = authors.get(authorName);
|
|
106
106
|
for (const email of meta.email) {
|
|
107
|
+
// An empty email makes the URL `/users/find/`, so ungh attributes
|
|
108
|
+
// the commit to the "find" user rather than the real author.
|
|
109
|
+
// Non-emails just 404, but skip those too to avoid a wasted lookup.
|
|
110
|
+
if (!email || !email.includes('@')) {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
107
113
|
if (email.endsWith('@users.noreply.github.com')) {
|
|
108
114
|
const match = email.match(/^(\d+\+)?([^@]+)@users\.noreply\.github\.com$/);
|
|
109
115
|
if (match && match[2]) {
|
|
@@ -235,7 +241,7 @@ class GithubRemoteReleaseClient extends remote_release_client_1.RemoteReleaseCli
|
|
|
235
241
|
if (!shouldContinueInGitHub) {
|
|
236
242
|
return;
|
|
237
243
|
}
|
|
238
|
-
const open =
|
|
244
|
+
const { default: open } = await new Function('return import("open")')();
|
|
239
245
|
await open(result.url)
|
|
240
246
|
.then(() => {
|
|
241
247
|
console.info(`\nFollow up in the browser to manually create the release:\n\n` +
|
|
@@ -157,7 +157,7 @@ class GitLabRemoteReleaseClient extends remote_release_client_1.RemoteReleaseCli
|
|
|
157
157
|
if (!shouldContinueInGitLab) {
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
-
const open =
|
|
160
|
+
const { default: open } = await new Function('return import("open")')();
|
|
161
161
|
await open(result.url)
|
|
162
162
|
.then(() => {
|
|
163
163
|
console.info(`\nFollow up in the browser to manually create the release:\n\n` +
|
|
@@ -24,8 +24,8 @@ export interface VersionDataEntry {
|
|
|
24
24
|
source: string;
|
|
25
25
|
target: string;
|
|
26
26
|
type: string;
|
|
27
|
-
dependencyCollection: string;
|
|
28
|
-
rawVersionSpec: string;
|
|
27
|
+
dependencyCollection: string | null;
|
|
28
|
+
rawVersionSpec: string | null;
|
|
29
29
|
}[];
|
|
30
30
|
}
|
|
31
31
|
export declare function isPrerelease(version: string): boolean;
|
|
@@ -42,6 +42,21 @@ export declare class ReleaseGroupProcessor {
|
|
|
42
42
|
* processing them multiple times. Used during the group traversal.
|
|
43
43
|
*/
|
|
44
44
|
private processedGroups;
|
|
45
|
+
/**
|
|
46
|
+
* Tracks release groups that have completed all version decisions. A group
|
|
47
|
+
* can reach this state before its dependency manifests are updated.
|
|
48
|
+
*/
|
|
49
|
+
private groupsWithFinalizedVersionDecisions;
|
|
50
|
+
/**
|
|
51
|
+
* Tracks projects whose dependency manifests must wait until all release
|
|
52
|
+
* groups have completed their version decisions.
|
|
53
|
+
*/
|
|
54
|
+
private projectsWithDeferredDependencyUpdates;
|
|
55
|
+
/**
|
|
56
|
+
* Indicates that every release group has completed its version decisions,
|
|
57
|
+
* so dependency manifests can use final versions safely.
|
|
58
|
+
*/
|
|
59
|
+
private allVersionDecisionsFinalized;
|
|
45
60
|
/**
|
|
46
61
|
* Keeps track of which projects have already had their versions bumped.
|
|
47
62
|
* This is used to avoid redundant version bumping and to determine which
|
|
@@ -96,6 +111,15 @@ export declare class ReleaseGroupProcessor {
|
|
|
96
111
|
private getCachedFinalConfigForProject;
|
|
97
112
|
private calculateNewVersion;
|
|
98
113
|
private updateDependenciesForProject;
|
|
114
|
+
private finalizeVersionDecisionsForGroup;
|
|
115
|
+
private finalizeAllVersionDecisions;
|
|
116
|
+
/**
|
|
117
|
+
* Resolve a dependency version when `dependenciesToUpdate` does not contain
|
|
118
|
+
* a concrete version for a manifest entry.
|
|
119
|
+
*
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
resolveVersionForDependency(dependencyProjectName: string): Promise<string>;
|
|
99
123
|
private bumpVersionForProject;
|
|
100
124
|
private updateDependenciesForDependents;
|
|
101
125
|
private getOriginalDependentProjects;
|
|
@@ -31,6 +31,21 @@ class ReleaseGroupProcessor {
|
|
|
31
31
|
* processing them multiple times. Used during the group traversal.
|
|
32
32
|
*/
|
|
33
33
|
this.processedGroups = new Set();
|
|
34
|
+
/**
|
|
35
|
+
* Tracks release groups that have completed all version decisions. A group
|
|
36
|
+
* can reach this state before its dependency manifests are updated.
|
|
37
|
+
*/
|
|
38
|
+
this.groupsWithFinalizedVersionDecisions = new Set();
|
|
39
|
+
/**
|
|
40
|
+
* Tracks projects whose dependency manifests must wait until all release
|
|
41
|
+
* groups have completed their version decisions.
|
|
42
|
+
*/
|
|
43
|
+
this.projectsWithDeferredDependencyUpdates = new Set();
|
|
44
|
+
/**
|
|
45
|
+
* Indicates that every release group has completed its version decisions,
|
|
46
|
+
* so dependency manifests can use final versions safely.
|
|
47
|
+
*/
|
|
48
|
+
this.allVersionDecisionsFinalized = false;
|
|
34
49
|
/**
|
|
35
50
|
* Keeps track of which projects have already had their versions bumped.
|
|
36
51
|
* This is used to avoid redundant version bumping and to determine which
|
|
@@ -120,6 +135,7 @@ class ReleaseGroupProcessor {
|
|
|
120
135
|
this.processedGroups.add(nextGroup);
|
|
121
136
|
processOrder.push(nextGroup);
|
|
122
137
|
}
|
|
138
|
+
await this.finalizeAllVersionDecisions(processOrder);
|
|
123
139
|
return processOrder;
|
|
124
140
|
}
|
|
125
141
|
flushAllProjectLoggers() {
|
|
@@ -208,11 +224,6 @@ class ReleaseGroupProcessor {
|
|
|
208
224
|
async processGroup(releaseGroupName) {
|
|
209
225
|
const groupNode = this.releaseGraph.groupGraph.get(releaseGroupName);
|
|
210
226
|
await this.bumpVersions(groupNode.group);
|
|
211
|
-
// Flush the project loggers for the group
|
|
212
|
-
for (const project of groupNode.group.projects) {
|
|
213
|
-
const projectLogger = this.getProjectLoggerForProject(project);
|
|
214
|
-
projectLogger.flush();
|
|
215
|
-
}
|
|
216
227
|
}
|
|
217
228
|
async bumpVersions(releaseGroup) {
|
|
218
229
|
if (releaseGroup.projectsRelationship === 'fixed') {
|
|
@@ -224,6 +235,7 @@ class ReleaseGroupProcessor {
|
|
|
224
235
|
}
|
|
225
236
|
async bumpFixedVersionGroup(releaseGroup) {
|
|
226
237
|
if (releaseGroup.projects.length === 0) {
|
|
238
|
+
this.finalizeVersionDecisionsForGroup(releaseGroup);
|
|
227
239
|
return false;
|
|
228
240
|
}
|
|
229
241
|
let bumped = false;
|
|
@@ -287,6 +299,7 @@ class ReleaseGroupProcessor {
|
|
|
287
299
|
projectLogger.buffer(`🚫 Skipping versioning for ${project} as it is a part of a fixed release group with ${firstProject} and no dependency bumps were detected`);
|
|
288
300
|
}
|
|
289
301
|
}
|
|
302
|
+
this.finalizeVersionDecisionsForGroup(releaseGroup);
|
|
290
303
|
return bumpedByDependency;
|
|
291
304
|
}
|
|
292
305
|
const { newVersion } = await this.calculateNewVersion(firstProject, newVersionInput, newVersionInputReason, newVersionInputReasonData);
|
|
@@ -319,6 +332,7 @@ class ReleaseGroupProcessor {
|
|
|
319
332
|
dependentProjects: this.getOriginalDependentProjects(project),
|
|
320
333
|
});
|
|
321
334
|
}
|
|
335
|
+
this.finalizeVersionDecisionsForGroup(releaseGroup);
|
|
322
336
|
// Then, update dependencies for all projects in the fixed group, also in topological order
|
|
323
337
|
if (bumped) {
|
|
324
338
|
for (const project of sortedProjects) {
|
|
@@ -359,6 +373,7 @@ class ReleaseGroupProcessor {
|
|
|
359
373
|
}
|
|
360
374
|
}
|
|
361
375
|
}
|
|
376
|
+
this.finalizeVersionDecisionsForGroup(releaseGroup);
|
|
362
377
|
// Third pass: Update dependencies also in topological order
|
|
363
378
|
for (const project of sortedProjects) {
|
|
364
379
|
if (projectsToUpdate.has(project) &&
|
|
@@ -472,6 +487,11 @@ class ReleaseGroupProcessor {
|
|
|
472
487
|
if (!this.releaseGraph.allProjectsToProcess.has(projectName)) {
|
|
473
488
|
throw new Error(`Unable to find ${projectName} in allProjectsToProcess, please report this as a bug on https://github.com/nrwl/nx/issues`);
|
|
474
489
|
}
|
|
490
|
+
if (!this.allVersionDecisionsFinalized) {
|
|
491
|
+
this.projectsWithDeferredDependencyUpdates.add(projectName);
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
this.projectsWithDeferredDependencyUpdates.delete(projectName);
|
|
475
495
|
const versionActions = this.getVersionActionsForProject(projectName);
|
|
476
496
|
const cachedFinalConfigForProject = this.getCachedFinalConfigForProject(projectName);
|
|
477
497
|
const dependenciesToUpdate = {};
|
|
@@ -502,11 +522,65 @@ class ReleaseGroupProcessor {
|
|
|
502
522
|
}
|
|
503
523
|
}
|
|
504
524
|
const projectLogger = this.getProjectLoggerForProject(projectName);
|
|
505
|
-
const logMessages = await versionActions.updateProjectDependencies(this.tree, this.projectGraph, dependenciesToUpdate);
|
|
525
|
+
const logMessages = await versionActions.updateProjectDependencies(this.tree, this.projectGraph, dependenciesToUpdate, (dependencyProjectName) => this.resolveVersionForDependency(dependencyProjectName));
|
|
506
526
|
for (const logMessage of logMessages) {
|
|
507
527
|
projectLogger.buffer(logMessage);
|
|
508
528
|
}
|
|
509
529
|
}
|
|
530
|
+
finalizeVersionDecisionsForGroup(releaseGroup) {
|
|
531
|
+
this.groupsWithFinalizedVersionDecisions.add(releaseGroup.name);
|
|
532
|
+
}
|
|
533
|
+
async finalizeAllVersionDecisions(processOrder) {
|
|
534
|
+
const unfinalizedReleaseGroups = Array.from(this.releaseGraph.groupGraph.keys()).filter((releaseGroupName) => !this.groupsWithFinalizedVersionDecisions.has(releaseGroupName));
|
|
535
|
+
if (unfinalizedReleaseGroups.length > 0) {
|
|
536
|
+
const releaseGroupNames = unfinalizedReleaseGroups
|
|
537
|
+
.map((releaseGroupName) => `"${releaseGroupName}"`)
|
|
538
|
+
.join(', ');
|
|
539
|
+
throw new Error(`Unable to finalize version decisions for release groups ${releaseGroupNames}. Please report this as a bug on https://github.com/nrwl/nx/issues.`);
|
|
540
|
+
}
|
|
541
|
+
this.allVersionDecisionsFinalized = true;
|
|
542
|
+
for (const releaseGroupName of processOrder) {
|
|
543
|
+
const releaseGroup = this.releaseGraph.groupGraph.get(releaseGroupName);
|
|
544
|
+
for (const projectName of releaseGroup.group.projects) {
|
|
545
|
+
if (this.projectsWithDeferredDependencyUpdates.has(projectName)) {
|
|
546
|
+
await this.updateDependenciesForProject(projectName);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
// Keep each group's buffered output together and in processing order.
|
|
550
|
+
for (const projectName of releaseGroup.group.projects) {
|
|
551
|
+
this.getProjectLoggerForProject(projectName).flush();
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
if (this.projectsWithDeferredDependencyUpdates.size > 0) {
|
|
555
|
+
const deferredProjects = Array.from(this.projectsWithDeferredDependencyUpdates, (projectName) => `"${projectName}"`).join(', ');
|
|
556
|
+
throw new Error(`Unable to update dependencies for projects ${deferredProjects} because their release groups were not processed. Please report this as a bug on https://github.com/nrwl/nx/issues.`);
|
|
557
|
+
}
|
|
558
|
+
this.flushAllProjectLoggers();
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Resolve a dependency version when `dependenciesToUpdate` does not contain
|
|
562
|
+
* a concrete version for a manifest entry.
|
|
563
|
+
*
|
|
564
|
+
* @internal
|
|
565
|
+
*/
|
|
566
|
+
async resolveVersionForDependency(dependencyProjectName) {
|
|
567
|
+
const versionData = this.versionData.get(dependencyProjectName);
|
|
568
|
+
if (versionData?.newVersion) {
|
|
569
|
+
return versionData.newVersion;
|
|
570
|
+
}
|
|
571
|
+
if (!this.releaseGraph.allProjectsToProcess.has(dependencyProjectName)) {
|
|
572
|
+
return this.releaseGraph.resolveCurrentVersionForDependency(this.tree, this.projectGraph, dependencyProjectName, this.options.preid);
|
|
573
|
+
}
|
|
574
|
+
const releaseGroupName = this.getReleaseGroupNameForProject(dependencyProjectName);
|
|
575
|
+
if (!releaseGroupName ||
|
|
576
|
+
!this.groupsWithFinalizedVersionDecisions.has(releaseGroupName)) {
|
|
577
|
+
throw new Error(`Cannot resolve a concrete version for dependency project "${dependencyProjectName}" because its release group has not finalized its version decisions. Ensure the release group can finalize the dependency version before Nx Release updates the dependent manifest.`);
|
|
578
|
+
}
|
|
579
|
+
if (versionData?.currentVersion) {
|
|
580
|
+
return versionData.currentVersion;
|
|
581
|
+
}
|
|
582
|
+
throw new Error(`Cannot resolve a concrete version for dependency project "${dependencyProjectName}" because its finalized release data has no current or new version.`);
|
|
583
|
+
}
|
|
510
584
|
async bumpVersionForProject(projectName, bumpType, bumpTypeReason, bumpTypeReasonData) {
|
|
511
585
|
const projectLogger = this.getProjectLoggerForProject(projectName);
|
|
512
586
|
if (bumpType === 'none') {
|
|
@@ -5,6 +5,19 @@ import type { Tree } from '../../../generators/tree';
|
|
|
5
5
|
import type { ReleaseGroupWithName } from '../config/filter-release-groups';
|
|
6
6
|
import type { FinalConfigForProject } from '../utils/release-graph';
|
|
7
7
|
export type SemverBumpType = ReleaseType | 'none';
|
|
8
|
+
/**
|
|
9
|
+
* Lazily resolves the concrete version of a dependency project that is not
|
|
10
|
+
* already represented in `dependenciesToUpdate`.
|
|
11
|
+
*
|
|
12
|
+
* Ecosystem-specific VersionActions implementations can use this when a
|
|
13
|
+
* manifest reference requires a concrete version but `dependenciesToUpdate`
|
|
14
|
+
* does not contain one. The resolved value can be the dependency's new version
|
|
15
|
+
* when it is part of the release, or its current version when it is not being
|
|
16
|
+
* versioned.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export type ResolveVersionForDependency = (dependencyProjectName: string) => Promise<string>;
|
|
8
21
|
/**
|
|
9
22
|
* Implementation details of performing any actions after all projects have been versioned.
|
|
10
23
|
* An example might be updating a workspace level lock file.
|
|
@@ -45,6 +58,14 @@ export declare abstract class VersionActions {
|
|
|
45
58
|
* If a manifest file is not applicable to the current versioning use-case, this should be set to null.
|
|
46
59
|
*/
|
|
47
60
|
abstract validManifestFilenames: string[] | null;
|
|
61
|
+
/**
|
|
62
|
+
* Whether manifests updated by this implementation should be excluded from
|
|
63
|
+
* the final Prettier pass performed by Nx Release.
|
|
64
|
+
*
|
|
65
|
+
* Custom implementations must opt in explicitly. This defaults to false so
|
|
66
|
+
* their existing formatting behavior does not change.
|
|
67
|
+
*/
|
|
68
|
+
excludeManifestsFromFormatting: boolean;
|
|
48
69
|
/**
|
|
49
70
|
* The interpolated manifest paths to update, if applicable based on the user's configuration, when new
|
|
50
71
|
* versions and dependencies are determined. If no manifest files should be updated based on the user's
|
|
@@ -170,10 +191,14 @@ export declare abstract class VersionActions {
|
|
|
170
191
|
* with new dependency versions, but for application deployments it might involve
|
|
171
192
|
* updating something else instead, it depends on the type of application.
|
|
172
193
|
*
|
|
194
|
+
* `resolveVersionForDependency` is intentionally lazy: implementations
|
|
195
|
+
* decide which manifest values require a concrete version, while release core
|
|
196
|
+
* remains unaware of ecosystem-specific dependency protocols.
|
|
197
|
+
*
|
|
173
198
|
* It should return an array of log messages that will be displayed unmodified to the user
|
|
174
199
|
* after the dependencies have been updated.
|
|
175
200
|
*/
|
|
176
|
-
abstract updateProjectDependencies(tree: Tree, projectGraph: ProjectGraph, dependenciesToUpdate: Record<string, string
|
|
201
|
+
abstract updateProjectDependencies(tree: Tree, projectGraph: ProjectGraph, dependenciesToUpdate: Record<string, string>, resolveVersionForDependency?: ResolveVersionForDependency): Promise<string[]>;
|
|
177
202
|
}
|
|
178
203
|
export declare class NOOP_VERSION_ACTIONS extends VersionActions {
|
|
179
204
|
validManifestFilenames: any;
|
|
@@ -194,6 +219,6 @@ export declare class NOOP_VERSION_ACTIONS extends VersionActions {
|
|
|
194
219
|
newVersion: string;
|
|
195
220
|
logText: string;
|
|
196
221
|
}>;
|
|
197
|
-
updateProjectDependencies(tree: Tree, projectGraph: ProjectGraph, dependenciesToUpdate: Record<string, string
|
|
222
|
+
updateProjectDependencies(tree: Tree, projectGraph: ProjectGraph, dependenciesToUpdate: Record<string, string>, resolveVersionForDependency?: ResolveVersionForDependency): Promise<string[]>;
|
|
198
223
|
updateProjectVersion(tree: Tree, newVersion: string): Promise<string[]>;
|
|
199
224
|
}
|
|
@@ -84,6 +84,14 @@ class VersionActions {
|
|
|
84
84
|
this.releaseGroup = releaseGroup;
|
|
85
85
|
this.projectGraphNode = projectGraphNode;
|
|
86
86
|
this.finalConfigForProject = finalConfigForProject;
|
|
87
|
+
/**
|
|
88
|
+
* Whether manifests updated by this implementation should be excluded from
|
|
89
|
+
* the final Prettier pass performed by Nx Release.
|
|
90
|
+
*
|
|
91
|
+
* Custom implementations must opt in explicitly. This defaults to false so
|
|
92
|
+
* their existing formatting behavior does not change.
|
|
93
|
+
*/
|
|
94
|
+
this.excludeManifestsFromFormatting = false;
|
|
87
95
|
/**
|
|
88
96
|
* The interpolated manifest paths to update, if applicable based on the user's configuration, when new
|
|
89
97
|
* versions and dependencies are determined. If no manifest files should be updated based on the user's
|
|
@@ -237,7 +245,7 @@ class NOOP_VERSION_ACTIONS extends VersionActions {
|
|
|
237
245
|
logText: 'Skipped default versioning as no-op.',
|
|
238
246
|
});
|
|
239
247
|
}
|
|
240
|
-
updateProjectDependencies(tree, projectGraph, dependenciesToUpdate) {
|
|
248
|
+
updateProjectDependencies(tree, projectGraph, dependenciesToUpdate, resolveVersionForDependency) {
|
|
241
249
|
return Promise.resolve([]);
|
|
242
250
|
}
|
|
243
251
|
updateProjectVersion(tree, newVersion) {
|
|
@@ -173,11 +173,15 @@ function createAPI(overrideReleaseConfig, ignoreNxJsonConfig) {
|
|
|
173
173
|
// Bubble up the error so that the CLI can print the error and exit, or the programmatic API can handle it
|
|
174
174
|
throw err;
|
|
175
175
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
176
|
+
// A version actions implementation can opt its manifests out of this final
|
|
177
|
+
// pass when it already preserves their formatting while updating values.
|
|
178
|
+
const manifestsToExcludeFromFormatting = new Set(Array.from(releaseGraph.projectsToVersionActions.values()).flatMap((versionActions) => versionActions.excludeManifestsFromFormatting
|
|
179
|
+
? versionActions.manifestsToUpdate.map(({ manifestPath }) => manifestPath)
|
|
180
|
+
: []));
|
|
181
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
|
|
182
|
+
silent: true,
|
|
183
|
+
excludePaths: manifestsToExcludeFromFormatting,
|
|
184
|
+
});
|
|
181
185
|
printAndFlushChanges(tree, !!args.dryRun);
|
|
182
186
|
const { changedFiles: changed, deletedFiles: deleted } = await processor.afterAllProjectsVersioned({
|
|
183
187
|
...nxReleaseConfig.version
|
|
@@ -137,7 +137,12 @@ function cleanupCacheEntries() {
|
|
|
137
137
|
}
|
|
138
138
|
function cleanupNativeFileCache() {
|
|
139
139
|
return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
|
|
140
|
-
|
|
140
|
+
// Null when the native cache root is not a real directory we own, which
|
|
141
|
+
// would mean deleting through a path another user planted.
|
|
142
|
+
const cacheDir = (0, native_file_cache_location_1.getNativeFileCacheLocationToDelete)();
|
|
143
|
+
if (cacheDir) {
|
|
144
|
+
(0, node_fs_1.rmSync)(cacheDir, { recursive: true, force: true });
|
|
145
|
+
}
|
|
141
146
|
});
|
|
142
147
|
}
|
|
143
148
|
function cleanupWorkspaceData() {
|
|
@@ -51,6 +51,7 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
|
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
53
|
const status = await (0, run_command_1.runCommand)(projects, projectGraph, { nxJson }, nxArgs, overrides, projectName, extraTargetDependencies, extraOptions);
|
|
54
|
+
await output_1.output.drain();
|
|
54
55
|
process.exit(status);
|
|
55
56
|
}
|
|
56
57
|
}
|
|
@@ -41,6 +41,7 @@ async function runMany(args, extraTargetDependencies = {}, extraOptions = {
|
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
43
|
const status = await (0, run_command_1.runCommand)(projects, projectGraph, { nxJson }, nxArgs, overrides, null, extraTargetDependencies, extraOptions);
|
|
44
|
+
await output_1.output.drain();
|
|
44
45
|
process.exit(status);
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -116,8 +116,17 @@ function resolveDependencyProjects(dep, projectName, graph) {
|
|
|
116
116
|
function resolveTaskGraphDependencies(graph, extraTargetDeps, projectName, targetName, configuration, depConfigs) {
|
|
117
117
|
try {
|
|
118
118
|
const taskGraph = (0, create_task_graph_1.createTaskGraph)(graph, extraTargetDeps, [projectName], [targetName], configuration, {});
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
// `createTaskGraph` resolves the target's `defaultConfiguration`, so the real
|
|
120
|
+
// root task id may carry a `:config` suffix that `createTaskId` with the raw
|
|
121
|
+
// configuration would omit. Find the root task by (project, target) instead.
|
|
122
|
+
const rootTask = Object.values(taskGraph.tasks).find((task) => task.target.project === projectName && task.target.target === targetName);
|
|
123
|
+
const rootId = rootTask?.id ?? (0, utils_1.createTaskId)(projectName, targetName, configuration);
|
|
124
|
+
// Continuous dependencies (e.g. dev servers) live in a separate map but are
|
|
125
|
+
// direct dependencies just like the entries in `dependencies`.
|
|
126
|
+
const directDeps = [
|
|
127
|
+
...(taskGraph.dependencies[rootId] ?? []),
|
|
128
|
+
...(taskGraph.continuousDependencies[rootId] ?? []),
|
|
129
|
+
];
|
|
121
130
|
const directDepSet = new Set(directDeps);
|
|
122
131
|
const depSourceIndices = directDeps.map((depTaskId) => {
|
|
123
132
|
const task = taskGraph.tasks[depTaskId];
|