nx 19.2.0-canary.20240604-0594deb → 19.2.0-canary.20240605-5a06daa
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/migrations.json +6 -0
- package/package.json +13 -12
- package/release/changelog-renderer/index.d.ts +6 -3
- package/release/changelog-renderer/index.js +53 -50
- package/schemas/nx-schema.json +8 -0
- package/src/command-line/add/add.d.ts +1 -1
- package/src/command-line/add/command-object.js +3 -1
- package/src/command-line/affected/command-object.js +10 -5
- package/src/command-line/deprecated/command-objects.js +12 -6
- package/src/command-line/examples.js +18 -0
- package/src/command-line/generate/generate.d.ts +1 -1
- package/src/command-line/migrate/migrate.d.ts +1 -1
- package/src/command-line/new/new.d.ts +1 -1
- package/src/command-line/release/changelog.d.ts +17 -1
- package/src/command-line/release/changelog.js +305 -76
- package/src/command-line/release/command-object.d.ts +14 -5
- package/src/command-line/release/command-object.js +52 -24
- package/src/command-line/release/config/config.js +38 -6
- package/src/command-line/release/config/filter-release-groups.d.ts +3 -1
- package/src/command-line/release/config/filter-release-groups.js +1 -0
- package/src/command-line/release/config/version-plans.d.ts +24 -0
- package/src/command-line/release/config/version-plans.js +184 -0
- package/src/command-line/release/plan.d.ts +3 -0
- package/src/command-line/release/plan.js +184 -0
- package/src/command-line/release/publish.d.ts +1 -1
- package/src/command-line/release/release.d.ts +1 -1
- package/src/command-line/release/release.js +40 -0
- package/src/command-line/release/utils/git.d.ts +10 -2
- package/src/command-line/release/utils/git.js +45 -10
- package/src/command-line/release/utils/shared.d.ts +12 -2
- package/src/command-line/release/utils/shared.js +3 -2
- package/src/command-line/release/version.d.ts +3 -2
- package/src/command-line/release/version.js +43 -5
- package/src/command-line/repair/repair.d.ts +1 -1
- package/src/command-line/reset/command-object.d.ts +6 -1
- package/src/command-line/reset/command-object.js +15 -2
- package/src/command-line/reset/reset.d.ts +2 -1
- package/src/command-line/reset/reset.js +98 -16
- package/src/command-line/run/command-object.js +6 -3
- package/src/command-line/run/run.d.ts +2 -2
- package/src/command-line/run-many/command-object.js +6 -3
- package/src/command-line/show/command-object.js +6 -6
- package/src/config/misc-interfaces.d.ts +15 -3
- package/src/config/nx-json.d.ts +11 -0
- package/src/core/graph/main.js +1 -1
- package/src/daemon/tmp-dir.js +1 -1
- package/src/devkit-exports.d.ts +1 -1
- package/src/migrations/update-19-2-0/move-workspace-data-directory.d.ts +4 -0
- package/src/migrations/update-19-2-0/move-workspace-data-directory.js +34 -0
- package/src/plugins/js/index.js +2 -2
- package/src/plugins/js/project-graph/affected/lock-file-changes.js +11 -0
- package/src/plugins/js/project-graph/affected/npm-packages.js +12 -0
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +3 -11
- package/src/plugins/js/utils/config.js +4 -0
- package/src/plugins/js/utils/register.d.ts +4 -3
- package/src/plugins/js/utils/register.js +47 -4
- package/src/project-graph/affected/affected-project-graph.js +6 -6
- package/src/project-graph/nx-deps-cache.js +6 -6
- package/src/project-graph/plugins/loader.js +1 -1
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +3 -3
- package/src/tasks-runner/task-env.js +12 -0
- package/src/utils/cache-directory.d.ts +1 -1
- package/src/utils/cache-directory.js +13 -6
- package/src/utils/get-package-name-from-import-path.d.ts +1 -0
- package/src/utils/get-package-name-from-import-path.js +18 -0
- package/src/utils/package-json.d.ts +1 -0
- package/src/utils/package-manager.js +42 -9
- package/src/utils/params.d.ts +1 -1
- package/src/utils/params.js +5 -1
@@ -6,25 +6,107 @@ const client_1 = require("../../daemon/client/client");
|
|
6
6
|
const cache_directory_1 = require("../../utils/cache-directory");
|
7
7
|
const output_1 = require("../../utils/output");
|
8
8
|
const native_file_cache_location_1 = require("../../native/native-file-cache-location");
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
// Wait at max 5 seconds before giving up on a failing operation.
|
10
|
+
const INCREMENTAL_BACKOFF_MAX_DURATION = 5000;
|
11
|
+
// If an operation fails, wait 100ms before first retry.
|
12
|
+
const INCREMENTAL_BACKOFF_FIRST_DELAY = 100;
|
13
|
+
async function resetHandler(args) {
|
14
|
+
let errors = [];
|
15
|
+
const all = args.onlyDaemon === undefined &&
|
16
|
+
args.onlyCache === undefined &&
|
17
|
+
args.onlyWorkspaceData === undefined;
|
18
|
+
const startupMessage = all
|
19
|
+
? 'Resetting the Nx cache and stopping the daemon.'
|
20
|
+
: 'Resetting:';
|
21
|
+
const bodyLines = [];
|
22
|
+
if (!all) {
|
23
|
+
if (args.onlyDaemon) {
|
24
|
+
bodyLines.push('- Nx Daemon');
|
25
|
+
}
|
26
|
+
if (args.onlyCache) {
|
27
|
+
bodyLines.push('- Cache directory');
|
28
|
+
}
|
29
|
+
if (args.onlyWorkspaceData) {
|
30
|
+
bodyLines.push('- Workspace data directory');
|
31
|
+
}
|
32
|
+
}
|
33
|
+
output_1.output.note({ title: startupMessage, bodyLines });
|
34
|
+
if (all || args.onlyDaemon) {
|
35
|
+
try {
|
36
|
+
await killDaemon();
|
37
|
+
}
|
38
|
+
catch {
|
39
|
+
errors.push('Failed to stop the Nx Daemon.');
|
40
|
+
}
|
41
|
+
}
|
42
|
+
if (all || args.onlyCache) {
|
43
|
+
try {
|
44
|
+
await cleanupCacheEntries();
|
45
|
+
}
|
46
|
+
catch {
|
47
|
+
errors.push('Failed to clean up the cache directory.');
|
48
|
+
}
|
49
|
+
}
|
50
|
+
if (all || args.onlyWorkspaceData) {
|
51
|
+
try {
|
52
|
+
await cleanupNativeFileCache();
|
53
|
+
}
|
54
|
+
catch {
|
55
|
+
errors.push('Failed to clean up the native file cache.');
|
56
|
+
}
|
57
|
+
try {
|
58
|
+
await cleanupWorkspaceData();
|
59
|
+
}
|
60
|
+
catch {
|
61
|
+
errors.push('Failed to clean up the workspace data directory.');
|
62
|
+
}
|
63
|
+
}
|
64
|
+
if (errors.length > 0) {
|
65
|
+
output_1.output.error({
|
66
|
+
title: 'Failed to reset the Nx workspace.',
|
67
|
+
bodyLines: errors,
|
68
|
+
});
|
69
|
+
process.exit(1);
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
output_1.output.success({
|
73
|
+
title: 'Successfully reset the Nx workspace.',
|
74
|
+
});
|
75
|
+
}
|
76
|
+
}
|
77
|
+
exports.resetHandler = resetHandler;
|
78
|
+
function killDaemon() {
|
79
|
+
return client_1.daemonClient.stop();
|
80
|
+
}
|
81
|
+
function cleanupCacheEntries() {
|
82
|
+
return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
|
83
|
+
(0, fs_extra_1.rmSync)(cache_directory_1.cacheDir, { recursive: true, force: true });
|
13
84
|
});
|
14
|
-
|
15
|
-
|
16
|
-
|
85
|
+
}
|
86
|
+
function cleanupNativeFileCache() {
|
87
|
+
return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
|
17
88
|
(0, fs_extra_1.rmSync)((0, native_file_cache_location_1.getNativeFileCacheLocation)(), { recursive: true, force: true });
|
89
|
+
});
|
90
|
+
}
|
91
|
+
function cleanupWorkspaceData() {
|
92
|
+
return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
|
93
|
+
(0, fs_extra_1.rmSync)(cache_directory_1.workspaceDataDirectory, { recursive: true, force: true });
|
94
|
+
});
|
95
|
+
}
|
96
|
+
async function incrementalBackoff(ms, maxDuration, callback) {
|
97
|
+
try {
|
98
|
+
callback();
|
18
99
|
}
|
19
100
|
catch (e) {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
101
|
+
if (ms < maxDuration) {
|
102
|
+
await sleep(ms);
|
103
|
+
await incrementalBackoff(ms * 2, maxDuration, callback);
|
104
|
+
}
|
105
|
+
else {
|
106
|
+
throw e;
|
107
|
+
}
|
25
108
|
}
|
26
|
-
output_1.output.success({
|
27
|
-
title: 'Successfully reset the Nx workspace.',
|
28
|
-
});
|
29
109
|
}
|
30
|
-
|
110
|
+
function sleep(ms) {
|
111
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
112
|
+
}
|
@@ -13,9 +13,12 @@ exports.yargsRunCommand = {
|
|
13
13
|
|
14
14
|
You can skip the use of Nx cache by using the --skip-nx-cache option.`,
|
15
15
|
builder: (yargs) => (0, shared_options_1.withRunOneOptions)((0, shared_options_1.withBatch)(yargs)),
|
16
|
-
handler: async (args) =>
|
17
|
-
|
18
|
-
|
16
|
+
handler: async (args) => {
|
17
|
+
const exitCode = await (0, params_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
18
|
+
await Promise.resolve().then(() => require('./run-one')).then((m) => m.runOne(process.cwd(), (0, shared_options_1.withOverrides)(args)));
|
19
|
+
});
|
20
|
+
process.exit(exitCode);
|
21
|
+
},
|
19
22
|
};
|
20
23
|
/**
|
21
24
|
* Handles the infix notation for running a target.
|
@@ -45,7 +45,7 @@ export declare function runExecutor<T extends {
|
|
45
45
|
}>(targetDescription: Target, overrides: {
|
46
46
|
[k: string]: any;
|
47
47
|
}, context: ExecutorContext): Promise<AsyncIterableIterator<T>>;
|
48
|
-
export declare function printTargetRunHelp(targetDescription: Target, root: string): Promise<
|
48
|
+
export declare function printTargetRunHelp(targetDescription: Target, root: string): Promise<number>;
|
49
49
|
export declare function run(cwd: string, root: string, targetDescription: Target, overrides: {
|
50
50
|
[k: string]: any;
|
51
|
-
}, isVerbose: boolean, taskGraph: TaskGraph): Promise<
|
51
|
+
}, isVerbose: boolean, taskGraph: TaskGraph): Promise<number>;
|
@@ -8,7 +8,10 @@ exports.yargsRunManyCommand = {
|
|
8
8
|
command: 'run-many',
|
9
9
|
describe: 'Run target for multiple listed projects',
|
10
10
|
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withRunManyOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withTargetAndConfigurationOption)((0, shared_options_1.withBatch)(yargs)))), 'run-many'),
|
11
|
-
handler: async (args) =>
|
12
|
-
|
13
|
-
|
11
|
+
handler: async (args) => {
|
12
|
+
const exitCode = await (0, params_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
13
|
+
await Promise.resolve().then(() => require('./run-many')).then((m) => m.runMany((0, shared_options_1.withOverrides)(args)));
|
14
|
+
});
|
15
|
+
process.exit(exitCode);
|
16
|
+
},
|
14
17
|
};
|
@@ -64,12 +64,12 @@ const showProjectsCommand = {
|
|
64
64
|
.example('$0 show projects --affected', 'Show affected projects in the workspace')
|
65
65
|
.example('$0 show projects --type app --affected', 'Show affected apps in the workspace')
|
66
66
|
.example('$0 show projects --affected --exclude=*-e2e', 'Show affected projects in the workspace, excluding end-to-end projects'),
|
67
|
-
handler: (args) => {
|
68
|
-
|
67
|
+
handler: async (args) => {
|
68
|
+
const exitCode = await (0, params_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
69
69
|
const { showProjectsHandler } = await Promise.resolve().then(() => require('./projects'));
|
70
70
|
await showProjectsHandler(args);
|
71
|
-
process.exit(0);
|
72
71
|
});
|
72
|
+
process.exit(exitCode);
|
73
73
|
},
|
74
74
|
};
|
75
75
|
const showProjectCommand = {
|
@@ -105,11 +105,11 @@ const showProjectCommand = {
|
|
105
105
|
})
|
106
106
|
.example('$0 show project my-app', 'View project information for my-app in JSON format')
|
107
107
|
.example('$0 show project my-app --web', 'View project information for my-app in the browser'),
|
108
|
-
handler: (args) => {
|
109
|
-
|
108
|
+
handler: async (args) => {
|
109
|
+
const exitCode = await (0, params_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
110
110
|
const { showProjectHandler } = await Promise.resolve().then(() => require('./project'));
|
111
111
|
await showProjectHandler(args);
|
112
|
-
process.exit(0);
|
113
112
|
});
|
113
|
+
process.exit(exitCode);
|
114
114
|
},
|
115
115
|
};
|
@@ -89,17 +89,29 @@ export interface ExecutorConfig {
|
|
89
89
|
batchImplementationFactory?: () => TaskGraphExecutor;
|
90
90
|
}
|
91
91
|
/**
|
92
|
-
*
|
92
|
+
* An executor implementation that returns a promise
|
93
93
|
*/
|
94
|
-
export type
|
94
|
+
export type PromiseExecutor<T = any> = (
|
95
95
|
/**
|
96
96
|
* Options that users configure or pass via the command line
|
97
97
|
*/
|
98
98
|
options: T, context: ExecutorContext) => Promise<{
|
99
99
|
success: boolean;
|
100
|
-
}
|
100
|
+
}>;
|
101
|
+
/**
|
102
|
+
* An executor implementation that returns an async iterator
|
103
|
+
*/
|
104
|
+
export type AsyncIteratorExecutor<T = any> = (
|
105
|
+
/**
|
106
|
+
* Options that users configure or pass via the command line
|
107
|
+
*/
|
108
|
+
options: T, context: ExecutorContext) => AsyncIterableIterator<{
|
101
109
|
success: boolean;
|
102
110
|
}>;
|
111
|
+
/**
|
112
|
+
* Implementation of a target of a project
|
113
|
+
*/
|
114
|
+
export type Executor<T = any> = PromiseExecutor<T> | AsyncIteratorExecutor<T>;
|
103
115
|
export interface HasherContext {
|
104
116
|
hasher: TaskHasher;
|
105
117
|
projectGraph: ProjectGraph;
|
package/src/config/nx-json.d.ts
CHANGED
@@ -22,6 +22,7 @@ export interface NrwlJsPluginConfig {
|
|
22
22
|
analyzeSourceFiles?: boolean;
|
23
23
|
analyzePackageJson?: boolean;
|
24
24
|
analyzeLockfile?: boolean;
|
25
|
+
projectsAffectedByDependencyUpdates?: 'all' | 'auto' | string[];
|
25
26
|
}
|
26
27
|
interface NxInstallationConfiguration {
|
27
28
|
/**
|
@@ -188,6 +189,11 @@ interface NxReleaseConfiguration {
|
|
188
189
|
* Optionally override the git/release tag pattern to use for this group.
|
189
190
|
*/
|
190
191
|
releaseTagPattern?: string;
|
192
|
+
/**
|
193
|
+
* Enables using version plans as a specifier source for versioning and
|
194
|
+
* to determine changes for changelog generation.
|
195
|
+
*/
|
196
|
+
versionPlans?: boolean;
|
191
197
|
}>;
|
192
198
|
/**
|
193
199
|
* Configures the default value for all groups that don't explicitly state their own projectsRelationship.
|
@@ -254,6 +260,11 @@ interface NxReleaseConfiguration {
|
|
254
260
|
*/
|
255
261
|
git?: NxReleaseGitConfiguration;
|
256
262
|
conventionalCommits?: NxReleaseConventionalCommitsConfiguration;
|
263
|
+
/**
|
264
|
+
* Enables using version plans as a specifier source for versioning and
|
265
|
+
* to determine changes for changelog generation.
|
266
|
+
*/
|
267
|
+
versionPlans?: boolean;
|
257
268
|
}
|
258
269
|
/**
|
259
270
|
* Nx.json configuration
|