nx 18.1.0 → 18.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/bin/init-local.js +13 -1
- package/package.json +12 -12
- package/release/changelog-renderer/index.d.ts +2 -0
- package/release/changelog-renderer/index.js +4 -18
- package/schemas/nx-schema.json +62 -1
- package/schemas/project-schema.json +20 -0
- package/src/adapter/angular-json.d.ts +1 -2
- package/src/adapter/angular-json.js +0 -1
- package/src/adapter/ngcli-adapter.js +3 -3
- package/src/command-line/generate/generator-utils.js +2 -2
- package/src/command-line/init/implementation/add-nx-to-nest.js +2 -2
- package/src/command-line/init/implementation/add-nx-to-npm-repo.js +2 -2
- package/src/command-line/init/implementation/utils.d.ts +1 -3
- package/src/command-line/init/implementation/utils.js +9 -16
- package/src/command-line/init/init-v2.js +3 -2
- package/src/command-line/release/changelog.js +17 -14
- package/src/command-line/release/command-object.d.ts +1 -0
- package/src/command-line/release/config/config.d.ts +12 -15
- package/src/command-line/release/config/config.js +151 -22
- package/src/command-line/release/config/conventional-commits.d.ts +2 -0
- package/src/command-line/release/config/conventional-commits.js +98 -0
- package/src/command-line/release/publish.js +4 -3
- package/src/command-line/release/release.js +12 -11
- package/src/command-line/release/utils/git.js +30 -1
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts +2 -1
- package/src/command-line/release/utils/resolve-semver-specifier.js +2 -13
- package/src/command-line/release/utils/semver.d.ts +2 -8
- package/src/command-line/release/utils/semver.js +4 -1
- package/src/command-line/release/utils/shared.d.ts +5 -1
- package/src/command-line/release/version.d.ts +6 -1
- package/src/command-line/release/version.js +71 -19
- package/src/command-line/run/executor-utils.js +2 -2
- package/src/command-line/run/run.js +16 -6
- package/src/config/nx-json.d.ts +31 -0
- package/src/config/schema-utils.js +2 -2
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/polyfills.js +1 -1
- package/src/core/graph/styles.css +1 -1
- package/src/daemon/server/project-graph-incremental-recomputation.js +1 -0
- package/src/devkit-exports.d.ts +1 -2
- package/src/devkit-internals.d.ts +0 -1
- package/src/devkit-internals.js +1 -3
- package/src/executors/run-commands/run-commands.impl.d.ts +7 -1
- package/src/executors/run-commands/run-commands.impl.js +120 -55
- package/src/executors/run-script/run-script.impl.js +6 -6
- package/src/generators/utils/project-configuration.js +2 -2
- package/src/hasher/hash-task.js +2 -2
- package/src/migrations/update-15-1-0/set-project-names.js +2 -4
- package/src/migrations/update-17-2-0/move-default-base.d.ts +1 -1
- package/src/migrations/update-17-2-0/move-default-base.js +3 -1
- package/src/migrations/update-17-3-0/nx-release-path.js +0 -1
- package/src/native/index.d.ts +14 -11
- package/src/native/index.js +3 -4
- package/src/plugins/js/index.d.ts +1 -1
- package/src/plugins/js/index.js +1 -1
- package/src/plugins/js/lock-file/lock-file.d.ts +2 -2
- package/src/plugins/js/lock-file/lock-file.js +15 -3
- package/src/plugins/js/lock-file/npm-parser.d.ts +1 -1
- package/src/plugins/js/lock-file/pnpm-parser.d.ts +1 -1
- package/src/plugins/js/lock-file/yarn-parser.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/build-dependencies.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.d.ts +1 -1
- package/src/plugins/js/utils/register.js +3 -1
- package/src/plugins/package-json-workspaces/create-nodes.d.ts +2 -2
- package/src/plugins/package-json-workspaces/create-nodes.js +31 -24
- package/src/plugins/package-json-workspaces/index.d.ts +0 -1
- package/src/plugins/package-json-workspaces/index.js +0 -2
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.d.ts +1 -2
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.js +0 -1
- package/src/plugins/project-json/build-nodes/project-json.d.ts +1 -2
- package/src/plugins/project-json/build-nodes/project-json.js +0 -1
- package/src/plugins/target-defaults/target-defaults-plugin.d.ts +1 -2
- package/src/plugins/target-defaults/target-defaults-plugin.js +0 -1
- package/src/project-graph/affected/locators/project-glob-changes.js +3 -2
- package/src/project-graph/build-project-graph.js +8 -11
- package/src/project-graph/file-utils.js +6 -4
- package/src/project-graph/project-graph-builder.d.ts +1 -1
- package/src/project-graph/project-graph.js +3 -0
- package/src/project-graph/utils/normalize-project-nodes.d.ts +1 -1
- package/src/project-graph/utils/project-configuration-utils.d.ts +4 -4
- package/src/project-graph/utils/project-configuration-utils.js +58 -17
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +4 -8
- package/src/project-graph/utils/retrieve-workspace-files.js +18 -20
- package/src/tasks-runner/fork.js +7 -7
- package/src/tasks-runner/forked-process-task-runner.d.ts +4 -5
- package/src/tasks-runner/forked-process-task-runner.js +28 -21
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +16 -13
- package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +8 -7
- package/src/tasks-runner/{psuedo-ipc.d.ts → pseudo-ipc.d.ts} +7 -7
- package/src/tasks-runner/{psuedo-ipc.js → pseudo-ipc.js} +9 -9
- package/src/tasks-runner/pseudo-terminal.d.ts +43 -0
- package/src/tasks-runner/pseudo-terminal.js +159 -0
- package/src/tasks-runner/task-orchestrator.js +49 -31
- package/src/tasks-runner/tasks-schedule.js +3 -3
- package/src/tasks-runner/utils.d.ts +7 -6
- package/src/tasks-runner/utils.js +11 -7
- package/src/utils/ignore.js +1 -1
- package/src/utils/logger.d.ts +0 -1
- package/src/utils/logger.js +0 -5
- package/src/{project-graph/plugins/public-api.d.ts → utils/nx-plugin.d.ts} +45 -7
- package/src/utils/nx-plugin.deprecated.d.ts +2 -4
- package/src/utils/nx-plugin.deprecated.js +4 -4
- package/src/utils/nx-plugin.js +293 -0
- package/src/utils/output.js +1 -1
- package/src/utils/plugins/plugin-capabilities.d.ts +1 -1
- package/src/utils/plugins/plugin-capabilities.js +7 -8
- package/src/project-graph/plugins/index.d.ts +0 -2
- package/src/project-graph/plugins/index.js +0 -8
- package/src/project-graph/plugins/internal-api.d.ts +0 -18
- package/src/project-graph/plugins/internal-api.js +0 -48
- package/src/project-graph/plugins/messaging.d.ts +0 -94
- package/src/project-graph/plugins/messaging.js +0 -23
- package/src/project-graph/plugins/plugin-pool.d.ts +0 -4
- package/src/project-graph/plugins/plugin-pool.js +0 -216
- package/src/project-graph/plugins/plugin-worker.d.ts +0 -1
- package/src/project-graph/plugins/plugin-worker.js +0 -115
- package/src/project-graph/plugins/public-api.js +0 -4
- package/src/project-graph/plugins/utils.d.ts +0 -9
- package/src/project-graph/plugins/utils.js +0 -55
- package/src/project-graph/plugins/worker-api.d.ts +0 -26
- package/src/project-graph/plugins/worker-api.js +0 -177
@@ -12,7 +12,11 @@ export type ReleaseVersionGeneratorResult = {
|
|
12
12
|
}) => Promise<string[]>;
|
13
13
|
};
|
14
14
|
export type VersionData = Record<string, {
|
15
|
-
|
15
|
+
/**
|
16
|
+
* newVersion will be null in the case that no changes are detected for the project,
|
17
|
+
* e.g. when using conventional commits
|
18
|
+
*/
|
19
|
+
newVersion: string | null;
|
16
20
|
currentVersion: string;
|
17
21
|
dependentProjects: any[];
|
18
22
|
}>;
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import { ProjectGraph, ProjectGraphProjectNode } from '../../config/project-graph';
|
2
2
|
import { VersionOptions } from './command-object';
|
3
|
+
import { NxReleaseConfig } from './config/config';
|
3
4
|
import { ReleaseGroupWithName } from './config/filter-release-groups';
|
4
5
|
import { VersionData } from './utils/shared';
|
5
6
|
export { deriveNewSemverVersion } from './utils/semver';
|
6
7
|
export type { ReleaseVersionGeneratorResult, VersionData, } from './utils/shared';
|
7
|
-
export declare const validReleaseVersionPrefixes:
|
8
|
+
export declare const validReleaseVersionPrefixes: readonly ["auto", "", "~", "^", "="];
|
8
9
|
export interface ReleaseVersionGeneratorSchema {
|
9
10
|
projects: ProjectGraphProjectNode[];
|
10
11
|
releaseGroup: ReleaseGroupWithName;
|
@@ -18,6 +19,10 @@ export interface ReleaseVersionGeneratorSchema {
|
|
18
19
|
fallbackCurrentVersionResolver?: 'disk';
|
19
20
|
firstRelease?: boolean;
|
20
21
|
versionPrefix?: typeof validReleaseVersionPrefixes[number];
|
22
|
+
skipLockFileUpdate?: boolean;
|
23
|
+
installArgs?: string;
|
24
|
+
installIgnoreScripts?: boolean;
|
25
|
+
conventionalCommitsConfig?: NxReleaseConfig['conventionalCommits'];
|
21
26
|
}
|
22
27
|
export interface NxReleaseVersionResult {
|
23
28
|
/**
|
@@ -2,13 +2,17 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.releaseVersion = exports.releaseVersionCLIHandler = exports.validReleaseVersionPrefixes = exports.deriveNewSemverVersion = void 0;
|
4
4
|
const chalk = require("chalk");
|
5
|
+
const node_child_process_1 = require("node:child_process");
|
5
6
|
const node_fs_1 = require("node:fs");
|
6
7
|
const node_path_1 = require("node:path");
|
7
8
|
const nx_json_1 = require("../../config/nx-json");
|
8
|
-
const devkit_exports_1 = require("../../devkit-exports");
|
9
9
|
const tree_1 = require("../../generators/tree");
|
10
|
+
const file_map_utils_1 = require("../../project-graph/file-map-utils");
|
10
11
|
const project_graph_1 = require("../../project-graph/project-graph");
|
12
|
+
const output_1 = require("../../utils/output");
|
11
13
|
const params_1 = require("../../utils/params");
|
14
|
+
const path_1 = require("../../utils/path");
|
15
|
+
const workspace_root_1 = require("../../utils/workspace-root");
|
12
16
|
const generate_1 = require("../generate/generate");
|
13
17
|
const generator_utils_1 = require("../generate/generator-utils");
|
14
18
|
const config_1 = require("./config/config");
|
@@ -18,10 +22,11 @@ const git_1 = require("./utils/git");
|
|
18
22
|
const print_changes_1 = require("./utils/print-changes");
|
19
23
|
const resolve_nx_json_error_message_1 = require("./utils/resolve-nx-json-error-message");
|
20
24
|
const shared_1 = require("./utils/shared");
|
25
|
+
const LARGE_BUFFER = 1024 * 1000000;
|
21
26
|
// Reexport some utils for use in plugin release-version generator implementations
|
22
27
|
var semver_1 = require("./utils/semver");
|
23
28
|
Object.defineProperty(exports, "deriveNewSemverVersion", { enumerable: true, get: function () { return semver_1.deriveNewSemverVersion; } });
|
24
|
-
exports.validReleaseVersionPrefixes = ['auto', '', '~', '^'];
|
29
|
+
exports.validReleaseVersionPrefixes = ['auto', '', '~', '^', '='];
|
25
30
|
const releaseVersionCLIHandler = (args) => (0, params_1.handleErrors)(args.verbose, () => releaseVersion(args));
|
26
31
|
exports.releaseVersionCLIHandler = releaseVersionCLIHandler;
|
27
32
|
/**
|
@@ -37,7 +42,7 @@ async function releaseVersion(args) {
|
|
37
42
|
process.env.NX_VERBOSE_LOGGING = 'true';
|
38
43
|
}
|
39
44
|
// Apply default configuration to any optional user configuration
|
40
|
-
const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, nxJson.release);
|
45
|
+
const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), nxJson.release);
|
41
46
|
if (configError) {
|
42
47
|
return await (0, config_1.handleNxReleaseConfigError)(configError);
|
43
48
|
}
|
@@ -53,7 +58,7 @@ async function releaseVersion(args) {
|
|
53
58
|
'release',
|
54
59
|
'git',
|
55
60
|
]);
|
56
|
-
|
61
|
+
output_1.output.error({
|
57
62
|
title: `The "release.git" property in nx.json may not be used with the "nx release version" subcommand or programmatic API. Instead, configure git options for subcommands directly with "release.version.git" and "release.changelog.git".`,
|
58
63
|
bodyLines: [nxJsonMessage],
|
59
64
|
});
|
@@ -61,10 +66,14 @@ async function releaseVersion(args) {
|
|
61
66
|
}
|
62
67
|
const { error: filterError, releaseGroups, releaseGroupToFilteredProjects, } = (0, filter_release_groups_1.filterReleaseGroups)(projectGraph, nxReleaseConfig, args.projects, args.groups);
|
63
68
|
if (filterError) {
|
64
|
-
|
69
|
+
output_1.output.error(filterError);
|
65
70
|
process.exit(1);
|
66
71
|
}
|
67
|
-
|
72
|
+
runPreVersionCommand(nxReleaseConfig.version.preVersionCommand, {
|
73
|
+
dryRun: args.dryRun,
|
74
|
+
verbose: args.verbose,
|
75
|
+
});
|
76
|
+
const tree = new tree_1.FsTree(workspace_root_1.workspaceRoot, args.verbose);
|
68
77
|
const versionData = {};
|
69
78
|
const commitMessage = args.gitCommitMessage || nxReleaseConfig.version.git.commitMessage;
|
70
79
|
const additionalChangedFiles = new Set();
|
@@ -88,13 +97,16 @@ async function releaseVersion(args) {
|
|
88
97
|
// all project data from the project graph (not to be confused with projectNamesToRunVersionOn)
|
89
98
|
projects,
|
90
99
|
});
|
91
|
-
const generatorCallback = await runVersionOnProjects(projectGraph, nxJson, args, tree, generatorData, projectNames, releaseGroup, versionData);
|
100
|
+
const generatorCallback = await runVersionOnProjects(projectGraph, nxJson, args, tree, generatorData, args.generatorOptionsOverrides, projectNames, releaseGroup, versionData, nxReleaseConfig.conventionalCommits);
|
92
101
|
// Capture the callback so that we can run it after flushing the changes to disk
|
93
102
|
generatorCallbacks.push(async () => {
|
94
103
|
const changedFiles = await generatorCallback(tree, {
|
95
104
|
dryRun: !!args.dryRun,
|
96
105
|
verbose: !!args.verbose,
|
97
|
-
generatorOptions
|
106
|
+
generatorOptions: {
|
107
|
+
...generatorOptions,
|
108
|
+
...args.generatorOptionsOverrides,
|
109
|
+
},
|
98
110
|
});
|
99
111
|
changedFiles.forEach((f) => additionalChangedFiles.add(f));
|
100
112
|
});
|
@@ -125,7 +137,7 @@ async function releaseVersion(args) {
|
|
125
137
|
await (0, shared_1.commitChanges)(changedFiles, !!args.dryRun, !!args.verbose, (0, shared_1.createCommitMessageValues)(releaseGroups, releaseGroupToFilteredProjects, versionData, commitMessage), args.gitCommitArgs || nxReleaseConfig.version.git.commitArgs);
|
126
138
|
}
|
127
139
|
else if (args.stageChanges ?? nxReleaseConfig.version.git.stageChanges) {
|
128
|
-
|
140
|
+
output_1.output.logSingleLine(`Staging changed files with git`);
|
129
141
|
await (0, git_1.gitAdd)({
|
130
142
|
changedFiles,
|
131
143
|
dryRun: args.dryRun,
|
@@ -133,7 +145,7 @@ async function releaseVersion(args) {
|
|
133
145
|
});
|
134
146
|
}
|
135
147
|
if (args.gitTag ?? nxReleaseConfig.version.git.tag) {
|
136
|
-
|
148
|
+
output_1.output.logSingleLine(`Tagging commit with git`);
|
137
149
|
for (const tag of gitTagValues) {
|
138
150
|
await (0, git_1.gitTag)({
|
139
151
|
tag,
|
@@ -167,13 +179,16 @@ async function releaseVersion(args) {
|
|
167
179
|
// all project data from the project graph (not to be confused with projectNamesToRunVersionOn)
|
168
180
|
projects,
|
169
181
|
});
|
170
|
-
const generatorCallback = await runVersionOnProjects(projectGraph, nxJson, args, tree, generatorData, projectNames, releaseGroup, versionData);
|
182
|
+
const generatorCallback = await runVersionOnProjects(projectGraph, nxJson, args, tree, generatorData, args.generatorOptionsOverrides, projectNames, releaseGroup, versionData, nxReleaseConfig.conventionalCommits);
|
171
183
|
// Capture the callback so that we can run it after flushing the changes to disk
|
172
184
|
generatorCallbacks.push(async () => {
|
173
185
|
const changedFiles = await generatorCallback(tree, {
|
174
186
|
dryRun: !!args.dryRun,
|
175
187
|
verbose: !!args.verbose,
|
176
|
-
generatorOptions
|
188
|
+
generatorOptions: {
|
189
|
+
...generatorOptions,
|
190
|
+
...args.generatorOptionsOverrides,
|
191
|
+
},
|
177
192
|
});
|
178
193
|
changedFiles.forEach((f) => additionalChangedFiles.add(f));
|
179
194
|
});
|
@@ -212,7 +227,7 @@ async function releaseVersion(args) {
|
|
212
227
|
await (0, shared_1.commitChanges)(changedFiles, !!args.dryRun, !!args.verbose, (0, shared_1.createCommitMessageValues)(releaseGroups, releaseGroupToFilteredProjects, versionData, commitMessage), args.gitCommitArgs || nxReleaseConfig.version.git.commitArgs);
|
213
228
|
}
|
214
229
|
else if (args.stageChanges ?? nxReleaseConfig.version.git.stageChanges) {
|
215
|
-
|
230
|
+
output_1.output.logSingleLine(`Staging changed files with git`);
|
216
231
|
await (0, git_1.gitAdd)({
|
217
232
|
changedFiles,
|
218
233
|
dryRun: args.dryRun,
|
@@ -220,7 +235,7 @@ async function releaseVersion(args) {
|
|
220
235
|
});
|
221
236
|
}
|
222
237
|
if (args.gitTag ?? nxReleaseConfig.version.git.tag) {
|
223
|
-
|
238
|
+
output_1.output.logSingleLine(`Tagging commit with git`);
|
224
239
|
for (const tag of gitTagValues) {
|
225
240
|
await (0, git_1.gitTag)({
|
226
241
|
tag,
|
@@ -247,20 +262,22 @@ function appendVersionData(existingVersionData, newVersionData) {
|
|
247
262
|
}
|
248
263
|
return existingVersionData;
|
249
264
|
}
|
250
|
-
async function runVersionOnProjects(projectGraph, nxJson, args, tree, generatorData, projectNames, releaseGroup, versionData) {
|
265
|
+
async function runVersionOnProjects(projectGraph, nxJson, args, tree, generatorData, generatorOverrides, projectNames, releaseGroup, versionData, conventionalCommitsConfig) {
|
251
266
|
const generatorOptions = {
|
252
267
|
// Always ensure a string to avoid generator schema validation errors
|
253
268
|
specifier: args.specifier ?? '',
|
254
269
|
preid: args.preid ?? '',
|
255
270
|
...generatorData.configGeneratorOptions,
|
271
|
+
...(generatorOverrides ?? {}),
|
256
272
|
// The following are not overridable by user config
|
257
273
|
projects: projectNames.map((p) => projectGraph.nodes[p]),
|
258
274
|
projectGraph,
|
259
275
|
releaseGroup,
|
260
276
|
firstRelease: args.firstRelease ?? false,
|
277
|
+
conventionalCommitsConfig,
|
261
278
|
};
|
262
279
|
// Apply generator defaults from schema.json file etc
|
263
|
-
const combinedOpts = await (0, params_1.combineOptionsForGenerator)(generatorOptions, generatorData.collectionName, generatorData.normalizedGeneratorName, (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph), nxJson, generatorData.schema, false, null, (0, node_path_1.relative)(process.cwd(),
|
280
|
+
const combinedOpts = await (0, params_1.combineOptionsForGenerator)(generatorOptions, generatorData.collectionName, generatorData.normalizedGeneratorName, (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph), nxJson, generatorData.schema, false, null, (0, node_path_1.relative)(process.cwd(), workspace_root_1.workspaceRoot), args.verbose);
|
264
281
|
const releaseVersionGenerator = generatorData.implementationFactory();
|
265
282
|
// We expect all version generator implementations to return a ReleaseVersionGeneratorResult object, rather than a GeneratorCallback
|
266
283
|
const versionResult = (await releaseVersionGenerator(tree, combinedOpts));
|
@@ -282,7 +299,7 @@ function printAndFlushChanges(tree, isDryRun) {
|
|
282
299
|
}
|
283
300
|
else if (f.type === 'UPDATE') {
|
284
301
|
console.error(`${chalk.white('UPDATE')} ${f.path}${isDryRun ? chalk.keyword('orange')(' [dry-run]') : ''}`);
|
285
|
-
const currentContentsOnDisk = (0, node_fs_1.readFileSync)((0,
|
302
|
+
const currentContentsOnDisk = (0, node_fs_1.readFileSync)((0, path_1.joinPathFragments)(tree.root, f.path)).toString();
|
286
303
|
(0, print_changes_1.printDiff)(currentContentsOnDisk, f.content?.toString() || '');
|
287
304
|
}
|
288
305
|
else if (f.type === 'DELETE') {
|
@@ -290,7 +307,7 @@ function printAndFlushChanges(tree, isDryRun) {
|
|
290
307
|
}
|
291
308
|
});
|
292
309
|
if (!isDryRun) {
|
293
|
-
(0, tree_1.flushChanges)(
|
310
|
+
(0, tree_1.flushChanges)(workspace_root_1.workspaceRoot, changes);
|
294
311
|
}
|
295
312
|
}
|
296
313
|
function extractGeneratorCollectionAndName(description, generatorString) {
|
@@ -306,7 +323,7 @@ function extractGeneratorCollectionAndName(description, generatorString) {
|
|
306
323
|
}
|
307
324
|
function resolveGeneratorData({ collectionName, generatorName, configGeneratorOptions, projects, }) {
|
308
325
|
try {
|
309
|
-
const { normalizedGeneratorName, schema, implementationFactory } = (0, generator_utils_1.getGeneratorInformation)(collectionName, generatorName,
|
326
|
+
const { normalizedGeneratorName, schema, implementationFactory } = (0, generator_utils_1.getGeneratorInformation)(collectionName, generatorName, workspace_root_1.workspaceRoot, projects);
|
310
327
|
return {
|
311
328
|
collectionName,
|
312
329
|
generatorName,
|
@@ -339,3 +356,38 @@ function resolveGeneratorData({ collectionName, generatorName, configGeneratorOp
|
|
339
356
|
throw err;
|
340
357
|
}
|
341
358
|
}
|
359
|
+
function runPreVersionCommand(preVersionCommand, { dryRun, verbose }) {
|
360
|
+
if (!preVersionCommand) {
|
361
|
+
return;
|
362
|
+
}
|
363
|
+
output_1.output.logSingleLine(`Executing pre-version command`);
|
364
|
+
if (verbose) {
|
365
|
+
console.log(`Executing the following pre-version command:`);
|
366
|
+
console.log(preVersionCommand);
|
367
|
+
}
|
368
|
+
let env = {
|
369
|
+
...process.env,
|
370
|
+
};
|
371
|
+
if (dryRun) {
|
372
|
+
env.NX_DRY_RUN = 'true';
|
373
|
+
}
|
374
|
+
const stdio = verbose ? 'inherit' : 'pipe';
|
375
|
+
try {
|
376
|
+
(0, node_child_process_1.execSync)(preVersionCommand, {
|
377
|
+
encoding: 'utf-8',
|
378
|
+
maxBuffer: LARGE_BUFFER,
|
379
|
+
stdio,
|
380
|
+
env,
|
381
|
+
});
|
382
|
+
}
|
383
|
+
catch (e) {
|
384
|
+
const title = verbose
|
385
|
+
? `The pre-version command failed. See the full output above.`
|
386
|
+
: `The pre-version command failed. Retry with --verbose to see the full output of the pre-version command.`;
|
387
|
+
output_1.output.error({
|
388
|
+
title,
|
389
|
+
bodyLines: [preVersionCommand, e],
|
390
|
+
});
|
391
|
+
process.exit(1);
|
392
|
+
}
|
393
|
+
}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getExecutorInformation = exports.normalizeExecutorSchema = void 0;
|
4
4
|
const path_1 = require("path");
|
5
|
-
const
|
5
|
+
const nx_plugin_1 = require("../../utils/nx-plugin");
|
6
6
|
const fileutils_1 = require("../../utils/fileutils");
|
7
7
|
const schema_utils_1 = require("../../config/schema-utils");
|
8
8
|
const installation_directory_1 = require("../../utils/installation-directory");
|
@@ -55,7 +55,7 @@ function getExecutorInformation(nodeModule, executor, root, projects) {
|
|
55
55
|
}
|
56
56
|
exports.getExecutorInformation = getExecutorInformation;
|
57
57
|
function readExecutorJson(nodeModule, executor, root, projects) {
|
58
|
-
const { json: packageJson, path: packageJsonPath } = (0,
|
58
|
+
const { json: packageJson, path: packageJsonPath } = (0, nx_plugin_1.readPluginPackageJson)(nodeModule, projects, root
|
59
59
|
? [root, __dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)()]
|
60
60
|
: [__dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)()]);
|
61
61
|
const executorsFile = packageJson.executors ?? packageJson.builders;
|
@@ -7,10 +7,10 @@ const path_1 = require("path");
|
|
7
7
|
const serialize_overrides_into_command_line_1 = require("../../utils/serialize-overrides-into-command-line");
|
8
8
|
const project_graph_1 = require("../../project-graph/project-graph");
|
9
9
|
const configuration_1 = require("../../config/configuration");
|
10
|
-
const native_1 = require("../../native");
|
11
10
|
const async_iterator_1 = require("../../utils/async-iterator");
|
12
11
|
const executor_utils_1 = require("./executor-utils");
|
13
|
-
const
|
12
|
+
const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal");
|
13
|
+
const child_process_1 = require("child_process");
|
14
14
|
function printRunHelp(opts, schema, plugin) {
|
15
15
|
(0, print_help_1.printHelp)(`run ${opts.project}:${opts.target}`, schema, {
|
16
16
|
mode: 'run',
|
@@ -67,12 +67,22 @@ async function printTargetRunHelpInternal({ project, target }, root, projectsCon
|
|
67
67
|
executor === 'run-commands' &&
|
68
68
|
targetConfig.options.command) {
|
69
69
|
const command = targetConfig.options.command.split(' ')[0];
|
70
|
-
|
71
|
-
|
72
|
-
|
70
|
+
const helpCommand = `${command} --help`;
|
71
|
+
if (pseudo_terminal_1.PseudoTerminal.isSupported()) {
|
72
|
+
const terminal = (0, pseudo_terminal_1.getPseudoTerminal)();
|
73
|
+
await new Promise(() => {
|
74
|
+
const cp = terminal.runCommand(helpCommand);
|
75
|
+
cp.onExit((code) => {
|
76
|
+
process.exit(code);
|
77
|
+
});
|
78
|
+
});
|
79
|
+
}
|
80
|
+
else {
|
81
|
+
const cp = (0, child_process_1.exec)(helpCommand);
|
82
|
+
cp.on('exit', (code) => {
|
73
83
|
process.exit(code);
|
74
84
|
});
|
75
|
-
}
|
85
|
+
}
|
76
86
|
}
|
77
87
|
else {
|
78
88
|
process.exit(0);
|
package/src/config/nx-json.d.ts
CHANGED
@@ -120,6 +120,30 @@ export interface NxReleaseGitConfiguration {
|
|
120
120
|
*/
|
121
121
|
tagArgs?: string;
|
122
122
|
}
|
123
|
+
export interface NxReleaseConventionalCommitsConfiguration {
|
124
|
+
types?: Record<string,
|
125
|
+
/**
|
126
|
+
* A map of commit types to their configuration.
|
127
|
+
* If a type is set to 'true', then it will be enabled with the default 'semverBump' of 'patch' and will appear in the changelog.
|
128
|
+
* If a type is set to 'false', then it will not trigger a version bump and will be hidden from the changelog.
|
129
|
+
*/
|
130
|
+
{
|
131
|
+
/**
|
132
|
+
* The semver bump to apply when a commit of this type is found.
|
133
|
+
* If set to "none", the commit will be ignored for versioning purposes.
|
134
|
+
*/
|
135
|
+
semverBump?: 'patch' | 'minor' | 'major' | 'none';
|
136
|
+
/**
|
137
|
+
* Configuration for the changelog section for commits of this type.
|
138
|
+
* If set to 'true', then commits of this type will be included in the changelog with their default title for the type.
|
139
|
+
* If set to 'false', then commits of this type will not be included in the changelog.
|
140
|
+
*/
|
141
|
+
changelog?: {
|
142
|
+
title?: string;
|
143
|
+
hidden?: boolean;
|
144
|
+
} | boolean;
|
145
|
+
} | boolean>;
|
146
|
+
}
|
123
147
|
interface NxReleaseConfiguration {
|
124
148
|
/**
|
125
149
|
* Shorthand for amending the projects which will be included in the implicit default release group (all projects by default).
|
@@ -207,6 +231,12 @@ interface NxReleaseConfiguration {
|
|
207
231
|
* Enable or override configuration for git operations as part of the version subcommand
|
208
232
|
*/
|
209
233
|
git?: NxReleaseGitConfiguration;
|
234
|
+
/**
|
235
|
+
* A command to run after validation of nx release configuration, but before versioning begins.
|
236
|
+
* Used for preparing build artifacts. If --dry-run is passed, the command is still executed, but
|
237
|
+
* with the NX_DRY_RUN environment variable set to 'true'.
|
238
|
+
*/
|
239
|
+
preVersionCommand?: string;
|
210
240
|
};
|
211
241
|
/**
|
212
242
|
* Optionally override the git/release tag pattern to use. This field is the source of truth
|
@@ -223,6 +253,7 @@ interface NxReleaseConfiguration {
|
|
223
253
|
* Enable and configure automatic git operations as part of the release
|
224
254
|
*/
|
225
255
|
git?: NxReleaseGitConfiguration;
|
256
|
+
conventionalCommits?: NxReleaseConventionalCommitsConfiguration;
|
226
257
|
}
|
227
258
|
/**
|
228
259
|
* Nx.json configuration
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveSchema = exports.resolveImplementation = exports.getImplementationFactory = void 0;
|
4
4
|
const fs_1 = require("fs");
|
5
5
|
const path_1 = require("path");
|
6
|
-
const
|
6
|
+
const nx_plugin_1 = require("../utils/nx-plugin");
|
7
7
|
/**
|
8
8
|
* This function is used to get the implementation factory of an executor or generator.
|
9
9
|
* @param implementation path to the implementation
|
@@ -15,7 +15,7 @@ function getImplementationFactory(implementation, directory) {
|
|
15
15
|
return () => {
|
16
16
|
const modulePath = resolveImplementation(implementationModulePath, directory);
|
17
17
|
if ((0, path_1.extname)(modulePath) === '.ts') {
|
18
|
-
(0,
|
18
|
+
(0, nx_plugin_1.registerPluginTSTranspiler)();
|
19
19
|
}
|
20
20
|
const module = require(modulePath);
|
21
21
|
return implementationExportName
|