@nx/devkit 19.3.0 → 19.4.0-beta.1
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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/devkit",
|
3
|
-
"version": "19.
|
3
|
+
"version": "19.4.0-beta.1",
|
4
4
|
"private": false,
|
5
5
|
"description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more. Learn more about [extending Nx by leveraging the Nx Devkit](https://nx.dev/extending-nx/intro/getting-started) on our docs.",
|
6
6
|
"repository": {
|
@@ -36,7 +36,7 @@
|
|
36
36
|
"semver": "^7.5.3",
|
37
37
|
"yargs-parser": "21.1.1",
|
38
38
|
"minimatch": "9.0.3",
|
39
|
-
"@nrwl/devkit": "19.
|
39
|
+
"@nrwl/devkit": "19.4.0-beta.1"
|
40
40
|
},
|
41
41
|
"peerDependencies": {
|
42
42
|
"nx": ">= 17 <= 20"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
interface AggregateLogOptions {
|
2
|
+
project: string;
|
3
|
+
log: string;
|
4
|
+
executorName: string;
|
5
|
+
}
|
6
|
+
interface AggregateLogItem {
|
7
|
+
log: string;
|
8
|
+
projects: Set<string>;
|
9
|
+
}
|
10
|
+
/**
|
11
|
+
* @example
|
12
|
+
* // Instantiate a new object
|
13
|
+
* const migrationLogs = new AggregatedLog();
|
14
|
+
*
|
15
|
+
* // Add logs
|
16
|
+
* migrationLogs.addLog({executorName: '@nx/vite:build', project: 'app1', log: 'Migrate X manually'});
|
17
|
+
*
|
18
|
+
* // Flush all logs
|
19
|
+
* migrationLogs.flushLogs()
|
20
|
+
*/
|
21
|
+
export declare class AggregatedLog {
|
22
|
+
logs: Map<string, Map<string, AggregateLogItem>>;
|
23
|
+
addLog({ project, log, executorName }: AggregateLogOptions): void;
|
24
|
+
reset(): void;
|
25
|
+
flushLogs(): void;
|
26
|
+
}
|
27
|
+
export {};
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.AggregatedLog = void 0;
|
4
|
+
const devkit_exports_1 = require("nx/src/devkit-exports");
|
5
|
+
/**
|
6
|
+
* @example
|
7
|
+
* // Instantiate a new object
|
8
|
+
* const migrationLogs = new AggregatedLog();
|
9
|
+
*
|
10
|
+
* // Add logs
|
11
|
+
* migrationLogs.addLog({executorName: '@nx/vite:build', project: 'app1', log: 'Migrate X manually'});
|
12
|
+
*
|
13
|
+
* // Flush all logs
|
14
|
+
* migrationLogs.flushLogs()
|
15
|
+
*/
|
16
|
+
class AggregatedLog {
|
17
|
+
constructor() {
|
18
|
+
this.logs = new Map();
|
19
|
+
}
|
20
|
+
addLog({ project, log, executorName }) {
|
21
|
+
if (!this.logs.has(executorName)) {
|
22
|
+
this.logs.set(executorName, new Map());
|
23
|
+
}
|
24
|
+
const executorLogs = this.logs.get(executorName);
|
25
|
+
if (!executorLogs.has(log)) {
|
26
|
+
executorLogs.set(log, { log, projects: new Set([project]) });
|
27
|
+
}
|
28
|
+
else {
|
29
|
+
const logItem = executorLogs.get(log);
|
30
|
+
logItem.projects.add(project);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
reset() {
|
34
|
+
this.logs.clear();
|
35
|
+
}
|
36
|
+
flushLogs() {
|
37
|
+
let fullLog = '';
|
38
|
+
for (const executorName of this.logs.keys()) {
|
39
|
+
fullLog = `${fullLog}${devkit_exports_1.output.bold(`Encountered the following while migrating '${executorName}':\r\n`)}`;
|
40
|
+
for (const logItem of this.logs.get(executorName).values()) {
|
41
|
+
fullLog = `${fullLog} • ${logItem.log}\r\n`;
|
42
|
+
fullLog = `${fullLog} ${devkit_exports_1.output.bold(`Affected Projects`)}\r\n`;
|
43
|
+
fullLog = `${fullLog} ${Array.from(logItem.projects.values()).join(`\r\n `)}`;
|
44
|
+
fullLog = `${fullLog}\r\n`;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
devkit_exports_1.logger.warn(fullLog);
|
48
|
+
this.reset();
|
49
|
+
}
|
50
|
+
}
|
51
|
+
exports.AggregatedLog = AggregatedLog;
|