nx 19.6.0-canary.20240809-d3747e0 → 19.6.0-canary.20240813-c72ba9b
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/post-install.js +8 -0
- package/package.json +12 -12
- package/schemas/nx-schema.json +55 -4
- package/schemas/project-schema.json +7 -0
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +1 -0
- package/src/command-line/import/command-object.d.ts +2 -0
- package/src/command-line/import/command-object.js +38 -0
- package/src/command-line/import/import.d.ts +21 -0
- package/src/command-line/import/import.js +173 -0
- package/src/command-line/import/utils/merge-remote-source.d.ts +2 -0
- package/src/command-line/import/utils/merge-remote-source.js +14 -0
- package/src/command-line/import/utils/needs-install.d.ts +3 -0
- package/src/command-line/import/utils/needs-install.js +31 -0
- package/src/command-line/import/utils/prepare-source-repo.d.ts +2 -0
- package/src/command-line/import/utils/prepare-source-repo.js +104 -0
- package/src/command-line/init/init-v2.d.ts +7 -0
- package/src/command-line/init/init-v2.js +49 -16
- package/src/command-line/nx-commands.js +33 -28
- package/src/command-line/release/changelog.js +9 -9
- package/src/command-line/release/command-object.d.ts +12 -3
- package/src/command-line/release/command-object.js +16 -1
- package/src/command-line/release/config/config.js +4 -2
- package/src/command-line/release/config/filter-release-groups.d.ts +2 -2
- package/src/command-line/release/config/filter-release-groups.js +1 -1
- package/src/command-line/release/config/version-plans.d.ts +1 -1
- package/src/command-line/release/config/version-plans.js +12 -12
- package/src/command-line/release/plan-check.d.ts +4 -0
- package/src/command-line/release/plan-check.js +225 -0
- package/src/command-line/release/plan.js +1 -1
- package/src/command-line/release/release.js +3 -3
- package/src/command-line/release/version.js +1 -1
- package/src/command-line/sync/command-object.d.ts +6 -0
- package/src/command-line/sync/command-object.js +25 -0
- package/src/command-line/sync/sync.d.ts +6 -0
- package/src/command-line/sync/sync.js +30 -0
- package/src/command-line/yargs-utils/shared-options.d.ts +1 -1
- package/src/config/nx-json.d.ts +32 -2
- package/src/config/workspace-json-project-json.d.ts +5 -0
- package/src/core/graph/main.js +1 -1
- package/src/daemon/cache.d.ts +1 -0
- package/src/daemon/cache.js +25 -18
- package/src/daemon/client/client.d.ts +5 -0
- package/src/daemon/client/client.js +42 -1
- package/src/daemon/message-types/flush-sync-generator-changes-to-disk.d.ts +6 -0
- package/src/daemon/message-types/flush-sync-generator-changes-to-disk.js +11 -0
- package/src/daemon/message-types/force-shutdown.d.ts +5 -0
- package/src/daemon/message-types/force-shutdown.js +11 -0
- package/src/daemon/message-types/get-registered-sync-generators.d.ts +5 -0
- package/src/daemon/message-types/get-registered-sync-generators.js +11 -0
- package/src/daemon/message-types/get-sync-generator-changes.d.ts +6 -0
- package/src/daemon/message-types/get-sync-generator-changes.js +11 -0
- package/src/daemon/message-types/update-workspace-context.d.ts +8 -0
- package/src/daemon/message-types/update-workspace-context.js +11 -0
- package/src/daemon/server/handle-flush-sync-generator-changes-to-disk.d.ts +2 -0
- package/src/daemon/server/handle-flush-sync-generator-changes-to-disk.js +11 -0
- package/src/daemon/server/handle-force-shutdown.d.ts +5 -0
- package/src/daemon/server/handle-force-shutdown.js +18 -0
- package/src/daemon/server/handle-get-registered-sync-generators.d.ts +2 -0
- package/src/daemon/server/handle-get-registered-sync-generators.js +11 -0
- package/src/daemon/server/handle-get-sync-generator-changes.d.ts +2 -0
- package/src/daemon/server/handle-get-sync-generator-changes.js +17 -0
- package/src/daemon/server/handle-request-shutdown.js +2 -0
- package/src/daemon/server/handle-update-workspace-context.d.ts +2 -0
- package/src/daemon/server/handle-update-workspace-context.js +11 -0
- package/src/daemon/server/project-graph-incremental-recomputation.d.ts +1 -0
- package/src/daemon/server/project-graph-incremental-recomputation.js +19 -2
- package/src/daemon/server/server.d.ts +1 -0
- package/src/daemon/server/server.js +39 -0
- package/src/daemon/server/shutdown-utils.d.ts +2 -1
- package/src/daemon/server/shutdown-utils.js +11 -4
- package/src/daemon/server/sync-generators.d.ts +6 -0
- package/src/daemon/server/sync-generators.js +202 -0
- package/src/daemon/server/watcher.js +3 -0
- package/src/daemon/socket-utils.js +18 -5
- package/src/daemon/tmp-dir.js +2 -1
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +1 -1
- package/src/nx-cloud/models/onboarding-status.d.ts +1 -0
- package/src/nx-cloud/models/onboarding-status.js +2 -0
- package/src/nx-cloud/utilities/is-workspace-claimed.d.ts +1 -0
- package/src/nx-cloud/utilities/is-workspace-claimed.js +24 -0
- package/src/nx-cloud/utilities/onboarding.d.ts +5 -0
- package/src/nx-cloud/utilities/onboarding.js +28 -0
- package/src/project-graph/plugins/internal-api.js +16 -5
- package/src/project-graph/plugins/isolation/messaging.d.ts +5 -1
- package/src/project-graph/plugins/isolation/messaging.js +1 -0
- package/src/project-graph/plugins/isolation/plugin-pool.js +4 -6
- package/src/project-graph/plugins/isolation/plugin-worker.js +15 -0
- package/src/project-graph/utils/project-configuration-utils.js +5 -2
- package/src/tasks-runner/run-command.d.ts +1 -1
- package/src/tasks-runner/run-command.js +120 -2
- package/src/utils/command-line-utils.d.ts +1 -0
- package/src/utils/command-line-utils.js +6 -3
- package/src/utils/git-utils.d.ts +35 -0
- package/src/utils/git-utils.js +111 -0
- package/src/utils/package-manager.js +1 -1
- package/src/utils/plugins/output.js +1 -1
- package/src/utils/squash.d.ts +1 -0
- package/src/utils/squash.js +12 -0
- package/src/utils/sync-generators.d.ts +22 -0
- package/src/utils/sync-generators.js +161 -0
- package/src/utils/workspace-context.d.ts +1 -0
- package/src/utils/workspace-context.js +16 -0
- package/src/daemon/message-types/update-context-files.d.ts +0 -7
- package/src/daemon/message-types/update-context-files.js +0 -11
@@ -0,0 +1,225 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.releasePlanCheckCLIHandler = void 0;
|
4
|
+
exports.createAPI = createAPI;
|
5
|
+
const nx_json_1 = require("../../config/nx-json");
|
6
|
+
const workspace_projects_1 = require("../../project-graph/affected/locators/workspace-projects");
|
7
|
+
const file_map_utils_1 = require("../../project-graph/file-map-utils");
|
8
|
+
const file_utils_1 = require("../../project-graph/file-utils");
|
9
|
+
const project_graph_1 = require("../../project-graph/project-graph");
|
10
|
+
const all_file_data_1 = require("../../utils/all-file-data");
|
11
|
+
const command_line_utils_1 = require("../../utils/command-line-utils");
|
12
|
+
const ignore_1 = require("../../utils/ignore");
|
13
|
+
const output_1 = require("../../utils/output");
|
14
|
+
const params_1 = require("../../utils/params");
|
15
|
+
const config_1 = require("./config/config");
|
16
|
+
const deep_merge_json_1 = require("./config/deep-merge-json");
|
17
|
+
const filter_release_groups_1 = require("./config/filter-release-groups");
|
18
|
+
const version_plans_1 = require("./config/version-plans");
|
19
|
+
const print_config_1 = require("./utils/print-config");
|
20
|
+
const releasePlanCheckCLIHandler = (args) => (0, params_1.handleErrors)(args.verbose, () => createAPI({})(args));
|
21
|
+
exports.releasePlanCheckCLIHandler = releasePlanCheckCLIHandler;
|
22
|
+
function createAPI(overrideReleaseConfig) {
|
23
|
+
return async function releasePlanCheck(args) {
|
24
|
+
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
|
25
|
+
const nxJson = (0, nx_json_1.readNxJson)();
|
26
|
+
const userProvidedReleaseConfig = (0, deep_merge_json_1.deepMergeJson)(nxJson.release ?? {}, overrideReleaseConfig ?? {});
|
27
|
+
if (args.verbose) {
|
28
|
+
process.env.NX_VERBOSE_LOGGING = 'true';
|
29
|
+
}
|
30
|
+
// Apply default configuration to any optional user configuration
|
31
|
+
const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), userProvidedReleaseConfig);
|
32
|
+
if (configError) {
|
33
|
+
return await (0, config_1.handleNxReleaseConfigError)(configError);
|
34
|
+
}
|
35
|
+
// --print-config exits directly as it is not designed to be combined with any other programmatic operations
|
36
|
+
if (args.printConfig) {
|
37
|
+
return (0, print_config_1.printConfigAndExit)({
|
38
|
+
userProvidedReleaseConfig,
|
39
|
+
nxReleaseConfig,
|
40
|
+
isDebug: args.printConfig === 'debug',
|
41
|
+
});
|
42
|
+
}
|
43
|
+
const { error: filterError, releaseGroups, releaseGroupToFilteredProjects, } = (0, filter_release_groups_1.filterReleaseGroups)(projectGraph, nxReleaseConfig, args.projects, args.groups);
|
44
|
+
if (filterError) {
|
45
|
+
output_1.output.error(filterError);
|
46
|
+
process.exit(1);
|
47
|
+
}
|
48
|
+
// If no release groups have version plans enabled, provide an explicit error
|
49
|
+
if (!releaseGroups.some((group) => group.versionPlans)) {
|
50
|
+
output_1.output.error({
|
51
|
+
title: 'Version plans are not enabled',
|
52
|
+
bodyLines: [
|
53
|
+
'Please ensure at least one release group has version plans enabled in your Nx release configuration if you want to use this command.',
|
54
|
+
// TODO: Add docs link here once it is available
|
55
|
+
],
|
56
|
+
});
|
57
|
+
return 1;
|
58
|
+
}
|
59
|
+
const rawVersionPlans = await (0, version_plans_1.readRawVersionPlans)();
|
60
|
+
(0, version_plans_1.setResolvedVersionPlansOnGroups)(rawVersionPlans, releaseGroups, Object.keys(projectGraph.nodes));
|
61
|
+
// Resolve the final values for base, head etc to use when resolving the changes to consider
|
62
|
+
const { nxArgs } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', {
|
63
|
+
printWarnings: args.verbose,
|
64
|
+
}, nxJson);
|
65
|
+
const changedFiles = (0, command_line_utils_1.parseFiles)(nxArgs).files;
|
66
|
+
if (nxArgs.verbose) {
|
67
|
+
if (changedFiles.length) {
|
68
|
+
output_1.output.log({
|
69
|
+
title: `Changed files based on resolved "base" (${nxArgs.base}) and "head" (${nxArgs.head ?? 'HEAD'})`,
|
70
|
+
bodyLines: changedFiles.map((file) => ` - ${file}`),
|
71
|
+
});
|
72
|
+
}
|
73
|
+
else {
|
74
|
+
output_1.output.warn({
|
75
|
+
title: 'No changed files found based on resolved "base" and "head"',
|
76
|
+
});
|
77
|
+
}
|
78
|
+
}
|
79
|
+
const resolvedAllFileData = await (0, all_file_data_1.allFileData)();
|
80
|
+
/**
|
81
|
+
* Create a minimal subset of touched projects based on the configured ignore patterns, we only need
|
82
|
+
* to recompute when the ignorePatternsForPlanCheck differs between release groups.
|
83
|
+
*/
|
84
|
+
const serializedIgnorePatternsToTouchedProjects = new Map();
|
85
|
+
const NOTE_ABOUT_VERBOSE_LOGGING = 'Run with --verbose to see the full list of changed files used for the touched projects logic.';
|
86
|
+
let hasErrors = false;
|
87
|
+
for (const releaseGroup of releaseGroups) {
|
88
|
+
// The current release group doesn't leverage version plans
|
89
|
+
if (!releaseGroup.versionPlans) {
|
90
|
+
continue;
|
91
|
+
}
|
92
|
+
const resolvedVersionPlans = releaseGroup.resolvedVersionPlans || [];
|
93
|
+
// Check upfront if the release group as a whole is featured in any version plan files
|
94
|
+
const matchingVersionPlanFiles = resolvedVersionPlans.filter((plan) => 'groupVersionBump' in plan);
|
95
|
+
if (matchingVersionPlanFiles.length) {
|
96
|
+
output_1.output.log({
|
97
|
+
title: `${releaseGroup.name === config_1.IMPLICIT_DEFAULT_RELEASE_GROUP
|
98
|
+
? `There are`
|
99
|
+
: `Release group "${releaseGroup.name}" has`} pending bumps in version plan(s)`,
|
100
|
+
bodyLines: [
|
101
|
+
...matchingVersionPlanFiles.map((plan) => ` - "${plan.groupVersionBump}" in ${plan.fileName}`),
|
102
|
+
],
|
103
|
+
});
|
104
|
+
continue;
|
105
|
+
}
|
106
|
+
// Exclude patterns from .nxignore, .gitignore and explicit version plan config
|
107
|
+
let serializedIgnorePatterns = '[]';
|
108
|
+
const ignore = (0, ignore_1.getIgnoreObject)();
|
109
|
+
if (typeof releaseGroup.versionPlans !== 'boolean' &&
|
110
|
+
Array.isArray(releaseGroup.versionPlans.ignorePatternsForPlanCheck) &&
|
111
|
+
releaseGroup.versionPlans.ignorePatternsForPlanCheck.length) {
|
112
|
+
output_1.output.note({
|
113
|
+
title: `Applying configured ignore patterns to changed files${releaseGroup.name !== config_1.IMPLICIT_DEFAULT_RELEASE_GROUP
|
114
|
+
? ` for release group "${releaseGroup.name}"`
|
115
|
+
: ''}`,
|
116
|
+
bodyLines: [
|
117
|
+
...releaseGroup.versionPlans.ignorePatternsForPlanCheck.map((pattern) => ` - ${pattern}`),
|
118
|
+
],
|
119
|
+
});
|
120
|
+
ignore.add(releaseGroup.versionPlans.ignorePatternsForPlanCheck);
|
121
|
+
serializedIgnorePatterns = JSON.stringify(releaseGroup.versionPlans.ignorePatternsForPlanCheck);
|
122
|
+
}
|
123
|
+
let touchedProjects = {};
|
124
|
+
if (serializedIgnorePatternsToTouchedProjects.has(serializedIgnorePatterns)) {
|
125
|
+
touchedProjects = serializedIgnorePatternsToTouchedProjects.get(serializedIgnorePatterns);
|
126
|
+
}
|
127
|
+
else {
|
128
|
+
// We only care about directly touched projects, not implicitly affected ones etc
|
129
|
+
const touchedProjectsArr = await (0, workspace_projects_1.getTouchedProjects)((0, file_utils_1.calculateFileChanges)(changedFiles, resolvedAllFileData, nxArgs, undefined, ignore), projectGraph.nodes);
|
130
|
+
touchedProjects = touchedProjectsArr.reduce((acc, project) => ({ ...acc, [project]: true }), {});
|
131
|
+
serializedIgnorePatternsToTouchedProjects.set(serializedIgnorePatterns, touchedProjects);
|
132
|
+
}
|
133
|
+
const touchedProjectsUnderReleaseGroup = releaseGroup.projects.filter((project) => touchedProjects[project]);
|
134
|
+
if (touchedProjectsUnderReleaseGroup.length) {
|
135
|
+
output_1.output.log({
|
136
|
+
title: `Touched projects based on changed files${releaseGroup.name !== config_1.IMPLICIT_DEFAULT_RELEASE_GROUP
|
137
|
+
? ` under release group "${releaseGroup.name}"`
|
138
|
+
: ''}`,
|
139
|
+
bodyLines: [
|
140
|
+
...touchedProjectsUnderReleaseGroup.map((project) => ` - ${project}`),
|
141
|
+
'',
|
142
|
+
'NOTE: You can adjust your "versionPlans.ignorePatternsForPlanCheck" config to stop certain files from resulting in projects being classed as touched for the purposes of this command.',
|
143
|
+
],
|
144
|
+
});
|
145
|
+
}
|
146
|
+
else {
|
147
|
+
output_1.output.log({
|
148
|
+
title: `No touched projects found based on changed files${typeof releaseGroup.versionPlans !== 'boolean' &&
|
149
|
+
Array.isArray(releaseGroup.versionPlans.ignorePatternsForPlanCheck) &&
|
150
|
+
releaseGroup.versionPlans.ignorePatternsForPlanCheck.length
|
151
|
+
? ' combined with configured ignore patterns'
|
152
|
+
: ''}${releaseGroup.name !== config_1.IMPLICIT_DEFAULT_RELEASE_GROUP
|
153
|
+
? ` under release group "${releaseGroup.name}"`
|
154
|
+
: ''}`,
|
155
|
+
});
|
156
|
+
}
|
157
|
+
const projectsInResolvedVersionPlans = resolvedVersionPlans.reduce((acc, plan) => {
|
158
|
+
if ('projectVersionBumps' in plan) {
|
159
|
+
for (const project in plan.projectVersionBumps) {
|
160
|
+
acc[project] = acc[project] || [];
|
161
|
+
acc[project].push({
|
162
|
+
bump: plan.projectVersionBumps[project],
|
163
|
+
fileName: plan.fileName,
|
164
|
+
});
|
165
|
+
}
|
166
|
+
}
|
167
|
+
return acc;
|
168
|
+
}, {});
|
169
|
+
// Ensure each touched project under this release group features in at least one version plan file
|
170
|
+
let touchedProjectsNotFoundInVersionPlans = [];
|
171
|
+
for (const touchedProject of touchedProjectsUnderReleaseGroup) {
|
172
|
+
if (!resolvedVersionPlans.length) {
|
173
|
+
touchedProjectsNotFoundInVersionPlans.push(touchedProject);
|
174
|
+
continue;
|
175
|
+
}
|
176
|
+
const matchingVersionPlanFileEntries = projectsInResolvedVersionPlans[touchedProject];
|
177
|
+
if (!matchingVersionPlanFileEntries?.length) {
|
178
|
+
touchedProjectsNotFoundInVersionPlans.push(touchedProject);
|
179
|
+
continue;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
// Log any resolved pending bumps, regardless of whether the projects were directly touched or not
|
183
|
+
for (const [projectName, entries] of Object.entries(projectsInResolvedVersionPlans)) {
|
184
|
+
output_1.output.log({
|
185
|
+
title: `Project "${projectName}" has pending bumps in version plan(s)`,
|
186
|
+
bodyLines: [
|
187
|
+
...entries.map(({ bump, fileName }) => ` - "${bump}" in ${fileName}`),
|
188
|
+
],
|
189
|
+
});
|
190
|
+
}
|
191
|
+
if (touchedProjectsNotFoundInVersionPlans.length) {
|
192
|
+
const bodyLines = [
|
193
|
+
`The following touched projects${releaseGroup.name !== config_1.IMPLICIT_DEFAULT_RELEASE_GROUP
|
194
|
+
? ` under release group "${releaseGroup.name}"`
|
195
|
+
: ''} do not feature in any version plan files:`,
|
196
|
+
...touchedProjectsNotFoundInVersionPlans.map((project) => ` - ${project}`),
|
197
|
+
'',
|
198
|
+
'Please use `nx release plan` to generate missing version plans, or adjust your "versionPlans.ignorePatternsForPlanCheck" config stop certain files from affecting the projects for the purposes of this command.',
|
199
|
+
];
|
200
|
+
if (!nxArgs.verbose) {
|
201
|
+
bodyLines.push('', NOTE_ABOUT_VERBOSE_LOGGING);
|
202
|
+
}
|
203
|
+
output_1.output.error({
|
204
|
+
title: 'Touched projects missing version plans',
|
205
|
+
bodyLines,
|
206
|
+
});
|
207
|
+
// At least one project in one release group has an issue
|
208
|
+
hasErrors = true;
|
209
|
+
}
|
210
|
+
}
|
211
|
+
// Do not print success message if any projects are missing version plans
|
212
|
+
if (hasErrors) {
|
213
|
+
return 1;
|
214
|
+
}
|
215
|
+
const bodyLines = [];
|
216
|
+
if (!nxArgs.verbose) {
|
217
|
+
bodyLines.push(NOTE_ABOUT_VERBOSE_LOGGING);
|
218
|
+
}
|
219
|
+
output_1.output.success({
|
220
|
+
title: 'All touched projects have, or do not require, version plans.',
|
221
|
+
bodyLines,
|
222
|
+
});
|
223
|
+
return 0;
|
224
|
+
};
|
225
|
+
}
|
@@ -31,7 +31,7 @@ function createAPI(overrideReleaseConfig) {
|
|
31
31
|
process.env.NX_VERBOSE_LOGGING = 'true';
|
32
32
|
}
|
33
33
|
// Apply default configuration to any optional user configuration
|
34
|
-
const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph),
|
34
|
+
const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), userProvidedReleaseConfig);
|
35
35
|
if (configError) {
|
36
36
|
return await (0, config_1.handleNxReleaseConfigError)(configError);
|
37
37
|
}
|
@@ -88,17 +88,17 @@ function createAPI(overrideReleaseConfig) {
|
|
88
88
|
process.exit(1);
|
89
89
|
}
|
90
90
|
const rawVersionPlans = await (0, version_plans_1.readRawVersionPlans)();
|
91
|
-
(0, version_plans_1.
|
91
|
+
(0, version_plans_1.setResolvedVersionPlansOnGroups)(rawVersionPlans, releaseGroups, Object.keys(projectGraph.nodes));
|
92
92
|
const planFiles = new Set();
|
93
93
|
releaseGroups.forEach((group) => {
|
94
|
-
if (group.
|
94
|
+
if (group.resolvedVersionPlans) {
|
95
95
|
if (group.name === config_1.IMPLICIT_DEFAULT_RELEASE_GROUP) {
|
96
96
|
output_1.output.logSingleLine(`Removing version plan files`);
|
97
97
|
}
|
98
98
|
else {
|
99
99
|
output_1.output.logSingleLine(`Removing version plan files for group ${group.name}`);
|
100
100
|
}
|
101
|
-
group.
|
101
|
+
group.resolvedVersionPlans.forEach((plan) => {
|
102
102
|
if (!args.dryRun) {
|
103
103
|
(0, fs_extra_1.removeSync)(plan.absolutePath);
|
104
104
|
if (args.verbose) {
|
@@ -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.
|
87
|
+
(0, version_plans_1.setResolvedVersionPlansOnGroups)(rawVersionPlans, releaseGroups, Object.keys(projectGraph.nodes));
|
88
88
|
if (args.deleteVersionPlans === undefined) {
|
89
89
|
// default to not delete version plans after versioning as they may be needed for changelog generation
|
90
90
|
args.deleteVersionPlans = false;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import type { CommandModule } from 'yargs';
|
2
|
+
export interface SyncArgs {
|
3
|
+
verbose?: boolean;
|
4
|
+
}
|
5
|
+
export declare const yargsSyncCommand: CommandModule<Record<string, unknown>, SyncArgs>;
|
6
|
+
export declare const yargsSyncCheckCommand: CommandModule<Record<string, unknown>, SyncArgs>;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.yargsSyncCheckCommand = exports.yargsSyncCommand = void 0;
|
4
|
+
exports.yargsSyncCommand = {
|
5
|
+
command: 'sync',
|
6
|
+
describe: false,
|
7
|
+
builder: (yargs) => yargs.option('verbose', {
|
8
|
+
type: 'boolean',
|
9
|
+
description: 'Prints additional information about the commands (e.g., stack traces)',
|
10
|
+
}),
|
11
|
+
handler: async (args) => {
|
12
|
+
process.exit(await Promise.resolve().then(() => require('./sync')).then((m) => m.syncHandler(args)));
|
13
|
+
},
|
14
|
+
};
|
15
|
+
exports.yargsSyncCheckCommand = {
|
16
|
+
command: 'sync:check',
|
17
|
+
describe: false,
|
18
|
+
builder: (yargs) => yargs.option('verbose', {
|
19
|
+
type: 'boolean',
|
20
|
+
description: 'Prints additional information about the commands (e.g., stack traces)',
|
21
|
+
}),
|
22
|
+
handler: async (args) => {
|
23
|
+
process.exit(await Promise.resolve().then(() => require('./sync')).then((m) => m.syncHandler({ ...args, check: true })));
|
24
|
+
},
|
25
|
+
};
|
@@ -0,0 +1,30 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.syncHandler = syncHandler;
|
4
|
+
const project_graph_1 = require("../../project-graph/project-graph");
|
5
|
+
const output_1 = require("../../utils/output");
|
6
|
+
const params_1 = require("../../utils/params");
|
7
|
+
const sync_generators_1 = require("../../utils/sync-generators");
|
8
|
+
function syncHandler(options) {
|
9
|
+
if (options.verbose) {
|
10
|
+
process.env.NX_VERBOSE_LOGGING = 'true';
|
11
|
+
}
|
12
|
+
const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
13
|
+
return (0, params_1.handleErrors)(isVerbose, async () => {
|
14
|
+
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
|
15
|
+
const syncGenerators = await (0, sync_generators_1.collectAllRegisteredSyncGenerators)(projectGraph);
|
16
|
+
const results = await (0, sync_generators_1.getSyncGeneratorChanges)(syncGenerators);
|
17
|
+
if (!results.length) {
|
18
|
+
return 0;
|
19
|
+
}
|
20
|
+
if (options.check) {
|
21
|
+
output_1.output.error({
|
22
|
+
title: `The workspace is out of sync`,
|
23
|
+
bodyLines: (0, sync_generators_1.syncGeneratorResultsToMessageLines)(results),
|
24
|
+
});
|
25
|
+
return 1;
|
26
|
+
}
|
27
|
+
await (0, sync_generators_1.flushSyncGeneratorChanges)(results);
|
28
|
+
return 0;
|
29
|
+
});
|
30
|
+
}
|
@@ -29,7 +29,7 @@ export declare function withTargetAndConfigurationOption(yargs: Argv, demandOpti
|
|
29
29
|
export declare function withConfiguration(yargs: Argv): Argv<{
|
30
30
|
configuration: string;
|
31
31
|
}>;
|
32
|
-
export declare function withVerbose(yargs: Argv): Argv<{
|
32
|
+
export declare function withVerbose<T>(yargs: Argv<T>): Argv<T & {
|
33
33
|
verbose: boolean;
|
34
34
|
}>;
|
35
35
|
export declare function withBatch(yargs: Argv): any;
|
package/src/config/nx-json.d.ts
CHANGED
@@ -145,6 +145,13 @@ export interface NxReleaseConventionalCommitsConfiguration {
|
|
145
145
|
} | boolean;
|
146
146
|
} | boolean>;
|
147
147
|
}
|
148
|
+
export interface NxReleaseVersionPlansConfiguration {
|
149
|
+
/**
|
150
|
+
* Changes to files matching any of these optional patterns will be excluded from the affected project logic within the `nx release plan:check`
|
151
|
+
* command. This is useful for ignoring files that are not relevant to the versioning process, such as documentation or configuration files.
|
152
|
+
*/
|
153
|
+
ignorePatternsForPlanCheck?: string[];
|
154
|
+
}
|
148
155
|
export interface NxReleaseConfiguration {
|
149
156
|
/**
|
150
157
|
* Shorthand for amending the projects which will be included in the implicit default release group (all projects by default).
|
@@ -193,7 +200,7 @@ export interface NxReleaseConfiguration {
|
|
193
200
|
* Enables using version plans as a specifier source for versioning and
|
194
201
|
* to determine changes for changelog generation.
|
195
202
|
*/
|
196
|
-
versionPlans?: boolean;
|
203
|
+
versionPlans?: NxReleaseVersionPlansConfiguration | boolean;
|
197
204
|
}>;
|
198
205
|
/**
|
199
206
|
* Configures the default value for all groups that don't explicitly state their own projectsRelationship.
|
@@ -264,7 +271,26 @@ export interface NxReleaseConfiguration {
|
|
264
271
|
* Enables using version plans as a specifier source for versioning and
|
265
272
|
* to determine changes for changelog generation.
|
266
273
|
*/
|
267
|
-
versionPlans?: boolean;
|
274
|
+
versionPlans?: NxReleaseVersionPlansConfiguration | boolean;
|
275
|
+
}
|
276
|
+
export interface NxSyncConfiguration {
|
277
|
+
/**
|
278
|
+
* List of workspace-wide sync generators to be run (not attached to targets).
|
279
|
+
*/
|
280
|
+
globalGenerators?: string[];
|
281
|
+
/**
|
282
|
+
* Options for the sync generators.
|
283
|
+
*/
|
284
|
+
generatorOptions?: {
|
285
|
+
[generatorName: string]: Record<string, unknown>;
|
286
|
+
};
|
287
|
+
/**
|
288
|
+
* Whether to automatically apply sync generator changes when running tasks.
|
289
|
+
* If not set, the user will be prompted.
|
290
|
+
* If set to `true`, the user will not be prompted and the changes will be applied.
|
291
|
+
* If set to `false`, the user will not be prompted and the changes will not be applied.
|
292
|
+
*/
|
293
|
+
applyChanges?: boolean;
|
268
294
|
}
|
269
295
|
/**
|
270
296
|
* Nx.json configuration
|
@@ -413,6 +439,10 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
|
|
413
439
|
* Set this to false to disable connection to Nx Cloud
|
414
440
|
*/
|
415
441
|
neverConnectToCloud?: boolean;
|
442
|
+
/**
|
443
|
+
* Configuration for the `nx sync` command.
|
444
|
+
*/
|
445
|
+
sync?: NxSyncConfiguration;
|
416
446
|
}
|
417
447
|
export type PluginConfiguration = string | ExpandedPluginConfiguration;
|
418
448
|
export type ExpandedPluginConfiguration<T = unknown> = {
|