nx 21.4.0-canary.20250815-18ba315 → 21.5.0-canary.20250816-fcfb5ab

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "21.4.0-canary.20250815-18ba315",
3
+ "version": "21.5.0-canary.20250816-fcfb5ab",
4
4
  "private": false,
5
5
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
6
6
  "repository": {
@@ -83,16 +83,16 @@
83
83
  }
84
84
  },
85
85
  "optionalDependencies": {
86
- "@nx/nx-darwin-arm64": "21.4.0-canary.20250815-18ba315",
87
- "@nx/nx-darwin-x64": "21.4.0-canary.20250815-18ba315",
88
- "@nx/nx-freebsd-x64": "21.4.0-canary.20250815-18ba315",
89
- "@nx/nx-linux-arm-gnueabihf": "21.4.0-canary.20250815-18ba315",
90
- "@nx/nx-linux-arm64-gnu": "21.4.0-canary.20250815-18ba315",
91
- "@nx/nx-linux-arm64-musl": "21.4.0-canary.20250815-18ba315",
92
- "@nx/nx-linux-x64-gnu": "21.4.0-canary.20250815-18ba315",
93
- "@nx/nx-linux-x64-musl": "21.4.0-canary.20250815-18ba315",
94
- "@nx/nx-win32-arm64-msvc": "21.4.0-canary.20250815-18ba315",
95
- "@nx/nx-win32-x64-msvc": "21.4.0-canary.20250815-18ba315"
86
+ "@nx/nx-darwin-arm64": "21.5.0-canary.20250816-fcfb5ab",
87
+ "@nx/nx-darwin-x64": "21.5.0-canary.20250816-fcfb5ab",
88
+ "@nx/nx-freebsd-x64": "21.5.0-canary.20250816-fcfb5ab",
89
+ "@nx/nx-linux-arm-gnueabihf": "21.5.0-canary.20250816-fcfb5ab",
90
+ "@nx/nx-linux-arm64-gnu": "21.5.0-canary.20250816-fcfb5ab",
91
+ "@nx/nx-linux-arm64-musl": "21.5.0-canary.20250816-fcfb5ab",
92
+ "@nx/nx-linux-x64-gnu": "21.5.0-canary.20250816-fcfb5ab",
93
+ "@nx/nx-linux-x64-musl": "21.5.0-canary.20250816-fcfb5ab",
94
+ "@nx/nx-win32-arm64-msvc": "21.5.0-canary.20250816-fcfb5ab",
95
+ "@nx/nx-win32-x64-msvc": "21.5.0-canary.20250816-fcfb5ab"
96
96
  },
97
97
  "nx-migrations": {
98
98
  "migrations": "./migrations.json",
@@ -1 +1 @@
1
- {"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/release/changelog.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,sBAAsB,EAAc,MAAM,sBAAsB,CAAC;AAkB1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAmBpD,OAAO,EAEL,SAAS,EAUV,MAAM,aAAa,CAAC;AAQrB,OAAO,EACL,cAAc,EASf,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,wBAAwB;IACvC,kBAAkB,CAAC,EAAE;QACnB,cAAc,EAAE,cAAc,CAAC;QAC/B,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;KACjC,CAAC;IACF,iBAAiB,CAAC,EAAE;QAClB,CAAC,WAAW,EAAE,MAAM,GAAG;YACrB,cAAc,EAAE,cAAc,CAAC;YAC/B,QAAQ,EAAE,MAAM,CAAC;YACjB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;SACjC,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,SAAS,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAElE,eAAO,MAAM,0BAA0B,GAAI,MAAM,gBAAgB,oBACV,CAAC;AAExD,wBAAgB,SAAS,CAAC,qBAAqB,EAAE,sBAAsB,IAOnE,MAAM,gBAAgB,KACrB,OAAO,CAAC,wBAAwB,CAAC,CAqrBrC"}
1
+ {"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/release/changelog.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,sBAAsB,EAAc,MAAM,sBAAsB,CAAC;AAkB1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAmBpD,OAAO,EAEL,SAAS,EAUV,MAAM,aAAa,CAAC;AAYrB,OAAO,EACL,cAAc,EASf,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,wBAAwB;IACvC,kBAAkB,CAAC,EAAE;QACnB,cAAc,EAAE,cAAc,CAAC;QAC/B,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;KACjC,CAAC;IACF,iBAAiB,CAAC,EAAE;QAClB,CAAC,WAAW,EAAE,MAAM,GAAG;YACrB,cAAc,EAAE,cAAc,CAAC;YAC/B,QAAQ,EAAE,MAAM,CAAC;YACjB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;SACjC,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,SAAS,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAElE,eAAO,MAAM,0BAA0B,GAAI,MAAM,gBAAgB,oBACV,CAAC;AAExD,wBAAgB,SAAS,CAAC,qBAAqB,EAAE,sBAAsB,IAOnE,MAAM,gBAAgB,KACrB,OAAO,CAAC,wBAAwB,CAAC,CAisBrC"}
@@ -30,6 +30,7 @@ const print_config_1 = require("./utils/print-config");
30
30
  const remote_release_client_1 = require("./utils/remote-release-clients/remote-release-client");
31
31
  const resolve_changelog_renderer_1 = require("./utils/resolve-changelog-renderer");
32
32
  const resolve_nx_json_error_message_1 = require("./utils/resolve-nx-json-error-message");
33
+ const version_plan_utils_1 = require("./utils/version-plan-utils");
33
34
  const shared_1 = require("./utils/shared");
34
35
  const releaseChangelogCLIHandler = (args) => (0, handle_errors_1.handleErrors)(args.verbose, () => createAPI({})(args));
35
36
  exports.releaseChangelogCLIHandler = releaseChangelogCLIHandler;
@@ -86,6 +87,12 @@ function createAPI(overrideReleaseConfig) {
86
87
  }
87
88
  const rawVersionPlans = await (0, version_plans_1.readRawVersionPlans)();
88
89
  await (0, version_plans_1.setResolvedVersionPlansOnGroups)(rawVersionPlans, releaseGroups, Object.keys(projectGraph.nodes), args.verbose);
90
+ // Validate version plans against the filter after resolution
91
+ const versionPlanValidationError = (0, version_plan_utils_1.validateResolvedVersionPlansAgainstFilter)(releaseGroups, releaseGroupToFilteredProjects);
92
+ if (versionPlanValidationError) {
93
+ output_1.output.error(versionPlanValidationError);
94
+ process.exit(1);
95
+ }
89
96
  if (args.deleteVersionPlans === undefined) {
90
97
  // default to deleting version plans in this command instead of after versioning
91
98
  args.deleteVersionPlans = true;
@@ -518,7 +525,7 @@ function createAPI(overrideReleaseConfig) {
518
525
  }
519
526
  }
520
527
  }
521
- await applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTasks, commitMessageValues, gitTagValues, releaseGroups);
528
+ await applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTasks, commitMessageValues, gitTagValues, releaseGroups, releaseGroupToFilteredProjects);
522
529
  return {
523
530
  workspaceChangelog,
524
531
  projectChangelogs: allProjectChangelogs,
@@ -569,7 +576,7 @@ function applyRemoteReleaseProviderName(newRemoteReleaseProviderName) {
569
576
  remoteReleaseProviderName = newRemoteReleaseProviderName;
570
577
  }
571
578
  }
572
- async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTasks, commitMessageValues, gitTagValues, releaseGroups) {
579
+ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTasks, commitMessageValues, gitTagValues, releaseGroups, releaseGroupToFilteredProjects) {
573
580
  let latestCommit = toSHA;
574
581
  const changes = tree.listChanges();
575
582
  /**
@@ -613,8 +620,18 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
613
620
  if (args.deleteVersionPlans) {
614
621
  const planFiles = new Set();
615
622
  releaseGroups.forEach((group) => {
623
+ const filteredProjects = releaseGroupToFilteredProjects.get(group);
616
624
  if (group.resolvedVersionPlans) {
617
- group.resolvedVersionPlans.forEach((plan) => {
625
+ // Check each version plan individually to see if it should be deleted
626
+ const plansToDelete = [];
627
+ for (const plan of group.resolvedVersionPlans) {
628
+ // Only delete if ALL projects in the version plan are being filtered/released
629
+ if ((0, version_plan_utils_1.areAllVersionPlanProjectsFiltered)(plan, group, filteredProjects)) {
630
+ plansToDelete.push(plan);
631
+ }
632
+ }
633
+ // Delete the plans that only affect filtered projects
634
+ plansToDelete.forEach((plan) => {
618
635
  if (!args.dryRun) {
619
636
  (0, node_fs_1.rmSync)(plan.absolutePath, { recursive: true, force: true });
620
637
  if (args.verbose) {
@@ -1 +1 @@
1
- {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/release/release.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAc,MAAM,sBAAsB,CAAC;AAM1E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAyBlE,OAAO,EACL,sBAAsB,EAEvB,MAAM,WAAW,CAAC;AAEnB,eAAO,MAAM,iBAAiB,GAAI,MAAM,cAAc,oBACC,CAAC;AAExD,wBAAgB,SAAS,CAAC,qBAAqB,EAAE,sBAAsB,IAMnE,MAAM,cAAc,KACnB,OAAO,CAAC,sBAAsB,GAAG,MAAM,CAAC,CAqV5C"}
1
+ {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/release/release.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAc,MAAM,sBAAsB,CAAC;AAM1E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA6BlE,OAAO,EACL,sBAAsB,EAEvB,MAAM,WAAW,CAAC;AAEnB,eAAO,MAAM,iBAAiB,GAAI,MAAM,cAAc,oBACC,CAAC;AAExD,wBAAgB,SAAS,CAAC,qBAAqB,EAAE,sBAAsB,IAMnE,MAAM,cAAc,KACnB,OAAO,CAAC,sBAAsB,GAAG,MAAM,CAAC,CAkX5C"}
@@ -21,6 +21,7 @@ const print_config_1 = require("./utils/print-config");
21
21
  const remote_release_client_1 = require("./utils/remote-release-clients/remote-release-client");
22
22
  const resolve_nx_json_error_message_1 = require("./utils/resolve-nx-json-error-message");
23
23
  const shared_1 = require("./utils/shared");
24
+ const version_plan_utils_1 = require("./utils/version-plan-utils");
24
25
  const version_1 = require("./version");
25
26
  const releaseCLIHandler = (args) => (0, handle_errors_1.handleErrors)(args.verbose, () => createAPI({})(args));
26
27
  exports.releaseCLIHandler = releaseCLIHandler;
@@ -108,29 +109,47 @@ function createAPI(overrideReleaseConfig) {
108
109
  deleteVersionPlans: false,
109
110
  });
110
111
  await (0, version_plans_1.setResolvedVersionPlansOnGroups)(rawVersionPlans, releaseGroups, Object.keys(projectGraph.nodes), args.verbose);
112
+ // Validate version plans against the filter after resolution
113
+ const versionPlanValidationError = (0, version_plan_utils_1.validateResolvedVersionPlansAgainstFilter)(releaseGroups, releaseGroupToFilteredProjects);
114
+ if (versionPlanValidationError) {
115
+ output_1.output.error(versionPlanValidationError);
116
+ process.exit(1);
117
+ }
111
118
  const planFiles = new Set();
112
119
  releaseGroups.forEach((group) => {
120
+ const filteredProjects = releaseGroupToFilteredProjects.get(group);
113
121
  if (group.resolvedVersionPlans) {
114
- if (group.name === config_1.IMPLICIT_DEFAULT_RELEASE_GROUP) {
115
- output_1.output.logSingleLine(`Removing version plan files`);
116
- }
117
- else {
118
- output_1.output.logSingleLine(`Removing version plan files for group ${group.name}`);
122
+ // Check each version plan individually to see if it should be deleted
123
+ const plansToDelete = [];
124
+ for (const plan of group.resolvedVersionPlans) {
125
+ // Only delete if ALL projects in the version plan are being filtered/released
126
+ if ((0, version_plan_utils_1.areAllVersionPlanProjectsFiltered)(plan, group, filteredProjects)) {
127
+ plansToDelete.push(plan);
128
+ }
119
129
  }
120
- group.resolvedVersionPlans.forEach((plan) => {
121
- if (!args.dryRun) {
122
- (0, node_fs_1.rmSync)(plan.absolutePath, { recursive: true, force: true });
123
- if (args.verbose) {
124
- console.log(`Removing ${plan.relativePath}`);
125
- }
130
+ // Only log and delete if we have plans to delete
131
+ if (plansToDelete.length > 0) {
132
+ if (group.name === config_1.IMPLICIT_DEFAULT_RELEASE_GROUP) {
133
+ output_1.output.logSingleLine(`Removing version plan files`);
126
134
  }
127
135
  else {
128
- if (args.verbose) {
129
- console.log(`Would remove ${plan.relativePath}, but --dry-run was set`);
130
- }
136
+ output_1.output.logSingleLine(`Removing version plan files for group ${group.name}`);
131
137
  }
132
- planFiles.add(plan.relativePath);
133
- });
138
+ plansToDelete.forEach((plan) => {
139
+ if (!args.dryRun) {
140
+ (0, node_fs_1.rmSync)(plan.absolutePath, { recursive: true, force: true });
141
+ if (args.verbose) {
142
+ console.log(`Removing ${plan.relativePath}`);
143
+ }
144
+ }
145
+ else {
146
+ if (args.verbose) {
147
+ console.log(`Would remove ${plan.relativePath}, but --dry-run was set`);
148
+ }
149
+ }
150
+ planFiles.add(plan.relativePath);
151
+ });
152
+ }
134
153
  }
135
154
  });
136
155
  const deletedFiles = Array.from(planFiles);
@@ -0,0 +1,41 @@
1
+ import { GroupVersionPlan, ProjectsVersionPlan } from '../config/version-plans';
2
+ import { ReleaseGroupWithName } from '../config/filter-release-groups';
3
+ /**
4
+ * Validates that all projects in resolved version plans are included in the filtered projects.
5
+ * This validation ensures that version plans don't contain projects that aren't being released.
6
+ *
7
+ * @param releaseGroups - The release groups to validate
8
+ * @param releaseGroupToFilteredProjects - Map of release groups to their filtered projects
9
+ * @returns An error object if validation fails, null otherwise
10
+ */
11
+ export declare function validateResolvedVersionPlansAgainstFilter(releaseGroups: ReleaseGroupWithName[], releaseGroupToFilteredProjects: Map<ReleaseGroupWithName, Set<string>>): {
12
+ title: string;
13
+ bodyLines?: string[];
14
+ } | null;
15
+ /**
16
+ * Extracts the set of projects that a version plan affects.
17
+ *
18
+ * @param plan - The version plan to analyze
19
+ * @param releaseGroup - The release group containing the version plan
20
+ * @returns Set of project names that the version plan affects
21
+ */
22
+ export declare function getProjectsAffectedByVersionPlan(plan: GroupVersionPlan | ProjectsVersionPlan, releaseGroup: ReleaseGroupWithName): Set<string>;
23
+ /**
24
+ * Checks if all projects affected by a version plan are included in the filtered projects set.
25
+ *
26
+ * @param plan - The version plan to check
27
+ * @param releaseGroup - The release group containing the version plan
28
+ * @param filteredProjects - Set of projects that are being released (filtered)
29
+ * @returns True if ALL projects in the version plan are being filtered/released
30
+ */
31
+ export declare function areAllVersionPlanProjectsFiltered(plan: GroupVersionPlan | ProjectsVersionPlan, releaseGroup: ReleaseGroupWithName, filteredProjects: Set<string> | undefined): boolean;
32
+ /**
33
+ * Finds projects in a version plan that are NOT included in the filtered projects set.
34
+ *
35
+ * @param plan - The version plan to check
36
+ * @param releaseGroup - The release group containing the version plan
37
+ * @param filteredProjects - Set of projects that are being released (filtered)
38
+ * @returns Array of project names that are in the version plan but not in the filter
39
+ */
40
+ export declare function getVersionPlanProjectsOutsideFilter(plan: GroupVersionPlan | ProjectsVersionPlan, releaseGroup: ReleaseGroupWithName, filteredProjects: Set<string> | undefined): string[];
41
+ //# sourceMappingURL=version-plan-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-plan-utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/command-line/release/utils/version-plan-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE;;;;;;;GAOG;AACH,wBAAgB,yCAAyC,CACvD,aAAa,EAAE,oBAAoB,EAAE,EACrC,8BAA8B,EAAE,GAAG,CAAC,oBAAoB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,GACrE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,IAAI,CA4ChD;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,gBAAgB,GAAG,mBAAmB,EAC5C,YAAY,EAAE,oBAAoB,GACjC,GAAG,CAAC,MAAM,CAAC,CAab;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,gBAAgB,GAAG,mBAAmB,EAC5C,YAAY,EAAE,oBAAoB,EAClC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,GACxC,OAAO,CAYT;AAED;;;;;;;GAOG;AACH,wBAAgB,mCAAmC,CACjD,IAAI,EAAE,gBAAgB,GAAG,mBAAmB,EAC5C,YAAY,EAAE,oBAAoB,EAClC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,GACxC,MAAM,EAAE,CAUV"}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateResolvedVersionPlansAgainstFilter = validateResolvedVersionPlansAgainstFilter;
4
+ exports.getProjectsAffectedByVersionPlan = getProjectsAffectedByVersionPlan;
5
+ exports.areAllVersionPlanProjectsFiltered = areAllVersionPlanProjectsFiltered;
6
+ exports.getVersionPlanProjectsOutsideFilter = getVersionPlanProjectsOutsideFilter;
7
+ /**
8
+ * Validates that all projects in resolved version plans are included in the filtered projects.
9
+ * This validation ensures that version plans don't contain projects that aren't being released.
10
+ *
11
+ * @param releaseGroups - The release groups to validate
12
+ * @param releaseGroupToFilteredProjects - Map of release groups to their filtered projects
13
+ * @returns An error object if validation fails, null otherwise
14
+ */
15
+ function validateResolvedVersionPlansAgainstFilter(releaseGroups, releaseGroupToFilteredProjects) {
16
+ for (const releaseGroup of releaseGroups) {
17
+ if (releaseGroup.resolvedVersionPlans &&
18
+ releaseGroup.resolvedVersionPlans.length > 0) {
19
+ const filteredProjects = releaseGroupToFilteredProjects.get(releaseGroup);
20
+ for (const plan of releaseGroup.resolvedVersionPlans) {
21
+ // check if version plan applies to filtered projects
22
+ if (!checkVersionPlanContainsFilteredProjects(plan, releaseGroup, filteredProjects)) {
23
+ continue;
24
+ }
25
+ // Check if version plan contains projects outside the filter
26
+ const projectsOutsideFilter = getVersionPlanProjectsOutsideFilter(plan, releaseGroup, filteredProjects);
27
+ if (projectsOutsideFilter.length > 0) {
28
+ // Error if version plan contains projects not in the filter
29
+ return {
30
+ title: `Version plan contains projects not included in the release filter`,
31
+ bodyLines: [
32
+ `The following projects in the version plan are not being released:`,
33
+ ...projectsOutsideFilter.map((p) => ` - ${p}`),
34
+ '',
35
+ `Either include all projects from the version plan in your release command,`,
36
+ `or create separate version plans for different sets of projects.`,
37
+ ],
38
+ };
39
+ }
40
+ }
41
+ }
42
+ }
43
+ return null;
44
+ }
45
+ /**
46
+ * Extracts the set of projects that a version plan affects.
47
+ *
48
+ * @param plan - The version plan to analyze
49
+ * @param releaseGroup - The release group containing the version plan
50
+ * @returns Set of project names that the version plan affects
51
+ */
52
+ function getProjectsAffectedByVersionPlan(plan, releaseGroup) {
53
+ const planProjects = new Set();
54
+ // Collect all projects mentioned in this version plan
55
+ if ('groupVersionBump' in plan && plan.groupVersionBump) {
56
+ // Version plan applies to the entire group
57
+ releaseGroup.projects.forEach((p) => planProjects.add(p));
58
+ }
59
+ else if ('projectVersionBumps' in plan && plan.projectVersionBumps) {
60
+ // Version plan has specific project bumps
61
+ Object.keys(plan.projectVersionBumps).forEach((p) => planProjects.add(p));
62
+ }
63
+ return planProjects;
64
+ }
65
+ /**
66
+ * Checks if all projects affected by a version plan are included in the filtered projects set.
67
+ *
68
+ * @param plan - The version plan to check
69
+ * @param releaseGroup - The release group containing the version plan
70
+ * @param filteredProjects - Set of projects that are being released (filtered)
71
+ * @returns True if ALL projects in the version plan are being filtered/released
72
+ */
73
+ function areAllVersionPlanProjectsFiltered(plan, releaseGroup, filteredProjects) {
74
+ if (!filteredProjects) {
75
+ return false;
76
+ }
77
+ const planProjects = getProjectsAffectedByVersionPlan(plan, releaseGroup);
78
+ // Only return true if the plan affects at least one project and ALL of them are filtered
79
+ return (planProjects.size > 0 &&
80
+ Array.from(planProjects).every((project) => filteredProjects.has(project)));
81
+ }
82
+ /**
83
+ * Finds projects in a version plan that are NOT included in the filtered projects set.
84
+ *
85
+ * @param plan - The version plan to check
86
+ * @param releaseGroup - The release group containing the version plan
87
+ * @param filteredProjects - Set of projects that are being released (filtered)
88
+ * @returns Array of project names that are in the version plan but not in the filter
89
+ */
90
+ function getVersionPlanProjectsOutsideFilter(plan, releaseGroup, filteredProjects) {
91
+ if (!filteredProjects) {
92
+ return [];
93
+ }
94
+ const planProjects = getProjectsAffectedByVersionPlan(plan, releaseGroup);
95
+ return Array.from(planProjects).filter((project) => !filteredProjects.has(project));
96
+ }
97
+ /**
98
+ * Checks whether the version plan contains any of the filtered projects.
99
+ *
100
+ * @param plan - The version plan to check.
101
+ * @param releaseGroup - The release group associated with the version plan.
102
+ * @param filteredProjects - Set of projects that are being released (filtered).
103
+ * @returns Returns true if the version plan contains any of the filtered projects, or if no filtered projects are provided.
104
+ */
105
+ function checkVersionPlanContainsFilteredProjects(plan, releaseGroup, filteredProjects) {
106
+ if (!filteredProjects) {
107
+ return true;
108
+ }
109
+ const planProjects = getProjectsAffectedByVersionPlan(plan, releaseGroup);
110
+ return Array.from(filteredProjects).some((project) => planProjects.has(project));
111
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/release/version.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,sBAAsB,EAGvB,MAAM,sBAAsB,CAAC;AAS9B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAkBlD,OAAO,EACL,WAAW,EAKZ,MAAM,gBAAgB,CAAC;AAUxB,eAAO,MAAM,2BAA2B,sCAAuC,CAAC;AAEhF,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;OASG;IACH,gBAAgB,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IAC9C,mBAAmB,EAAE,WAAW,CAAC;CAClC;AAED,eAAO,MAAM,wBAAwB,GAAI,MAAM,cAAc,oBACN,CAAC;AAExD,wBAAgB,SAAS,CAAC,qBAAqB,EAAE,sBAAsB,IAOnE,MAAM,cAAc,KACnB,OAAO,CAAC,sBAAsB,CAAC,CAgVnC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/release/version.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,sBAAsB,EAGvB,MAAM,sBAAsB,CAAC;AAS9B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAkBlD,OAAO,EACL,WAAW,EAKZ,MAAM,gBAAgB,CAAC;AAWxB,eAAO,MAAM,2BAA2B,sCAAuC,CAAC;AAEhF,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;OASG;IACH,gBAAgB,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IAC9C,mBAAmB,EAAE,WAAW,CAAC;CAClC;AAED,eAAO,MAAM,wBAAwB,GAAI,MAAM,cAAc,oBACN,CAAC;AAExD,wBAAgB,SAAS,CAAC,qBAAqB,EAAE,sBAAsB,IAOnE,MAAM,cAAc,KACnB,OAAO,CAAC,sBAAsB,CAAC,CA2VnC"}
@@ -26,6 +26,7 @@ const shared_1 = require("./utils/shared");
26
26
  const version_legacy_1 = require("./version-legacy");
27
27
  const release_group_processor_1 = require("./version/release-group-processor");
28
28
  const use_legacy_versioning_1 = require("./config/use-legacy-versioning");
29
+ const version_plan_utils_1 = require("./utils/version-plan-utils");
29
30
  const LARGE_BUFFER = 1024 * 1000000;
30
31
  // Reexport some utils for use in plugin release-version generator implementations
31
32
  exports.validReleaseVersionPrefixes = ['auto', '', '~', '^', '='];
@@ -89,6 +90,12 @@ function createAPI(overrideReleaseConfig) {
89
90
  if (!args.specifier) {
90
91
  const rawVersionPlans = await (0, version_plans_1.readRawVersionPlans)();
91
92
  await (0, version_plans_1.setResolvedVersionPlansOnGroups)(rawVersionPlans, releaseGroups, Object.keys(projectGraph.nodes), args.verbose);
93
+ // Validate version plans against the filter after resolution
94
+ const versionPlanValidationError = (0, version_plan_utils_1.validateResolvedVersionPlansAgainstFilter)(releaseGroups, releaseGroupToFilteredProjects);
95
+ if (versionPlanValidationError) {
96
+ output_1.output.error(versionPlanValidationError);
97
+ process.exit(1);
98
+ }
92
99
  }
93
100
  else {
94
101
  if (args.verbose && releaseGroups.some((g) => !!g.versionPlans)) {