nx 19.5.5 → 19.6.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/package.json +12 -12
  2. package/release/index.d.ts +1 -1
  3. package/release/index.js +2 -1
  4. package/schemas/nx-schema.json +3 -0
  5. package/src/adapter/compat.d.ts +1 -1
  6. package/src/adapter/compat.js +2 -0
  7. package/src/command-line/affected/affected.js +1 -1
  8. package/src/command-line/connect/connect-to-nx-cloud.d.ts +1 -1
  9. package/src/command-line/connect/connect-to-nx-cloud.js +10 -6
  10. package/src/command-line/release/changelog.d.ts +2 -7
  11. package/src/command-line/release/changelog.js +361 -347
  12. package/src/command-line/release/command-object.d.ts +1 -0
  13. package/src/command-line/release/command-object.js +14 -0
  14. package/src/command-line/release/config/deep-merge-json.d.ts +1 -0
  15. package/src/command-line/release/config/deep-merge-json.js +28 -0
  16. package/src/command-line/release/index.d.ts +16 -4
  17. package/src/command-line/release/index.js +23 -9
  18. package/src/command-line/release/plan.d.ts +2 -1
  19. package/src/command-line/release/plan.js +90 -77
  20. package/src/command-line/release/publish.d.ts +2 -6
  21. package/src/command-line/release/publish.js +67 -52
  22. package/src/command-line/release/release.d.ts +2 -1
  23. package/src/command-line/release/release.js +181 -165
  24. package/src/command-line/release/utils/print-config.d.ts +7 -0
  25. package/src/command-line/release/utils/print-config.js +36 -0
  26. package/src/command-line/release/version.d.ts +2 -6
  27. package/src/command-line/release/version.js +179 -165
  28. package/src/command-line/run/run-one.js +1 -1
  29. package/src/command-line/run-many/run-many.js +1 -1
  30. package/src/command-line/yargs-utils/shared-options.d.ts +1 -0
  31. package/src/command-line/yargs-utils/shared-options.js +5 -0
  32. package/src/commands-runner/create-command-graph.js +4 -2
  33. package/src/config/nx-json.d.ts +10 -1
  34. package/src/devkit-internals.d.ts +1 -1
  35. package/src/devkit-internals.js +2 -1
  36. package/src/generators/utils/project-configuration.js +41 -11
  37. package/src/native/nx.wasm32-wasi.wasm +0 -0
  38. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +4 -2
  39. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +61 -20
  40. package/src/nx-cloud/nx-cloud-tasks-runner-shell.d.ts +1 -0
  41. package/src/nx-cloud/utilities/axios.js +9 -2
  42. package/src/nx-cloud/utilities/get-cloud-options.d.ts +1 -1
  43. package/src/nx-cloud/utilities/get-cloud-options.js +3 -2
  44. package/src/plugins/package-json/create-nodes.js +9 -1
  45. package/src/project-graph/plugins/isolation/plugin-pool.js +32 -10
  46. package/src/project-graph/utils/project-configuration-utils.d.ts +1 -0
  47. package/src/project-graph/utils/project-configuration-utils.js +1 -0
  48. package/src/tasks-runner/cache.js +1 -1
  49. package/src/tasks-runner/run-command.js +6 -1
  50. package/src/tasks-runner/utils.js +14 -10
  51. package/src/utils/command-line-utils.d.ts +1 -0
  52. package/src/utils/nx-cloud-utils.js +3 -1
  53. package/src/utils/package-json.d.ts +2 -9
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.releaseCLIHandler = void 0;
4
- exports.release = release;
4
+ exports.createAPI = createAPI;
5
5
  const enquirer_1 = require("enquirer");
6
6
  const fs_extra_1 = require("fs-extra");
7
7
  const nx_json_1 = require("../../config/nx-json");
@@ -11,192 +11,208 @@ const output_1 = require("../../utils/output");
11
11
  const params_1 = require("../../utils/params");
12
12
  const changelog_1 = require("./changelog");
13
13
  const config_1 = require("./config/config");
14
+ const deep_merge_json_1 = require("./config/deep-merge-json");
14
15
  const filter_release_groups_1 = require("./config/filter-release-groups");
15
16
  const version_plans_1 = require("./config/version-plans");
16
17
  const publish_1 = require("./publish");
17
18
  const git_1 = require("./utils/git");
18
19
  const github_1 = require("./utils/github");
20
+ const print_config_1 = require("./utils/print-config");
19
21
  const resolve_nx_json_error_message_1 = require("./utils/resolve-nx-json-error-message");
20
22
  const shared_1 = require("./utils/shared");
21
23
  const version_1 = require("./version");
22
- const releaseCLIHandler = (args) => (0, params_1.handleErrors)(args.verbose, () => release(args));
24
+ const releaseCLIHandler = (args) => (0, params_1.handleErrors)(args.verbose, () => createAPI({})(args));
23
25
  exports.releaseCLIHandler = releaseCLIHandler;
24
- async function release(args) {
25
- const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
26
- const nxJson = (0, nx_json_1.readNxJson)();
27
- if (args.verbose) {
28
- process.env.NX_VERBOSE_LOGGING = 'true';
29
- }
30
- const hasVersionGitConfig = Object.keys(nxJson.release?.version?.git ?? {}).length > 0;
31
- const hasChangelogGitConfig = Object.keys(nxJson.release?.changelog?.git ?? {}).length > 0;
32
- if (hasVersionGitConfig || hasChangelogGitConfig) {
33
- const jsonConfigErrorPath = hasVersionGitConfig
34
- ? ['release', 'version', 'git']
35
- : ['release', 'changelog', 'git'];
36
- const nxJsonMessage = await (0, resolve_nx_json_error_message_1.resolveNxJsonConfigErrorMessage)(jsonConfigErrorPath);
37
- output_1.output.error({
38
- title: `The "release" top level command cannot be used with granular git configuration. Instead, configure git options in the "release.git" property in nx.json, or use the version, changelog, and publish subcommands or programmatic API directly.`,
39
- bodyLines: [nxJsonMessage],
26
+ function createAPI(overrideReleaseConfig) {
27
+ const releaseVersion = (0, version_1.createAPI)(overrideReleaseConfig);
28
+ const releaseChangelog = (0, changelog_1.createAPI)(overrideReleaseConfig);
29
+ const releasePublish = (0, publish_1.createAPI)(overrideReleaseConfig);
30
+ return async function release(args) {
31
+ const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
32
+ const nxJson = (0, nx_json_1.readNxJson)();
33
+ const userProvidedReleaseConfig = (0, deep_merge_json_1.deepMergeJson)(nxJson.release ?? {}, overrideReleaseConfig ?? {});
34
+ if (args.verbose) {
35
+ process.env.NX_VERBOSE_LOGGING = 'true';
36
+ }
37
+ const hasVersionGitConfig = Object.keys(userProvidedReleaseConfig.version?.git ?? {}).length > 0;
38
+ const hasChangelogGitConfig = Object.keys(userProvidedReleaseConfig.changelog?.git ?? {}).length > 0;
39
+ if (hasVersionGitConfig || hasChangelogGitConfig) {
40
+ const jsonConfigErrorPath = hasVersionGitConfig
41
+ ? ['release', 'version', 'git']
42
+ : ['release', 'changelog', 'git'];
43
+ const nxJsonMessage = await (0, resolve_nx_json_error_message_1.resolveNxJsonConfigErrorMessage)(jsonConfigErrorPath);
44
+ output_1.output.error({
45
+ title: `The "release" top level command cannot be used with granular git configuration. Instead, configure git options in the "release.git" property in nx.json, or use the version, changelog, and publish subcommands or programmatic API directly.`,
46
+ bodyLines: [nxJsonMessage],
47
+ });
48
+ process.exit(1);
49
+ }
50
+ // Apply default configuration to any optional user configuration
51
+ const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), userProvidedReleaseConfig);
52
+ if (configError) {
53
+ return await (0, config_1.handleNxReleaseConfigError)(configError);
54
+ }
55
+ // --print-config exits directly as it is not designed to be combined with any other programmatic operations
56
+ if (args.printConfig) {
57
+ return (0, print_config_1.printConfigAndExit)({
58
+ userProvidedReleaseConfig,
59
+ nxReleaseConfig,
60
+ isDebug: args.printConfig === 'debug',
61
+ });
62
+ }
63
+ // These properties must never be undefined as this command should
64
+ // always explicitly override the git operations of the subcommands.
65
+ const shouldCommit = userProvidedReleaseConfig.git?.commit ?? true;
66
+ const shouldStage = (shouldCommit || userProvidedReleaseConfig.git?.stageChanges) ?? false;
67
+ const shouldTag = userProvidedReleaseConfig.git?.tag ?? true;
68
+ const versionResult = await releaseVersion({
69
+ ...args,
70
+ stageChanges: shouldStage,
71
+ gitCommit: false,
72
+ gitTag: false,
73
+ deleteVersionPlans: false,
40
74
  });
41
- process.exit(1);
42
- }
43
- // Apply default configuration to any optional user configuration
44
- const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), nxJson.release);
45
- if (configError) {
46
- return await (0, config_1.handleNxReleaseConfigError)(configError);
47
- }
48
- // These properties must never be undefined as this command should
49
- // always explicitly override the git operations of the subcommands.
50
- const shouldCommit = nxJson.release?.git?.commit ?? true;
51
- const shouldStage = (shouldCommit || nxJson.release?.git?.stageChanges) ?? false;
52
- const shouldTag = nxJson.release?.git?.tag ?? true;
53
- const versionResult = await (0, version_1.releaseVersion)({
54
- ...args,
55
- stageChanges: shouldStage,
56
- gitCommit: false,
57
- gitTag: false,
58
- deleteVersionPlans: false,
59
- });
60
- const changelogResult = await (0, changelog_1.releaseChangelog)({
61
- ...args,
62
- versionData: versionResult.projectsVersionData,
63
- version: versionResult.workspaceVersion,
64
- stageChanges: shouldStage,
65
- gitCommit: false,
66
- gitTag: false,
67
- createRelease: false,
68
- deleteVersionPlans: false,
69
- });
70
- const { error: filterError, releaseGroups, releaseGroupToFilteredProjects, } = (0, filter_release_groups_1.filterReleaseGroups)(projectGraph, nxReleaseConfig, args.projects, args.groups);
71
- if (filterError) {
72
- output_1.output.error(filterError);
73
- process.exit(1);
74
- }
75
- const rawVersionPlans = await (0, version_plans_1.readRawVersionPlans)();
76
- (0, version_plans_1.setVersionPlansOnGroups)(rawVersionPlans, releaseGroups, Object.keys(projectGraph.nodes));
77
- const planFiles = new Set();
78
- releaseGroups.forEach((group) => {
79
- if (group.versionPlans) {
80
- if (group.name === config_1.IMPLICIT_DEFAULT_RELEASE_GROUP) {
81
- output_1.output.logSingleLine(`Removing version plan files`);
82
- }
83
- else {
84
- output_1.output.logSingleLine(`Removing version plan files for group ${group.name}`);
85
- }
86
- group.versionPlans.forEach((plan) => {
87
- if (!args.dryRun) {
88
- (0, fs_extra_1.removeSync)(plan.absolutePath);
89
- if (args.verbose) {
90
- console.log(`Removing ${plan.relativePath}`);
91
- }
75
+ const changelogResult = await releaseChangelog({
76
+ ...args,
77
+ versionData: versionResult.projectsVersionData,
78
+ version: versionResult.workspaceVersion,
79
+ stageChanges: shouldStage,
80
+ gitCommit: false,
81
+ gitTag: false,
82
+ createRelease: false,
83
+ deleteVersionPlans: false,
84
+ });
85
+ const { error: filterError, releaseGroups, releaseGroupToFilteredProjects, } = (0, filter_release_groups_1.filterReleaseGroups)(projectGraph, nxReleaseConfig, args.projects, args.groups);
86
+ if (filterError) {
87
+ output_1.output.error(filterError);
88
+ process.exit(1);
89
+ }
90
+ const rawVersionPlans = await (0, version_plans_1.readRawVersionPlans)();
91
+ (0, version_plans_1.setVersionPlansOnGroups)(rawVersionPlans, releaseGroups, Object.keys(projectGraph.nodes));
92
+ const planFiles = new Set();
93
+ releaseGroups.forEach((group) => {
94
+ if (group.versionPlans) {
95
+ if (group.name === config_1.IMPLICIT_DEFAULT_RELEASE_GROUP) {
96
+ output_1.output.logSingleLine(`Removing version plan files`);
92
97
  }
93
98
  else {
94
- if (args.verbose) {
95
- console.log(`Would remove ${plan.relativePath}, but --dry-run was set`);
96
- }
99
+ output_1.output.logSingleLine(`Removing version plan files for group ${group.name}`);
97
100
  }
98
- planFiles.add(plan.relativePath);
101
+ group.versionPlans.forEach((plan) => {
102
+ if (!args.dryRun) {
103
+ (0, fs_extra_1.removeSync)(plan.absolutePath);
104
+ if (args.verbose) {
105
+ console.log(`Removing ${plan.relativePath}`);
106
+ }
107
+ }
108
+ else {
109
+ if (args.verbose) {
110
+ console.log(`Would remove ${plan.relativePath}, but --dry-run was set`);
111
+ }
112
+ }
113
+ planFiles.add(plan.relativePath);
114
+ });
115
+ }
116
+ });
117
+ const deletedFiles = Array.from(planFiles);
118
+ if (deletedFiles.length > 0) {
119
+ await (0, git_1.gitAdd)({
120
+ changedFiles: [],
121
+ deletedFiles,
122
+ dryRun: args.dryRun,
123
+ verbose: args.verbose,
99
124
  });
100
125
  }
101
- });
102
- const deletedFiles = Array.from(planFiles);
103
- if (deletedFiles.length > 0) {
104
- await (0, git_1.gitAdd)({
105
- changedFiles: [],
106
- deletedFiles,
107
- dryRun: args.dryRun,
108
- verbose: args.verbose,
109
- });
110
- }
111
- if (shouldCommit) {
112
- output_1.output.logSingleLine(`Committing changes with git`);
113
- const commitMessage = nxReleaseConfig.git.commitMessage;
114
- const commitMessageValues = (0, shared_1.createCommitMessageValues)(releaseGroups, releaseGroupToFilteredProjects, versionResult.projectsVersionData, commitMessage);
115
- await (0, git_1.gitCommit)({
116
- messages: commitMessageValues,
117
- additionalArgs: nxReleaseConfig.git.commitArgs,
118
- dryRun: args.dryRun,
119
- verbose: args.verbose,
120
- });
121
- }
122
- if (shouldTag) {
123
- output_1.output.logSingleLine(`Tagging commit with git`);
124
- // Resolve any git tags as early as possible so that we can hard error in case of any duplicates before reaching the actual git command
125
- const gitTagValues = (0, shared_1.createGitTagValues)(releaseGroups, releaseGroupToFilteredProjects, versionResult.projectsVersionData);
126
- (0, shared_1.handleDuplicateGitTags)(gitTagValues);
127
- for (const tag of gitTagValues) {
128
- await (0, git_1.gitTag)({
129
- tag,
130
- message: nxReleaseConfig.git.tagMessage,
131
- additionalArgs: nxReleaseConfig.git.tagArgs,
126
+ if (shouldCommit) {
127
+ output_1.output.logSingleLine(`Committing changes with git`);
128
+ const commitMessage = nxReleaseConfig.git.commitMessage;
129
+ const commitMessageValues = (0, shared_1.createCommitMessageValues)(releaseGroups, releaseGroupToFilteredProjects, versionResult.projectsVersionData, commitMessage);
130
+ await (0, git_1.gitCommit)({
131
+ messages: commitMessageValues,
132
+ additionalArgs: nxReleaseConfig.git.commitArgs,
132
133
  dryRun: args.dryRun,
133
134
  verbose: args.verbose,
134
135
  });
135
136
  }
136
- }
137
- const shouldCreateWorkspaceRelease = (0, changelog_1.shouldCreateGitHubRelease)(nxReleaseConfig.changelog.workspaceChangelog);
138
- let hasPushedChanges = false;
139
- let latestCommit;
140
- if (shouldCreateWorkspaceRelease && changelogResult.workspaceChangelog) {
141
- output_1.output.logSingleLine(`Pushing to git remote`);
142
- // Before we can create/update the release we need to ensure the commit exists on the remote
143
- await (0, git_1.gitPush)({
144
- dryRun: args.dryRun,
145
- verbose: args.verbose,
146
- });
147
- hasPushedChanges = true;
148
- output_1.output.logSingleLine(`Creating GitHub Release`);
149
- latestCommit = await (0, git_1.getCommitHash)('HEAD');
150
- await (0, github_1.createOrUpdateGithubRelease)(changelogResult.workspaceChangelog.releaseVersion, changelogResult.workspaceChangelog.contents, latestCommit, { dryRun: args.dryRun });
151
- }
152
- for (const releaseGroup of releaseGroups) {
153
- const shouldCreateProjectReleases = (0, changelog_1.shouldCreateGitHubRelease)(releaseGroup.changelog);
154
- if (shouldCreateProjectReleases && changelogResult.projectChangelogs) {
155
- const projects = args.projects?.length
156
- ? // If the user has passed a list of projects, we need to use the filtered list of projects within the release group
157
- Array.from(releaseGroupToFilteredProjects.get(releaseGroup))
158
- : // Otherwise, we use the full list of projects within the release group
159
- releaseGroup.projects;
160
- const projectNodes = projects.map((name) => projectGraph.nodes[name]);
161
- for (const project of projectNodes) {
162
- const changelog = changelogResult.projectChangelogs[project.name];
163
- if (!changelog) {
164
- continue;
165
- }
166
- if (!hasPushedChanges) {
167
- output_1.output.logSingleLine(`Pushing to git remote`);
168
- // Before we can create/update the release we need to ensure the commit exists on the remote
169
- await (0, git_1.gitPush)({
170
- dryRun: args.dryRun,
171
- verbose: args.verbose,
172
- });
173
- hasPushedChanges = true;
174
- }
175
- output_1.output.logSingleLine(`Creating GitHub Release`);
176
- if (!latestCommit) {
177
- latestCommit = await (0, git_1.getCommitHash)('HEAD');
137
+ if (shouldTag) {
138
+ output_1.output.logSingleLine(`Tagging commit with git`);
139
+ // Resolve any git tags as early as possible so that we can hard error in case of any duplicates before reaching the actual git command
140
+ const gitTagValues = (0, shared_1.createGitTagValues)(releaseGroups, releaseGroupToFilteredProjects, versionResult.projectsVersionData);
141
+ (0, shared_1.handleDuplicateGitTags)(gitTagValues);
142
+ for (const tag of gitTagValues) {
143
+ await (0, git_1.gitTag)({
144
+ tag,
145
+ message: nxReleaseConfig.git.tagMessage,
146
+ additionalArgs: nxReleaseConfig.git.tagArgs,
147
+ dryRun: args.dryRun,
148
+ verbose: args.verbose,
149
+ });
150
+ }
151
+ }
152
+ const shouldCreateWorkspaceRelease = (0, changelog_1.shouldCreateGitHubRelease)(nxReleaseConfig.changelog.workspaceChangelog);
153
+ let hasPushedChanges = false;
154
+ let latestCommit;
155
+ if (shouldCreateWorkspaceRelease && changelogResult.workspaceChangelog) {
156
+ output_1.output.logSingleLine(`Pushing to git remote`);
157
+ // Before we can create/update the release we need to ensure the commit exists on the remote
158
+ await (0, git_1.gitPush)({
159
+ dryRun: args.dryRun,
160
+ verbose: args.verbose,
161
+ });
162
+ hasPushedChanges = true;
163
+ output_1.output.logSingleLine(`Creating GitHub Release`);
164
+ latestCommit = await (0, git_1.getCommitHash)('HEAD');
165
+ await (0, github_1.createOrUpdateGithubRelease)(changelogResult.workspaceChangelog.releaseVersion, changelogResult.workspaceChangelog.contents, latestCommit, { dryRun: args.dryRun });
166
+ }
167
+ for (const releaseGroup of releaseGroups) {
168
+ const shouldCreateProjectReleases = (0, changelog_1.shouldCreateGitHubRelease)(releaseGroup.changelog);
169
+ if (shouldCreateProjectReleases && changelogResult.projectChangelogs) {
170
+ const projects = args.projects?.length
171
+ ? // If the user has passed a list of projects, we need to use the filtered list of projects within the release group
172
+ Array.from(releaseGroupToFilteredProjects.get(releaseGroup))
173
+ : // Otherwise, we use the full list of projects within the release group
174
+ releaseGroup.projects;
175
+ const projectNodes = projects.map((name) => projectGraph.nodes[name]);
176
+ for (const project of projectNodes) {
177
+ const changelog = changelogResult.projectChangelogs[project.name];
178
+ if (!changelog) {
179
+ continue;
180
+ }
181
+ if (!hasPushedChanges) {
182
+ output_1.output.logSingleLine(`Pushing to git remote`);
183
+ // Before we can create/update the release we need to ensure the commit exists on the remote
184
+ await (0, git_1.gitPush)({
185
+ dryRun: args.dryRun,
186
+ verbose: args.verbose,
187
+ });
188
+ hasPushedChanges = true;
189
+ }
190
+ output_1.output.logSingleLine(`Creating GitHub Release`);
191
+ if (!latestCommit) {
192
+ latestCommit = await (0, git_1.getCommitHash)('HEAD');
193
+ }
194
+ await (0, github_1.createOrUpdateGithubRelease)(changelog.releaseVersion, changelog.contents, latestCommit, { dryRun: args.dryRun });
178
195
  }
179
- await (0, github_1.createOrUpdateGithubRelease)(changelog.releaseVersion, changelog.contents, latestCommit, { dryRun: args.dryRun });
180
196
  }
181
197
  }
182
- }
183
- let hasNewVersion = false;
184
- // null means that all projects are versioned together but there were no changes
185
- if (versionResult.workspaceVersion !== null) {
186
- hasNewVersion = Object.values(versionResult.projectsVersionData).some((version) => version.newVersion !== null);
187
- }
188
- let shouldPublish = !!args.yes && !args.skipPublish && hasNewVersion;
189
- const shouldPromptPublishing = !args.yes && !args.skipPublish && !args.dryRun && hasNewVersion;
190
- if (shouldPromptPublishing) {
191
- shouldPublish = await promptForPublish();
192
- }
193
- if (shouldPublish) {
194
- await (0, publish_1.releasePublish)(args);
195
- }
196
- else {
197
- output_1.output.logSingleLine('Skipped publishing packages.');
198
- }
199
- return versionResult;
198
+ let hasNewVersion = false;
199
+ // null means that all projects are versioned together but there were no changes
200
+ if (versionResult.workspaceVersion !== null) {
201
+ hasNewVersion = Object.values(versionResult.projectsVersionData).some((version) => version.newVersion !== null);
202
+ }
203
+ let shouldPublish = !!args.yes && !args.skipPublish && hasNewVersion;
204
+ const shouldPromptPublishing = !args.yes && !args.skipPublish && !args.dryRun && hasNewVersion;
205
+ if (shouldPromptPublishing) {
206
+ shouldPublish = await promptForPublish();
207
+ }
208
+ if (shouldPublish) {
209
+ await releasePublish(args);
210
+ }
211
+ else {
212
+ output_1.output.logSingleLine('Skipped publishing packages.');
213
+ }
214
+ return versionResult;
215
+ };
200
216
  }
201
217
  async function promptForPublish() {
202
218
  try {
@@ -0,0 +1,7 @@
1
+ import type { NxReleaseConfiguration } from '../../../config/nx-json';
2
+ import type { NxReleaseConfig } from '../config/config';
3
+ export declare function printConfigAndExit({ userProvidedReleaseConfig, nxReleaseConfig, isDebug, }: {
4
+ userProvidedReleaseConfig: NxReleaseConfiguration;
5
+ nxReleaseConfig: NxReleaseConfig;
6
+ isDebug: boolean;
7
+ }): any;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.printConfigAndExit = printConfigAndExit;
4
+ const output_1 = require("../../../utils/output");
5
+ function printConfigAndExit({ userProvidedReleaseConfig, nxReleaseConfig, isDebug, }) {
6
+ if (isDebug) {
7
+ console.log('============================================================= START FINAL INTERNAL CONFIG');
8
+ console.log(JSON.stringify(nxReleaseConfig, null, 2));
9
+ console.log('============================================================= END FINAL INTERNAL CONFIG');
10
+ console.log('');
11
+ console.log('============================================================= START USER CONFIG');
12
+ console.log(JSON.stringify(userProvidedReleaseConfig, null, 2));
13
+ console.log('============================================================= END USER CONFIG');
14
+ output_1.output.log({
15
+ title: 'Resolved Nx Release Configuration',
16
+ bodyLines: [
17
+ 'NOTE: --printConfig was set to debug, so the above output contains two different resolved configs:',
18
+ '',
19
+ '- The config immediately above is the user config, the one provided by you in nx.json and/or the programmatic API.',
20
+ '- The config above that is the low level resolved configuration object used internally by nx release. It can be referenced for advanced troubleshooting.',
21
+ '',
22
+ 'For the user-facing configuration format, and the full list of available options, please reference https://nx.dev/reference/nx-json#release',
23
+ ],
24
+ });
25
+ process.exit(0);
26
+ }
27
+ console.log(JSON.stringify(userProvidedReleaseConfig, null, 2));
28
+ output_1.output.log({
29
+ title: 'Resolved Nx Release Configuration',
30
+ bodyLines: [
31
+ 'The above config is the result of merging any nx release config in nx.json and/or the programmatic API.',
32
+ '',
33
+ 'For details on the configuration format, and the full list of available options, please reference https://nx.dev/reference/nx-json#release',
34
+ ],
35
+ });
36
+ }
@@ -1,3 +1,4 @@
1
+ import { NxReleaseConfiguration } from '../../config/nx-json';
1
2
  import { ProjectGraph, ProjectGraphProjectNode } from '../../config/project-graph';
2
3
  import { VersionOptions } from './command-object';
3
4
  import { NxReleaseConfig } from './config/config';
@@ -45,9 +46,4 @@ export interface NxReleaseVersionResult {
45
46
  projectsVersionData: VersionData;
46
47
  }
47
48
  export declare const releaseVersionCLIHandler: (args: VersionOptions) => Promise<number>;
48
- /**
49
- * NOTE: This function is also exported for programmatic usage and forms part of the public API
50
- * of Nx. We intentionally do not wrap the implementation with handleErrors because users need
51
- * to have control over their own error handling when using the API.
52
- */
53
- export declare function releaseVersion(args: VersionOptions): Promise<NxReleaseVersionResult>;
49
+ export declare function createAPI(overrideReleaseConfig: NxReleaseConfiguration): (args: VersionOptions) => Promise<NxReleaseVersionResult>;