nx 19.6.0-beta.1 → 19.6.0-beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/bin/post-install.js +8 -0
  2. package/package.json +12 -12
  3. package/schemas/nx-schema.json +55 -4
  4. package/schemas/project-schema.json +7 -0
  5. package/src/adapter/compat.d.ts +1 -1
  6. package/src/adapter/compat.js +1 -0
  7. package/src/command-line/nx-commands.js +3 -0
  8. package/src/command-line/release/changelog.js +9 -9
  9. package/src/command-line/release/command-object.d.ts +12 -3
  10. package/src/command-line/release/command-object.js +16 -1
  11. package/src/command-line/release/config/config.js +4 -2
  12. package/src/command-line/release/config/filter-release-groups.d.ts +2 -2
  13. package/src/command-line/release/config/filter-release-groups.js +1 -1
  14. package/src/command-line/release/config/version-plans.d.ts +1 -1
  15. package/src/command-line/release/config/version-plans.js +12 -12
  16. package/src/command-line/release/plan-check.d.ts +4 -0
  17. package/src/command-line/release/plan-check.js +225 -0
  18. package/src/command-line/release/plan.js +1 -1
  19. package/src/command-line/release/release.js +3 -3
  20. package/src/command-line/release/version.js +1 -1
  21. package/src/command-line/sync/command-object.d.ts +6 -0
  22. package/src/command-line/sync/command-object.js +25 -0
  23. package/src/command-line/sync/sync.d.ts +6 -0
  24. package/src/command-line/sync/sync.js +30 -0
  25. package/src/config/nx-json.d.ts +32 -2
  26. package/src/config/workspace-json-project-json.d.ts +5 -0
  27. package/src/daemon/client/client.d.ts +5 -0
  28. package/src/daemon/client/client.js +33 -0
  29. package/src/daemon/message-types/flush-sync-generator-changes-to-disk.d.ts +6 -0
  30. package/src/daemon/message-types/flush-sync-generator-changes-to-disk.js +11 -0
  31. package/src/daemon/message-types/get-registered-sync-generators.d.ts +5 -0
  32. package/src/daemon/message-types/get-registered-sync-generators.js +11 -0
  33. package/src/daemon/message-types/get-sync-generator-changes.d.ts +6 -0
  34. package/src/daemon/message-types/get-sync-generator-changes.js +11 -0
  35. package/src/daemon/message-types/update-workspace-context.d.ts +8 -0
  36. package/src/daemon/message-types/update-workspace-context.js +11 -0
  37. package/src/daemon/server/handle-flush-sync-generator-changes-to-disk.d.ts +2 -0
  38. package/src/daemon/server/handle-flush-sync-generator-changes-to-disk.js +11 -0
  39. package/src/daemon/server/handle-get-registered-sync-generators.d.ts +2 -0
  40. package/src/daemon/server/handle-get-registered-sync-generators.js +11 -0
  41. package/src/daemon/server/handle-get-sync-generator-changes.d.ts +2 -0
  42. package/src/daemon/server/handle-get-sync-generator-changes.js +17 -0
  43. package/src/daemon/server/handle-update-workspace-context.d.ts +2 -0
  44. package/src/daemon/server/handle-update-workspace-context.js +11 -0
  45. package/src/daemon/server/project-graph-incremental-recomputation.d.ts +1 -0
  46. package/src/daemon/server/project-graph-incremental-recomputation.js +19 -2
  47. package/src/daemon/server/server.js +25 -0
  48. package/src/daemon/server/sync-generators.d.ts +6 -0
  49. package/src/daemon/server/sync-generators.js +202 -0
  50. package/src/daemon/socket-utils.js +18 -5
  51. package/src/daemon/tmp-dir.js +2 -1
  52. package/src/native/nx.wasm32-wasi.wasm +0 -0
  53. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +1 -1
  54. package/src/tasks-runner/run-command.d.ts +1 -1
  55. package/src/tasks-runner/run-command.js +120 -2
  56. package/src/utils/command-line-utils.js +1 -1
  57. package/src/utils/plugins/output.js +1 -1
  58. package/src/utils/sync-generators.d.ts +22 -0
  59. package/src/utils/sync-generators.js +161 -0
  60. package/src/utils/workspace-context.d.ts +1 -0
  61. package/src/utils/workspace-context.js +16 -0
  62. package/src/daemon/message-types/update-context-files.d.ts +0 -7
  63. package/src/daemon/message-types/update-context-files.js +0 -11
@@ -53,3 +53,11 @@ function isMainNxPackage() {
53
53
  const thisNxPath = require.resolve('nx');
54
54
  return mainNxPath === thisNxPath;
55
55
  }
56
+ process.on('uncaughtException', (e) => {
57
+ logger_1.logger.verbose(e);
58
+ process.exit(0);
59
+ });
60
+ process.on('unhandledRejection', (e) => {
61
+ logger_1.logger.verbose(e);
62
+ process.exit(0);
63
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.6.0-beta.1",
3
+ "version": "19.6.0-beta.3",
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": {
@@ -71,7 +71,7 @@
71
71
  "yargs-parser": "21.1.1",
72
72
  "node-machine-id": "1.1.12",
73
73
  "ora": "5.3.0",
74
- "@nrwl/tao": "19.6.0-beta.1"
74
+ "@nrwl/tao": "19.6.0-beta.3"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "@swc-node/register": "^1.8.0",
@@ -86,16 +86,16 @@
86
86
  }
87
87
  },
88
88
  "optionalDependencies": {
89
- "@nx/nx-darwin-x64": "19.6.0-beta.1",
90
- "@nx/nx-darwin-arm64": "19.6.0-beta.1",
91
- "@nx/nx-linux-x64-gnu": "19.6.0-beta.1",
92
- "@nx/nx-linux-x64-musl": "19.6.0-beta.1",
93
- "@nx/nx-win32-x64-msvc": "19.6.0-beta.1",
94
- "@nx/nx-linux-arm64-gnu": "19.6.0-beta.1",
95
- "@nx/nx-linux-arm64-musl": "19.6.0-beta.1",
96
- "@nx/nx-linux-arm-gnueabihf": "19.6.0-beta.1",
97
- "@nx/nx-win32-arm64-msvc": "19.6.0-beta.1",
98
- "@nx/nx-freebsd-x64": "19.6.0-beta.1"
89
+ "@nx/nx-darwin-x64": "19.6.0-beta.3",
90
+ "@nx/nx-darwin-arm64": "19.6.0-beta.3",
91
+ "@nx/nx-linux-x64-gnu": "19.6.0-beta.3",
92
+ "@nx/nx-linux-x64-musl": "19.6.0-beta.3",
93
+ "@nx/nx-win32-x64-msvc": "19.6.0-beta.3",
94
+ "@nx/nx-linux-arm64-gnu": "19.6.0-beta.3",
95
+ "@nx/nx-linux-arm64-musl": "19.6.0-beta.3",
96
+ "@nx/nx-linux-arm-gnueabihf": "19.6.0-beta.3",
97
+ "@nx/nx-win32-arm64-msvc": "19.6.0-beta.3",
98
+ "@nx/nx-freebsd-x64": "19.6.0-beta.3"
99
99
  },
100
100
  "nx-migrations": {
101
101
  "migrations": "./migrations.json",
@@ -186,8 +186,15 @@
186
186
  "type": "string"
187
187
  },
188
188
  "versionPlans": {
189
- "type": "boolean",
190
- "description": "Enables using version plans as a specifier source for versioning and to determine changes for changelog generation."
189
+ "oneOf": [
190
+ {
191
+ "$ref": "#/definitions/NxReleaseVersionPlansConfiguration"
192
+ },
193
+ {
194
+ "type": "boolean",
195
+ "description": "Enables using version plans as a specifier source for versioning and to determine changes for changelog generation."
196
+ }
197
+ ]
191
198
  }
192
199
  },
193
200
  "required": ["projects"]
@@ -239,13 +246,45 @@
239
246
  "$ref": "#/definitions/NxReleaseVersionConfiguration"
240
247
  },
241
248
  "versionPlans": {
242
- "type": "boolean",
243
- "description": "Enables using version plans as a specifier source for versioning and to determine changes for changelog generation."
249
+ "oneOf": [
250
+ {
251
+ "$ref": "#/definitions/NxReleaseVersionPlansConfiguration"
252
+ },
253
+ {
254
+ "type": "boolean",
255
+ "description": "Enables using version plans as a specifier source for versioning and to determine changes for changelog generation."
256
+ }
257
+ ]
244
258
  },
245
259
  "releaseTagPattern": {
246
260
  "type": "string"
247
261
  }
248
262
  }
263
+ },
264
+ "sync": {
265
+ "type": "object",
266
+ "description": "Configuration for the `nx sync` command",
267
+ "properties": {
268
+ "globalGenerators": {
269
+ "type": "array",
270
+ "items": {
271
+ "type": "string"
272
+ },
273
+ "description": "List of workspace-wide sync generators to be run (not attached to targets)"
274
+ },
275
+ "generatorOptions": {
276
+ "type": "object",
277
+ "description": "Options for the sync generators.",
278
+ "additionalProperties": {
279
+ "type": "object"
280
+ }
281
+ },
282
+ "applyChanges": {
283
+ "type": "boolean",
284
+ "description": "Whether to automatically apply sync generator changes when running tasks. If not set, the user will be prompted. If set to `true`, the user will not be prompted and the changes will be applied. If set to `false`, the user will not be prompted and the changes will not be applied."
285
+ }
286
+ },
287
+ "additionalProperties": false
249
288
  }
250
289
  },
251
290
  "definitions": {
@@ -673,6 +712,18 @@
673
712
  }
674
713
  }
675
714
  },
715
+ "NxReleaseVersionPlansConfiguration": {
716
+ "type": "object",
717
+ "properties": {
718
+ "ignorePatternsForPlanCheck": {
719
+ "type": "array",
720
+ "items": {
721
+ "type": "string"
722
+ },
723
+ "description": "Changes to files matching any of these optional patterns will be excluded from the affected project logic within the `nx release plan:check` command. This is useful for ignoring files that are not relevant to the versioning process, such as documentation or configuration files."
724
+ }
725
+ }
726
+ },
676
727
  "ChangelogRenderOptions": {
677
728
  "type": "object",
678
729
  "additionalProperties": true
@@ -153,6 +153,13 @@
153
153
  }
154
154
  },
155
155
  "additionalProperties": true
156
+ },
157
+ "syncGenerators": {
158
+ "type": "array",
159
+ "items": {
160
+ "type": "string"
161
+ },
162
+ "description": "List of generators to run before the target to ensure the workspace is up to date"
156
163
  }
157
164
  }
158
165
  }
@@ -1,2 +1,2 @@
1
1
  export declare const allowedProjectExtensions: readonly ["tags", "implicitDependencies", "configFilePath", "$schema", "generators", "namedInputs", "name", "files", "root", "sourceRoot", "projectType", "release", "includedScripts", "metadata"];
2
- export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudId", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins", "neverConnectToCloud"];
2
+ export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudId", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins", "neverConnectToCloud", "sync"];
@@ -62,6 +62,7 @@ exports.allowedWorkspaceExtensions = [
62
62
  'useDaemonProcess',
63
63
  'useInferencePlugins',
64
64
  'neverConnectToCloud',
65
+ 'sync',
65
66
  ];
66
67
  if (!patched) {
67
68
  Module.prototype.require = function () {
@@ -24,6 +24,7 @@ const command_object_18 = require("./reset/command-object");
24
24
  const command_object_19 = require("./release/command-object");
25
25
  const command_object_20 = require("./add/command-object");
26
26
  const command_objects_1 = require("./deprecated/command-objects");
27
+ const command_object_21 = require("./sync/command-object");
27
28
  // Ensure that the output takes up the available width of the terminal.
28
29
  yargs.wrap(yargs.terminalWidth());
29
30
  exports.parserConfiguration = {
@@ -67,6 +68,8 @@ exports.commandsObject = yargs
67
68
  .command(command_object_14.yargsRunCommand)
68
69
  .command(command_object_15.yargsRunManyCommand)
69
70
  .command(command_object_16.yargsShowCommand)
71
+ .command(command_object_21.yargsSyncCommand)
72
+ .command(command_object_21.yargsSyncCheckCommand)
70
73
  .command(command_object_2.yargsViewLogsCommand)
71
74
  .command(command_object_17.yargsWatchCommand)
72
75
  .command(command_object_14.yargsNxInfixCommand)
@@ -84,7 +84,7 @@ function createAPI(overrideReleaseConfig) {
84
84
  process.exit(1);
85
85
  }
86
86
  const rawVersionPlans = await (0, version_plans_1.readRawVersionPlans)();
87
- (0, version_plans_1.setVersionPlansOnGroups)(rawVersionPlans, releaseGroups, Object.keys(projectGraph.nodes));
87
+ (0, version_plans_1.setResolvedVersionPlansOnGroups)(rawVersionPlans, releaseGroups, Object.keys(projectGraph.nodes));
88
88
  if (args.deleteVersionPlans === undefined) {
89
89
  // default to deleting version plans in this command instead of after versioning
90
90
  args.deleteVersionPlans = true;
@@ -140,12 +140,12 @@ function createAPI(overrideReleaseConfig) {
140
140
  // TODO: remove this after the changelog renderer is refactored to remove coupling with git commits
141
141
  let workspaceChangelogCommits = [];
142
142
  // If there are multiple release groups, we'll just skip the workspace changelog anyway.
143
- const versionPlansEnabledForWorkspaceChangelog = releaseGroups[0].versionPlans;
143
+ const versionPlansEnabledForWorkspaceChangelog = releaseGroups[0].resolvedVersionPlans;
144
144
  if (versionPlansEnabledForWorkspaceChangelog) {
145
145
  if (releaseGroups.length === 1) {
146
146
  const releaseGroup = releaseGroups[0];
147
147
  if (releaseGroup.projectsRelationship === 'fixed') {
148
- const versionPlans = releaseGroup.versionPlans;
148
+ const versionPlans = releaseGroup.resolvedVersionPlans;
149
149
  workspaceChangelogChanges = versionPlans
150
150
  .flatMap((vp) => {
151
151
  const releaseType = versionPlanSemverReleaseTypeToChangelogType(vp.groupVersionBump);
@@ -296,8 +296,8 @@ function createAPI(overrideReleaseConfig) {
296
296
  let changes = null;
297
297
  // TODO: remove this after the changelog renderer is refactored to remove coupling with git commits
298
298
  let commits;
299
- if (releaseGroup.versionPlans) {
300
- changes = releaseGroup.versionPlans
299
+ if (releaseGroup.resolvedVersionPlans) {
300
+ changes = releaseGroup.resolvedVersionPlans
301
301
  .map((vp) => {
302
302
  const bumpForProject = vp.projectVersionBumps[project.name];
303
303
  if (!bumpForProject) {
@@ -396,8 +396,8 @@ function createAPI(overrideReleaseConfig) {
396
396
  let changes = [];
397
397
  // TODO: remove this after the changelog renderer is refactored to remove coupling with git commits
398
398
  let commits = [];
399
- if (releaseGroup.versionPlans) {
400
- changes = releaseGroup.versionPlans
399
+ if (releaseGroup.resolvedVersionPlans) {
400
+ changes = releaseGroup.resolvedVersionPlans
401
401
  .flatMap((vp) => {
402
402
  const releaseType = versionPlanSemverReleaseTypeToChangelogType(vp.groupVersionBump);
403
403
  const changes = !vp.triggeredByProjects
@@ -585,8 +585,8 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
585
585
  if (args.deleteVersionPlans && !args.dryRun) {
586
586
  const planFiles = new Set();
587
587
  releaseGroups.forEach((group) => {
588
- if (group.versionPlans) {
589
- group.versionPlans.forEach((plan) => {
588
+ if (group.resolvedVersionPlans) {
589
+ group.resolvedVersionPlans.forEach((plan) => {
590
590
  (0, fs_extra_1.removeSync)(plan.absolutePath);
591
591
  planFiles.add(plan.relativePath);
592
592
  });
@@ -1,12 +1,14 @@
1
1
  import { CommandModule } from 'yargs';
2
2
  import { OutputStyle, RunManyOptions } from '../yargs-utils/shared-options';
3
3
  import { VersionData } from './utils/shared';
4
- export interface NxReleaseArgs {
4
+ export interface BaseNxReleaseArgs {
5
+ verbose?: boolean;
6
+ printConfig?: boolean | 'debug';
7
+ }
8
+ export interface NxReleaseArgs extends BaseNxReleaseArgs {
5
9
  groups?: string[];
6
10
  projects?: string[];
7
11
  dryRun?: boolean;
8
- verbose?: boolean;
9
- printConfig?: boolean | 'debug';
10
12
  }
11
13
  interface GitCommitAndTagOptions {
12
14
  stageChanges?: boolean;
@@ -43,6 +45,13 @@ export type PlanOptions = NxReleaseArgs & {
43
45
  bump?: string;
44
46
  message?: string;
45
47
  };
48
+ export type PlanCheckOptions = BaseNxReleaseArgs & {
49
+ base?: string;
50
+ head?: string;
51
+ files?: string;
52
+ uncommitted?: boolean;
53
+ untracked?: boolean;
54
+ };
46
55
  export type ReleaseOptions = NxReleaseArgs & FirstReleaseArgs & {
47
56
  yes?: boolean;
48
57
  skipPublish?: boolean;
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.yargsReleaseCommand = void 0;
4
4
  const yargs_1 = require("yargs");
5
5
  const nx_json_1 = require("../../config/nx-json");
6
+ const command_line_utils_1 = require("../../utils/command-line-utils");
6
7
  const logger_1 = require("../../utils/logger");
7
8
  const shared_options_1 = require("../yargs-utils/shared-options");
8
- const command_line_utils_1 = require("../../utils/command-line-utils");
9
9
  exports.yargsReleaseCommand = {
10
10
  command: 'release',
11
11
  describe: 'Orchestrate versioning and publishing of applications and libraries',
@@ -15,6 +15,7 @@ exports.yargsReleaseCommand = {
15
15
  .command(changelogCommand)
16
16
  .command(publishCommand)
17
17
  .command(planCommand)
18
+ .command(planCheckCommand)
18
19
  .demandCommand()
19
20
  // Error on typos/mistyped CLI args, there is no reason to support arbitrary unknown args for these commands
20
21
  .strictOptions()
@@ -206,6 +207,7 @@ const publishCommand = {
206
207
  const planCommand = {
207
208
  command: 'plan [bump]',
208
209
  aliases: ['pl'],
210
+ // TODO: Remove this when docs are added
209
211
  // Create a plan to pick a new version and generate a changelog entry.
210
212
  // Hidden for now until the feature is more stable
211
213
  describe: false,
@@ -237,6 +239,19 @@ const planCommand = {
237
239
  process.exit(result);
238
240
  },
239
241
  };
242
+ const planCheckCommand = {
243
+ command: 'plan:check',
244
+ // TODO: Remove this when docs are added
245
+ // Create a plan to pick a new version and generate a changelog entry.
246
+ // Hidden for now until the feature is more stable
247
+ describe: false,
248
+ builder: (yargs) => (0, shared_options_1.withAffectedOptions)(yargs),
249
+ handler: async (args) => {
250
+ const release = await Promise.resolve().then(() => require('./plan-check'));
251
+ const result = await release.releasePlanCheckCLIHandler(args);
252
+ process.exit(result);
253
+ },
254
+ };
240
255
  function coerceParallelOption(args) {
241
256
  return {
242
257
  ...args,
@@ -144,7 +144,8 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
144
144
  ? defaultIndependentReleaseTagPattern
145
145
  : defaultFixedReleaseTagPattern),
146
146
  conventionalCommits: conventional_commits_1.DEFAULT_CONVENTIONAL_COMMITS_CONFIG,
147
- versionPlans: false,
147
+ versionPlans: (userConfig.versionPlans ||
148
+ false),
148
149
  };
149
150
  const groupProjectsRelationship = userConfig.projectsRelationship || WORKSPACE_DEFAULTS.projectsRelationship;
150
151
  const GROUP_DEFAULTS = {
@@ -200,7 +201,8 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
200
201
  git: userConfig.git,
201
202
  },
202
203
  ], normalizeTrueToEmptyObject(userConfig.changelog));
203
- const rootVersionPlansConfig = userConfig.versionPlans ?? WORKSPACE_DEFAULTS.versionPlans;
204
+ const rootVersionPlansConfig = (userConfig.versionPlans ??
205
+ WORKSPACE_DEFAULTS.versionPlans);
204
206
  const rootConventionalCommitsConfig = deepMergeDefaults([WORKSPACE_DEFAULTS.conventionalCommits], fillUnspecifiedConventionalCommitsProperties(normalizeConventionalCommitsConfig(userConfig.conventionalCommits)));
205
207
  // these options are not supported at the group level, only the root/command level
206
208
  const rootVersionWithoutGlobalOptions = { ...rootVersionConfig };
@@ -1,9 +1,9 @@
1
1
  import { ProjectGraph } from '../../../config/project-graph';
2
2
  import { NxReleaseConfig } from './config';
3
3
  import { GroupVersionPlan, ProjectsVersionPlan } from './version-plans';
4
- export type ReleaseGroupWithName = Omit<NxReleaseConfig['groups'][string], 'versionPlans'> & {
4
+ export type ReleaseGroupWithName = NxReleaseConfig['groups'][string] & {
5
5
  name: string;
6
- versionPlans: (ProjectsVersionPlan | GroupVersionPlan)[] | false;
6
+ resolvedVersionPlans: (ProjectsVersionPlan | GroupVersionPlan)[] | false;
7
7
  };
8
8
  export declare function filterReleaseGroups(projectGraph: ProjectGraph, nxReleaseConfig: NxReleaseConfig, projectsFilter?: string[], groupsFilter?: string[]): {
9
9
  error: null | {
@@ -9,7 +9,7 @@ function filterReleaseGroups(projectGraph, nxReleaseConfig, projectsFilter, grou
9
9
  return {
10
10
  ...group,
11
11
  name,
12
- versionPlans: group.versionPlans ? [] : false,
12
+ resolvedVersionPlans: group.versionPlans ? [] : false,
13
13
  };
14
14
  });
15
15
  const filteredProjectToReleaseGroup = new Map();
@@ -25,5 +25,5 @@ export interface ProjectsVersionPlan extends VersionPlan {
25
25
  projectVersionBumps: Record<string, ReleaseType>;
26
26
  }
27
27
  export declare function readRawVersionPlans(): Promise<RawVersionPlan[]>;
28
- export declare function setVersionPlansOnGroups(rawVersionPlans: RawVersionPlan[], releaseGroups: ReleaseGroupWithName[], allProjectNamesInWorkspace: string[]): ReleaseGroupWithName[];
28
+ export declare function setResolvedVersionPlansOnGroups(rawVersionPlans: RawVersionPlan[], releaseGroups: ReleaseGroupWithName[], allProjectNamesInWorkspace: string[]): ReleaseGroupWithName[];
29
29
  export declare function getVersionPlansAbsolutePath(): string;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.readRawVersionPlans = readRawVersionPlans;
4
- exports.setVersionPlansOnGroups = setVersionPlansOnGroups;
4
+ exports.setResolvedVersionPlansOnGroups = setResolvedVersionPlansOnGroups;
5
5
  exports.getVersionPlansAbsolutePath = getVersionPlansAbsolutePath;
6
6
  const fs_1 = require("fs");
7
7
  const fs_extra_1 = require("fs-extra");
@@ -35,7 +35,7 @@ async function readRawVersionPlans() {
35
35
  }
36
36
  return versionPlans;
37
37
  }
38
- function setVersionPlansOnGroups(rawVersionPlans, releaseGroups, allProjectNamesInWorkspace) {
38
+ function setResolvedVersionPlansOnGroups(rawVersionPlans, releaseGroups, allProjectNamesInWorkspace) {
39
39
  const groupsByName = releaseGroups.reduce((acc, group) => acc.set(group.name, group), new Map());
40
40
  const isDefaultGroup = isDefault(releaseGroups);
41
41
  for (const rawVersionPlan of rawVersionPlans) {
@@ -45,7 +45,7 @@ function setVersionPlansOnGroups(rawVersionPlans, releaseGroups, allProjectNames
45
45
  for (const [key, value] of Object.entries(rawVersionPlan.content)) {
46
46
  if (groupsByName.has(key)) {
47
47
  const group = groupsByName.get(key);
48
- if (!group.versionPlans) {
48
+ if (!group.resolvedVersionPlans) {
49
49
  if (isDefaultGroup) {
50
50
  throw new Error(`Found a version bump in '${rawVersionPlan.fileName}' but version plans are not enabled.`);
51
51
  }
@@ -69,7 +69,7 @@ function setVersionPlansOnGroups(rawVersionPlans, releaseGroups, allProjectNames
69
69
  throw new Error(`Found a version bump for group '${key}' in '${rawVersionPlan.fileName}' with an invalid release type. Please specify one of ${semver_1.RELEASE_TYPES.join(', ')}.`);
70
70
  }
71
71
  }
72
- const existingPlan = (group.versionPlans.find((plan) => plan.fileName === rawVersionPlan.fileName));
72
+ const existingPlan = (group.resolvedVersionPlans.find((plan) => plan.fileName === rawVersionPlan.fileName));
73
73
  if (existingPlan) {
74
74
  if (existingPlan.groupVersionBump !== value) {
75
75
  if (isDefaultGroup) {
@@ -81,7 +81,7 @@ function setVersionPlansOnGroups(rawVersionPlans, releaseGroups, allProjectNames
81
81
  }
82
82
  }
83
83
  else {
84
- group.versionPlans.push({
84
+ group.resolvedVersionPlans.push({
85
85
  absolutePath: rawVersionPlan.absolutePath,
86
86
  relativePath: rawVersionPlan.relativePath,
87
87
  fileName: rawVersionPlan.fileName,
@@ -104,7 +104,7 @@ function setVersionPlansOnGroups(rawVersionPlans, releaseGroups, allProjectNames
104
104
  throw new Error(`Found a version bump for project '${key}' in '${rawVersionPlan.fileName}' but the project is not in any configured release groups.`);
105
105
  }
106
106
  }
107
- if (!groupForProject.versionPlans) {
107
+ if (!groupForProject.resolvedVersionPlans) {
108
108
  if (isDefaultGroup) {
109
109
  throw new Error(`Found a version bump for project '${key}' in '${rawVersionPlan.fileName}' but version plans are not enabled.`);
110
110
  }
@@ -116,12 +116,12 @@ function setVersionPlansOnGroups(rawVersionPlans, releaseGroups, allProjectNames
116
116
  throw new Error(`Found a version bump for project '${key}' in '${rawVersionPlan.fileName}' with an invalid release type. Please specify one of ${semver_1.RELEASE_TYPES.join(', ')}.`);
117
117
  }
118
118
  if (groupForProject.projectsRelationship === 'independent') {
119
- const existingPlan = (groupForProject.versionPlans.find((plan) => plan.fileName === rawVersionPlan.fileName));
119
+ const existingPlan = (groupForProject.resolvedVersionPlans.find((plan) => plan.fileName === rawVersionPlan.fileName));
120
120
  if (existingPlan) {
121
121
  existingPlan.projectVersionBumps[key] = value;
122
122
  }
123
123
  else {
124
- groupForProject.versionPlans.push({
124
+ groupForProject.resolvedVersionPlans.push({
125
125
  absolutePath: rawVersionPlan.absolutePath,
126
126
  relativePath: rawVersionPlan.relativePath,
127
127
  fileName: rawVersionPlan.fileName,
@@ -134,7 +134,7 @@ function setVersionPlansOnGroups(rawVersionPlans, releaseGroups, allProjectNames
134
134
  }
135
135
  }
136
136
  else {
137
- const existingPlan = (groupForProject.versionPlans.find((plan) => plan.fileName === rawVersionPlan.fileName));
137
+ const existingPlan = (groupForProject.resolvedVersionPlans.find((plan) => plan.fileName === rawVersionPlan.fileName));
138
138
  // This can occur if the same fixed release group has multiple entries for different projects within
139
139
  // the same version plan file. This will be the case when users are using the default release group.
140
140
  if (existingPlan) {
@@ -151,7 +151,7 @@ function setVersionPlansOnGroups(rawVersionPlans, releaseGroups, allProjectNames
151
151
  }
152
152
  }
153
153
  else {
154
- groupForProject.versionPlans.push({
154
+ groupForProject.resolvedVersionPlans.push({
155
155
  absolutePath: rawVersionPlan.absolutePath,
156
156
  relativePath: rawVersionPlan.relativePath,
157
157
  fileName: rawVersionPlan.fileName,
@@ -169,8 +169,8 @@ function setVersionPlansOnGroups(rawVersionPlans, releaseGroups, allProjectNames
169
169
  }
170
170
  // Order the plans from newest to oldest
171
171
  releaseGroups.forEach((group) => {
172
- if (group.versionPlans) {
173
- group.versionPlans.sort((a, b) => b.createdOnMs - a.createdOnMs);
172
+ if (group.resolvedVersionPlans) {
173
+ group.resolvedVersionPlans.sort((a, b) => b.createdOnMs - a.createdOnMs);
174
174
  }
175
175
  });
176
176
  return releaseGroups;
@@ -0,0 +1,4 @@
1
+ import { NxReleaseConfiguration } from '../../config/nx-json';
2
+ import { PlanCheckOptions, PlanOptions } from './command-object';
3
+ export declare const releasePlanCheckCLIHandler: (args: PlanCheckOptions) => Promise<number>;
4
+ export declare function createAPI(overrideReleaseConfig: NxReleaseConfiguration): (args: PlanOptions) => Promise<number>;