nx 22.6.0-beta.10 → 22.6.0-beta.12
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.d.ts.map +1 -1
- package/bin/init-local.js +2 -0
- package/bin/nx.js +9 -0
- package/migrations.json +6 -0
- package/package.json +13 -11
- package/schemas/nx-schema.json +4 -0
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.d.ts.map +1 -1
- package/src/adapter/compat.js +1 -0
- package/src/analytics/analytics.d.ts +8 -0
- package/src/analytics/analytics.d.ts.map +1 -0
- package/src/analytics/analytics.js +200 -0
- package/src/analytics/index.d.ts +2 -0
- package/src/analytics/index.d.ts.map +1 -0
- package/src/analytics/index.js +10 -0
- package/src/command-line/add/add.d.ts.map +1 -1
- package/src/command-line/add/add.js +2 -0
- package/src/command-line/generate/generate.d.ts.map +1 -1
- package/src/command-line/generate/generate.js +2 -0
- package/src/command-line/init/implementation/dot-nx/nxw.js +8 -2
- package/src/command-line/migrate/migrate.d.ts.map +1 -1
- package/src/command-line/migrate/migrate.js +4 -14
- package/src/command-line/nx-cloud/download-cloud-client/download-cloud-client.d.ts.map +1 -1
- package/src/command-line/nx-cloud/download-cloud-client/download-cloud-client.js +12 -6
- package/src/command-line/nx-commands.d.ts.map +1 -1
- package/src/command-line/nx-commands.js +9 -0
- package/src/command-line/show/command-object.d.ts.map +1 -1
- package/src/command-line/show/command-object.js +6 -0
- package/src/config/nx-json.d.ts +4 -0
- package/src/config/nx-json.d.ts.map +1 -1
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.css +1 -1
- package/src/daemon/server/server.d.ts.map +1 -1
- package/src/daemon/server/server.js +3 -0
- package/src/daemon/server/shutdown-utils.d.ts.map +1 -1
- package/src/daemon/server/shutdown-utils.js +3 -0
- package/src/migrations/update-22-6-0/enable-analytics-prompt.d.ts +3 -0
- package/src/migrations/update-22-6-0/enable-analytics-prompt.d.ts.map +1 -0
- package/src/migrations/update-22-6-0/enable-analytics-prompt.js +23 -0
- package/src/native/native-bindings.js +5 -0
- package/src/project-graph/project-graph.d.ts.map +1 -1
- package/src/project-graph/project-graph.js +4 -0
- package/src/tasks-runner/cache.d.ts +0 -2
- package/src/tasks-runner/cache.d.ts.map +1 -1
- package/src/tasks-runner/cache.js +3 -18
- package/src/tasks-runner/life-cycle.d.ts +2 -0
- package/src/tasks-runner/life-cycle.d.ts.map +1 -1
- package/src/tasks-runner/life-cycle.js +7 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +1 -2
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts.map +1 -1
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +13 -12
- package/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +1 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts.map +1 -1
- package/src/tasks-runner/life-cycles/task-history-life-cycle.js +10 -5
- package/src/tasks-runner/task-orchestrator.d.ts +10 -3
- package/src/tasks-runner/task-orchestrator.d.ts.map +1 -1
- package/src/tasks-runner/task-orchestrator.js +109 -65
- package/src/utils/analytics-prompt.d.ts +13 -0
- package/src/utils/analytics-prompt.d.ts.map +1 -0
- package/src/utils/analytics-prompt.js +127 -0
- package/src/utils/machine-id-cache.d.ts +6 -0
- package/src/utils/machine-id-cache.d.ts.map +1 -0
- package/src/utils/machine-id-cache.js +23 -0
- package/src/utils/write-formatted-json-file.d.ts +7 -0
- package/src/utils/write-formatted-json-file.d.ts.map +1 -0
- package/src/utils/write-formatted-json-file.js +23 -0
package/bin/init-local.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-local.d.ts","sourceRoot":"","sources":["../../../../packages/nx/bin/init-local.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"init-local.d.ts","sourceRoot":"","sources":["../../../../packages/nx/bin/init-local.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAOxE;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,SAAS,EAAE,oBAAoB,iBA+C9D;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,YA6BvD"}
|
package/bin/init-local.js
CHANGED
|
@@ -8,6 +8,7 @@ const strip_indents_1 = require("../src/utils/strip-indents");
|
|
|
8
8
|
const client_1 = require("../src/daemon/client/client");
|
|
9
9
|
const enquirer_1 = require("enquirer");
|
|
10
10
|
const output_1 = require("../src/utils/output");
|
|
11
|
+
const analytics_1 = require("../src/analytics");
|
|
11
12
|
/**
|
|
12
13
|
* Nx is being run inside a workspace.
|
|
13
14
|
*
|
|
@@ -56,6 +57,7 @@ async function initLocal(workspace) {
|
|
|
56
57
|
}
|
|
57
58
|
catch (e) {
|
|
58
59
|
console.error(e.message);
|
|
60
|
+
(0, analytics_1.flushAnalytics)();
|
|
59
61
|
process.exit(1);
|
|
60
62
|
}
|
|
61
63
|
}
|
package/bin/nx.js
CHANGED
|
@@ -23,6 +23,8 @@ const perf_hooks_1 = require("perf_hooks");
|
|
|
23
23
|
const workspace_context_1 = require("../src/utils/workspace-context");
|
|
24
24
|
const client_1 = require("../src/daemon/client/client");
|
|
25
25
|
const db_connection_1 = require("../src/utils/db-connection");
|
|
26
|
+
const analytics_prompt_1 = require("../src/utils/analytics-prompt");
|
|
27
|
+
const analytics_1 = require("../src/analytics");
|
|
26
28
|
async function main() {
|
|
27
29
|
if (process.argv[2] !== 'report' &&
|
|
28
30
|
process.argv[2] !== '--version' &&
|
|
@@ -74,6 +76,12 @@ async function main() {
|
|
|
74
76
|
if (!localNx && !isNxCloudCommand(process.argv[2])) {
|
|
75
77
|
handleMissingLocalInstallation(workspace ? workspace.dir : null);
|
|
76
78
|
}
|
|
79
|
+
// Prompt for analytics preference if not set
|
|
80
|
+
try {
|
|
81
|
+
await (0, analytics_prompt_1.ensureAnalyticsPreferenceSet)();
|
|
82
|
+
}
|
|
83
|
+
catch { }
|
|
84
|
+
await (0, analytics_1.startAnalytics)();
|
|
77
85
|
// this file is already in the local workspace
|
|
78
86
|
if (isNxCloudCommand(process.argv[2])) {
|
|
79
87
|
// nx-cloud commands can run without local Nx installation
|
|
@@ -249,5 +257,6 @@ process.on('exit', () => {
|
|
|
249
257
|
});
|
|
250
258
|
main().catch((error) => {
|
|
251
259
|
console.error(error);
|
|
260
|
+
(0, analytics_1.flushAnalytics)();
|
|
252
261
|
process.exit(1);
|
|
253
262
|
});
|
package/migrations.json
CHANGED
|
@@ -148,6 +148,12 @@
|
|
|
148
148
|
"version": "22.7.0-beta.0",
|
|
149
149
|
"description": "Adds .nx/polygraph to .gitignore",
|
|
150
150
|
"implementation": "./src/migrations/update-22-7-0/add-polygraph-to-git-ignore"
|
|
151
|
+
},
|
|
152
|
+
"22-6-0-enable-analytics-prompt": {
|
|
153
|
+
"cli": "nx",
|
|
154
|
+
"version": "22.6.0-beta.11",
|
|
155
|
+
"description": "Prompts to enable usage analytics",
|
|
156
|
+
"implementation": "./src/migrations/update-22-6-0/enable-analytics-prompt"
|
|
151
157
|
}
|
|
152
158
|
}
|
|
153
159
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "22.6.0-beta.
|
|
3
|
+
"version": "22.6.0-beta.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
|
6
6
|
"repository": {
|
|
@@ -85,16 +85,16 @@
|
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
"optionalDependencies": {
|
|
88
|
-
"@nx/nx-darwin-arm64": "22.6.0-beta.
|
|
89
|
-
"@nx/nx-darwin-x64": "22.6.0-beta.
|
|
90
|
-
"@nx/nx-freebsd-x64": "22.6.0-beta.
|
|
91
|
-
"@nx/nx-linux-arm-gnueabihf": "22.6.0-beta.
|
|
92
|
-
"@nx/nx-linux-arm64-gnu": "22.6.0-beta.
|
|
93
|
-
"@nx/nx-linux-arm64-musl": "22.6.0-beta.
|
|
94
|
-
"@nx/nx-linux-x64-gnu": "22.6.0-beta.
|
|
95
|
-
"@nx/nx-linux-x64-musl": "22.6.0-beta.
|
|
96
|
-
"@nx/nx-win32-arm64-msvc": "22.6.0-beta.
|
|
97
|
-
"@nx/nx-win32-x64-msvc": "22.6.0-beta.
|
|
88
|
+
"@nx/nx-darwin-arm64": "22.6.0-beta.12",
|
|
89
|
+
"@nx/nx-darwin-x64": "22.6.0-beta.12",
|
|
90
|
+
"@nx/nx-freebsd-x64": "22.6.0-beta.12",
|
|
91
|
+
"@nx/nx-linux-arm-gnueabihf": "22.6.0-beta.12",
|
|
92
|
+
"@nx/nx-linux-arm64-gnu": "22.6.0-beta.12",
|
|
93
|
+
"@nx/nx-linux-arm64-musl": "22.6.0-beta.12",
|
|
94
|
+
"@nx/nx-linux-x64-gnu": "22.6.0-beta.12",
|
|
95
|
+
"@nx/nx-linux-x64-musl": "22.6.0-beta.12",
|
|
96
|
+
"@nx/nx-win32-arm64-msvc": "22.6.0-beta.12",
|
|
97
|
+
"@nx/nx-win32-x64-msvc": "22.6.0-beta.12"
|
|
98
98
|
},
|
|
99
99
|
"nx-migrations": {
|
|
100
100
|
"migrations": "./migrations.json",
|
|
@@ -104,6 +104,8 @@
|
|
|
104
104
|
"@nx/eslint",
|
|
105
105
|
"@nx/workspace",
|
|
106
106
|
"@nx/angular",
|
|
107
|
+
"@nx/angular-rspack",
|
|
108
|
+
"@nx/angular-rspack-compiler",
|
|
107
109
|
"@nx/jest",
|
|
108
110
|
"@nx/cypress",
|
|
109
111
|
"@nx/detox",
|
package/schemas/nx-schema.json
CHANGED
|
@@ -142,6 +142,10 @@
|
|
|
142
142
|
"type": "boolean",
|
|
143
143
|
"description": "Specifies whether to add inference plugins when generating new projects."
|
|
144
144
|
},
|
|
145
|
+
"analytics": {
|
|
146
|
+
"type": "boolean",
|
|
147
|
+
"description": "Set this to true to allow Nx to collect usage analytics."
|
|
148
|
+
},
|
|
145
149
|
"release": {
|
|
146
150
|
"type": "object",
|
|
147
151
|
"description": "Configuration for the nx release commands.",
|
package/src/adapter/compat.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const allowedProjectExtensions: readonly ["tags", "implicitDependencies", "configFilePath", "$schema", "generators", "namedInputs", "name", "files", "root", "sourceRoot", "projectType", "release", "includedScripts", "metadata", "owners", "nxCloudImplicitDependencies"];
|
|
2
|
-
export declare const allowedWorkspaceExtensions: readonly ["$schema", "implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudId", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins", "neverConnectToCloud", "sync", "useLegacyCache", "maxCacheSize", "tui", "owners"];
|
|
2
|
+
export declare const allowedWorkspaceExtensions: readonly ["$schema", "implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudId", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins", "neverConnectToCloud", "analytics", "sync", "useLegacyCache", "maxCacheSize", "tui", "owners"];
|
|
3
3
|
//# sourceMappingURL=compat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/adapter/compat.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,wBAAwB,8OAiB3B,CAAC;AAQX,eAAO,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/adapter/compat.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,wBAAwB,8OAiB3B,CAAC;AAQX,eAAO,MAAM,0BAA0B,sfAiC7B,CAAC"}
|
package/src/adapter/compat.js
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function startAnalytics(): Promise<void>;
|
|
2
|
+
export declare function reportNxAddCommand(packageName: string, version: string): void;
|
|
3
|
+
export declare function reportNxGenerateCommand(generator: string): void;
|
|
4
|
+
export declare function reportCommandRunEvent(command: string, parameters?: Record<string, any>, args?: Record<string, any>): void;
|
|
5
|
+
export declare function reportProjectGraphCreationEvent(duration: number): void;
|
|
6
|
+
export declare function argsToQueryString(args: Record<string, any>): string;
|
|
7
|
+
export declare function flushAnalytics(): void;
|
|
8
|
+
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/analytics/analytics.ts"],"names":[],"mappings":"AA2CA,wBAAsB,cAAc,kBAuDnC;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,QAKtE;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,QAIxD;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAChC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAW3B;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,MAAM,QAI/D;AAsBD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAcnE;AAmDD,wBAAgB,cAAc,SAW7B"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startAnalytics = startAnalytics;
|
|
4
|
+
exports.reportNxAddCommand = reportNxAddCommand;
|
|
5
|
+
exports.reportNxGenerateCommand = reportNxGenerateCommand;
|
|
6
|
+
exports.reportCommandRunEvent = reportCommandRunEvent;
|
|
7
|
+
exports.reportProjectGraphCreationEvent = reportProjectGraphCreationEvent;
|
|
8
|
+
exports.argsToQueryString = argsToQueryString;
|
|
9
|
+
exports.flushAnalytics = flushAnalytics;
|
|
10
|
+
const nx_json_1 = require("../config/nx-json");
|
|
11
|
+
const workspace_root_1 = require("../utils/workspace-root");
|
|
12
|
+
const versions_1 = require("../utils/versions");
|
|
13
|
+
const native_1 = require("../native");
|
|
14
|
+
const package_manager_1 = require("../utils/package-manager");
|
|
15
|
+
const semver_1 = require("semver");
|
|
16
|
+
const os = require("os");
|
|
17
|
+
const machine_id_cache_1 = require("../utils/machine-id-cache");
|
|
18
|
+
const is_ci_1 = require("../utils/is-ci");
|
|
19
|
+
const analytics_prompt_1 = require("../utils/analytics-prompt");
|
|
20
|
+
const db_connection_1 = require("../utils/db-connection");
|
|
21
|
+
// Conditionally import telemetry functions only on non-WASM platforms
|
|
22
|
+
let initializeTelemetry;
|
|
23
|
+
let flushTelemetry;
|
|
24
|
+
let trackEventNative;
|
|
25
|
+
let trackPageViewNative;
|
|
26
|
+
let getEventDimensions;
|
|
27
|
+
if (!native_1.IS_WASM) {
|
|
28
|
+
const nativeModule = require('../native');
|
|
29
|
+
initializeTelemetry = nativeModule.initializeTelemetry;
|
|
30
|
+
flushTelemetry = nativeModule.flushTelemetry;
|
|
31
|
+
trackEventNative = nativeModule.trackEvent;
|
|
32
|
+
trackPageViewNative = nativeModule.trackPageView;
|
|
33
|
+
getEventDimensions = nativeModule.getEventDimensions;
|
|
34
|
+
}
|
|
35
|
+
const customDimensions = native_1.IS_WASM ? null : (getEventDimensions?.() ?? null);
|
|
36
|
+
let _telemetryInitialized = false;
|
|
37
|
+
async function startAnalytics() {
|
|
38
|
+
// Analytics not supported on WASM
|
|
39
|
+
if (native_1.IS_WASM) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (!isAnalyticsEnabled()) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const nxJson = (0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot);
|
|
46
|
+
const workspaceId = (0, analytics_prompt_1.generateWorkspaceId)();
|
|
47
|
+
if (!workspaceId) {
|
|
48
|
+
// Not a git repo — no telemetry
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const isNxCloud = !!(nxJson?.nxCloudId ?? nxJson?.nxCloudAccessToken);
|
|
52
|
+
const userId = await (0, machine_id_cache_1.getCurrentMachineId)();
|
|
53
|
+
const packageManagerInfo = getPackageManagerInfo();
|
|
54
|
+
const nodeVersion = (0, semver_1.parse)(process.version);
|
|
55
|
+
const nodeVersionString = nodeVersion
|
|
56
|
+
? `${nodeVersion.major}.${nodeVersion.minor}.${nodeVersion.patch}`
|
|
57
|
+
: 'unknown';
|
|
58
|
+
try {
|
|
59
|
+
const dbConnection = (0, db_connection_1.getDbConnection)();
|
|
60
|
+
initializeTelemetry(dbConnection, workspaceId, userId, versions_1.nxVersion, packageManagerInfo.name, packageManagerInfo.version, nodeVersionString, os.arch(), os.platform(), os.release(), !!(0, is_ci_1.isCI)(), isNxCloud);
|
|
61
|
+
_telemetryInitialized = true;
|
|
62
|
+
// Flush analytics automatically on process exit so every code path
|
|
63
|
+
// is covered without needing explicit exitAndFlushAnalytics() calls.
|
|
64
|
+
process.on('exit', () => {
|
|
65
|
+
flushAnalytics();
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
// If telemetry service fails to initialize, continue without it
|
|
70
|
+
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
|
71
|
+
console.log(`Failed to initialize telemetry: ${error.message}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function reportNxAddCommand(packageName, version) {
|
|
76
|
+
reportCommandRunEvent('add', {
|
|
77
|
+
[customDimensions.packageName]: packageName,
|
|
78
|
+
[customDimensions.packageVersion]: version,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function reportNxGenerateCommand(generator) {
|
|
82
|
+
reportCommandRunEvent('generate', {
|
|
83
|
+
[customDimensions.generatorName]: generator,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function reportCommandRunEvent(command, parameters, args) {
|
|
87
|
+
command = command === 'g' ? 'generate' : command;
|
|
88
|
+
let pageLocation = command;
|
|
89
|
+
if (args) {
|
|
90
|
+
const qs = argsToQueryString(args);
|
|
91
|
+
if (qs) {
|
|
92
|
+
pageLocation = `${command}?${qs}`;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
trackPageView(command, pageLocation, parameters);
|
|
96
|
+
}
|
|
97
|
+
function reportProjectGraphCreationEvent(duration) {
|
|
98
|
+
trackEvent(customDimensions.createProjectGraph, {
|
|
99
|
+
[customDimensions.duration]: duration,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
const SKIP_ARGS_KEYS = new Set([
|
|
103
|
+
'$0',
|
|
104
|
+
'_',
|
|
105
|
+
'__overrides_unparsed__',
|
|
106
|
+
'__overrides__',
|
|
107
|
+
]);
|
|
108
|
+
// String args with fixed enum values that are safe to include in analytics.
|
|
109
|
+
// All boolean and number args are included automatically.
|
|
110
|
+
const ALLOWED_STRING_ARGS = new Set([
|
|
111
|
+
'outputStyle',
|
|
112
|
+
'type',
|
|
113
|
+
'view',
|
|
114
|
+
'access',
|
|
115
|
+
'preset',
|
|
116
|
+
'interactive',
|
|
117
|
+
'printConfig',
|
|
118
|
+
'resolveVersionPlans',
|
|
119
|
+
]);
|
|
120
|
+
function argsToQueryString(args) {
|
|
121
|
+
const params = new URLSearchParams();
|
|
122
|
+
for (const [key, value] of Object.entries(args)) {
|
|
123
|
+
if (SKIP_ARGS_KEYS.has(key))
|
|
124
|
+
continue;
|
|
125
|
+
if (value === undefined || value === null)
|
|
126
|
+
continue;
|
|
127
|
+
if (typeof value === 'boolean' || typeof value === 'number') {
|
|
128
|
+
params.append(key, String(value));
|
|
129
|
+
}
|
|
130
|
+
else if (typeof value === 'string' && ALLOWED_STRING_ARGS.has(key)) {
|
|
131
|
+
params.append(key, value);
|
|
132
|
+
}
|
|
133
|
+
// All other types (strings, arrays, objects) are dropped
|
|
134
|
+
}
|
|
135
|
+
return params.toString();
|
|
136
|
+
}
|
|
137
|
+
function trackEvent(eventName, parameters) {
|
|
138
|
+
if (_telemetryInitialized) {
|
|
139
|
+
// Convert parameters to string map for Rust
|
|
140
|
+
const stringParams = {};
|
|
141
|
+
if (parameters) {
|
|
142
|
+
for (const [key, value] of Object.entries(parameters)) {
|
|
143
|
+
if (value !== undefined && value !== null) {
|
|
144
|
+
stringParams[key] = String(value);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// Fire and forget - synchronous call
|
|
149
|
+
try {
|
|
150
|
+
trackEventNative(eventName, stringParams);
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
// Silently ignore errors
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function trackPageView(pageTitle, pageLocation, parameters) {
|
|
158
|
+
if (_telemetryInitialized) {
|
|
159
|
+
// Convert parameters to string map for Rust
|
|
160
|
+
const stringParams = {};
|
|
161
|
+
if (parameters) {
|
|
162
|
+
for (const [key, value] of Object.entries(parameters)) {
|
|
163
|
+
if (value !== undefined && value !== null) {
|
|
164
|
+
stringParams[key] = String(value);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// Fire and forget - synchronous call
|
|
169
|
+
try {
|
|
170
|
+
trackPageViewNative(pageTitle, pageLocation, stringParams);
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
// Silently ignore errors
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function flushAnalytics() {
|
|
178
|
+
if (_telemetryInitialized) {
|
|
179
|
+
try {
|
|
180
|
+
flushTelemetry();
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
// Failure to report analytics shouldn't crash the CLI
|
|
184
|
+
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
|
185
|
+
console.log(`Failed to flush telemetry: ${error.message}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function getPackageManagerInfo() {
|
|
191
|
+
const pm = (0, package_manager_1.detectPackageManager)();
|
|
192
|
+
return {
|
|
193
|
+
name: pm,
|
|
194
|
+
version: (0, package_manager_1.getPackageManagerVersion)(pm),
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function isAnalyticsEnabled() {
|
|
198
|
+
const nxJson = (0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot);
|
|
199
|
+
return nxJson?.analytics === true;
|
|
200
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/analytics/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,+BAA+B,EAC/B,cAAc,GACf,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.flushAnalytics = exports.reportProjectGraphCreationEvent = exports.reportCommandRunEvent = exports.reportNxGenerateCommand = exports.reportNxAddCommand = exports.startAnalytics = void 0;
|
|
4
|
+
var analytics_1 = require("./analytics");
|
|
5
|
+
Object.defineProperty(exports, "startAnalytics", { enumerable: true, get: function () { return analytics_1.startAnalytics; } });
|
|
6
|
+
Object.defineProperty(exports, "reportNxAddCommand", { enumerable: true, get: function () { return analytics_1.reportNxAddCommand; } });
|
|
7
|
+
Object.defineProperty(exports, "reportNxGenerateCommand", { enumerable: true, get: function () { return analytics_1.reportNxGenerateCommand; } });
|
|
8
|
+
Object.defineProperty(exports, "reportCommandRunEvent", { enumerable: true, get: function () { return analytics_1.reportCommandRunEvent; } });
|
|
9
|
+
Object.defineProperty(exports, "reportProjectGraphCreationEvent", { enumerable: true, get: function () { return analytics_1.reportProjectGraphCreationEvent; } });
|
|
10
|
+
Object.defineProperty(exports, "flushAnalytics", { enumerable: true, get: function () { return analytics_1.flushAnalytics; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/add/add.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/add/add.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAUnD,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAe/D;AAgID,eAAO,MAAM,oBAAoB,qBAUhC,CAAC"}
|
|
@@ -17,10 +17,12 @@ const add_nx_scripts_1 = require("../init/implementation/dot-nx/add-nx-scripts")
|
|
|
17
17
|
const semver_1 = require("semver");
|
|
18
18
|
const configure_plugins_1 = require("../init/configure-plugins");
|
|
19
19
|
const spinner_1 = require("../../utils/spinner");
|
|
20
|
+
const analytics_1 = require("../../analytics");
|
|
20
21
|
function addHandler(options) {
|
|
21
22
|
return (0, handle_errors_1.handleErrors)(options.verbose, async () => {
|
|
22
23
|
output_1.output.addNewline();
|
|
23
24
|
const [pkgName, version] = parsePackageSpecifier(options.packageSpecifier);
|
|
25
|
+
(0, analytics_1.reportNxAddCommand)(pkgName, version);
|
|
24
26
|
const nxJson = (0, nx_json_1.readNxJson)();
|
|
25
27
|
await installPackage(pkgName, version, nxJson);
|
|
26
28
|
await initializePlugin(pkgName, options, nxJson);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/generate/generate.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAwB,MAAM,uBAAuB,CAAC;AAMzE,OAAO,EAEL,OAAO,EACP,MAAM,EACP,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/generate/generate.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAwB,MAAM,uBAAuB,CAAC;AAMzE,OAAO,EAEL,OAAO,EACP,MAAM,EACP,MAAM,oBAAoB,CAAC;AAW5B,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,YAAY,CAAC,WAAW,EAAE,UAAU,EAAE,QAUrD;AAwJD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAaA;AAmED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,eAAe,EACrB,MAAM,EAAE,MAAM,EACd,uBAAuB,EAAE,MAAM,EAC/B,OAAO,EAAE,MAAM,EAAE,QAelB;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,mBA0HxD"}
|
|
@@ -20,6 +20,7 @@ const calculate_default_project_name_1 = require("../../config/calculate-default
|
|
|
20
20
|
const installed_plugins_1 = require("../../utils/plugins/installed-plugins");
|
|
21
21
|
const generator_utils_1 = require("./generator-utils");
|
|
22
22
|
const path_2 = require("../../utils/path");
|
|
23
|
+
const analytics_1 = require("../../analytics");
|
|
23
24
|
function printChanges(fileChanges) {
|
|
24
25
|
fileChanges.forEach((f) => {
|
|
25
26
|
if (f.type === 'CREATE') {
|
|
@@ -229,6 +230,7 @@ async function generate(args) {
|
|
|
229
230
|
}
|
|
230
231
|
const cwd = (0, path_2.getCwd)();
|
|
231
232
|
const combinedOpts = await (0, params_1.combineOptionsForGenerator)(opts.generatorOptions, opts.collectionName, normalizedGeneratorName, projectsConfigurations, nxJsonConfiguration, schema, opts.interactive, (0, calculate_default_project_name_1.calculateDefaultProjectName)(cwd, workspace_root_1.workspaceRoot, projectsConfigurations, nxJsonConfiguration), (0, path_1.relative)(workspace_root_1.workspaceRoot, cwd), args.verbose);
|
|
233
|
+
(0, analytics_1.reportNxGenerateCommand)(`${opts.collectionName}:${normalizedGeneratorName}`);
|
|
232
234
|
if ((0, generator_utils_1.getGeneratorInformation)(opts.collectionName, normalizedGeneratorName, workspace_root_1.workspaceRoot, projectsConfigurations.projects).isNxGenerator) {
|
|
233
235
|
const host = new tree_1.FsTree(workspace_root_1.workspaceRoot, args.verbose, `generating (${opts.collectionName}:${normalizedGeneratorName})`);
|
|
234
236
|
const implementation = implementationFactory();
|
|
@@ -83,8 +83,14 @@ function ensureUpToDateInstallation() {
|
|
|
83
83
|
process.exit(1);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
catch {
|
|
87
|
-
|
|
86
|
+
catch (e) {
|
|
87
|
+
if (e instanceof Error &&
|
|
88
|
+
e.code === 'MODULE_NOT_FOUND') {
|
|
89
|
+
console.error('[NX]: The "nx.json" file is required when running the nx wrapper. See https://nx.dev/recipes/installation/install-non-javascript');
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
console.error(`[NX]: Failed to parse "nx.json": ${e instanceof Error ? e.message : e}. See https://nx.dev/recipes/installation/install-non-javascript`);
|
|
93
|
+
}
|
|
88
94
|
process.exit(1);
|
|
89
95
|
}
|
|
90
96
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/migrate/migrate.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,cAAc,EAEd,2BAA2B,IAAI,aAAa,EAE7C,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACL,UAAU,EAIX,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/migrate/migrate.ts"],"names":[],"mappings":"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"}
|
|
@@ -19,6 +19,7 @@ const node_url_1 = require("node:url");
|
|
|
19
19
|
const util_1 = require("util");
|
|
20
20
|
const tree_1 = require("../../generators/tree");
|
|
21
21
|
const fileutils_1 = require("../../utils/fileutils");
|
|
22
|
+
const write_formatted_json_file_1 = require("../../utils/write-formatted-json-file");
|
|
22
23
|
const logger_1 = require("../../utils/logger");
|
|
23
24
|
const git_utils_1 = require("../../utils/git-utils");
|
|
24
25
|
const package_json_1 = require("../../utils/package-json");
|
|
@@ -728,7 +729,7 @@ function readPackageMigrationConfig(packageName, dir) {
|
|
|
728
729
|
}
|
|
729
730
|
}
|
|
730
731
|
async function createMigrationsFile(root, migrations) {
|
|
731
|
-
await writeFormattedJsonFile((0, path_1.join)(root, 'migrations.json'), { migrations });
|
|
732
|
+
await (0, write_formatted_json_file_1.writeFormattedJsonFile)((0, path_1.join)(root, 'migrations.json'), { migrations });
|
|
732
733
|
}
|
|
733
734
|
async function updatePackageJson(root, updatedPackages) {
|
|
734
735
|
const packageJsonPath = (0, path_1.join)(root, 'package.json');
|
|
@@ -766,7 +767,7 @@ async function updatePackageJson(root, updatedPackages) {
|
|
|
766
767
|
json[dependencyType][p] = updatedPackages[p].version;
|
|
767
768
|
}
|
|
768
769
|
});
|
|
769
|
-
await writeFormattedJsonFile(packageJsonPath, json, {
|
|
770
|
+
await (0, write_formatted_json_file_1.writeFormattedJsonFile)(packageJsonPath, json, {
|
|
770
771
|
appendNewLine: parseOptions.endsWithNewline,
|
|
771
772
|
});
|
|
772
773
|
// Update catalog definitions
|
|
@@ -812,7 +813,7 @@ async function updateInstallationDetails(root, updatedPackages) {
|
|
|
812
813
|
}
|
|
813
814
|
}
|
|
814
815
|
}
|
|
815
|
-
await writeFormattedJsonFile(nxJsonPath, nxJson, {
|
|
816
|
+
await (0, write_formatted_json_file_1.writeFormattedJsonFile)(nxJsonPath, nxJson, {
|
|
816
817
|
appendNewLine: parseOptions.endsWithNewline,
|
|
817
818
|
});
|
|
818
819
|
}
|
|
@@ -931,17 +932,6 @@ async function generateMigrationsJsonAndUpdatePackageJson(root, opts) {
|
|
|
931
932
|
throw e;
|
|
932
933
|
}
|
|
933
934
|
}
|
|
934
|
-
async function writeFormattedJsonFile(filePath, content, options) {
|
|
935
|
-
const formattedContent = await (0, format_changed_files_with_prettier_if_available_1.formatFilesWithPrettierIfAvailable)([{ path: filePath, content: JSON.stringify(content) }], workspace_root_1.workspaceRoot, { silent: true });
|
|
936
|
-
if (formattedContent.has(filePath)) {
|
|
937
|
-
(0, fs_1.writeFileSync)(filePath, formattedContent.get(filePath), {
|
|
938
|
-
encoding: 'utf-8',
|
|
939
|
-
});
|
|
940
|
-
}
|
|
941
|
-
else {
|
|
942
|
-
(0, fileutils_1.writeJsonFile)(filePath, content, options);
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
935
|
function addSplitConfigurationMigrationIfAvailable(from, packageJson) {
|
|
946
936
|
if (!packageJson['@nrwl/workspace'])
|
|
947
937
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download-cloud-client.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/command-line/nx-cloud/download-cloud-client/download-cloud-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"download-cloud-client.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/command-line/nx-cloud/download-cloud-client/download-cloud-client.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAuBjB"}
|
|
@@ -7,14 +7,20 @@ const get_cloud_options_1 = require("../../../nx-cloud/utilities/get-cloud-optio
|
|
|
7
7
|
const nx_cloud_utils_1 = require("../../../utils/nx-cloud-utils");
|
|
8
8
|
const handle_errors_1 = require("../../../utils/handle-errors");
|
|
9
9
|
const output_1 = require("../../../utils/output");
|
|
10
|
-
const utils_1 = require("../utils");
|
|
11
10
|
function downloadCloudClientHandler(args) {
|
|
12
|
-
if (!(0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)())) {
|
|
13
|
-
(0, utils_1.warnNotConnectedToCloud)();
|
|
14
|
-
return Promise.resolve(1);
|
|
15
|
-
}
|
|
16
11
|
return (0, handle_errors_1.handleErrors)(args.verbose, async () => {
|
|
17
|
-
|
|
12
|
+
// Try to get cloud options from nx.json if available, otherwise
|
|
13
|
+
// fall back to defaults (env vars / https://cloud.nx.app).
|
|
14
|
+
let options = {};
|
|
15
|
+
try {
|
|
16
|
+
const nxJson = (0, nx_json_1.readNxJson)();
|
|
17
|
+
if ((0, nx_cloud_utils_1.isNxCloudUsed)(nxJson)) {
|
|
18
|
+
options = (0, get_cloud_options_1.getCloudOptions)();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// Not in an Nx workspace — use defaults
|
|
23
|
+
}
|
|
18
24
|
const result = await (0, update_manager_1.verifyOrUpdateNxCloudClient)(options);
|
|
19
25
|
if (result) {
|
|
20
26
|
output_1.output.success({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-commands.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/command-line/nx-commands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"nx-commands.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/command-line/nx-commands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA8D/B,eAAO,MAAM,mBAAmB,EAAE,OAAO,CAAC,KAAK,CAAC,0BAA0B,CAEzE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,qBAkEf,CAAC"}
|
|
@@ -40,6 +40,7 @@ const command_objects_1 = require("./deprecated/command-objects");
|
|
|
40
40
|
const command_object_34 = require("./sync/command-object");
|
|
41
41
|
const output_1 = require("../utils/output");
|
|
42
42
|
const command_object_35 = require("./mcp/command-object");
|
|
43
|
+
const analytics_1 = require("../analytics");
|
|
43
44
|
// Ensure that the output takes up the available width of the terminal.
|
|
44
45
|
yargs.wrap(yargs.terminalWidth());
|
|
45
46
|
exports.parserConfiguration = {
|
|
@@ -105,6 +106,14 @@ exports.commandsObject = yargs
|
|
|
105
106
|
.command(resolveConformanceCommandObject())
|
|
106
107
|
.command(resolveConformanceCheckCommandObject())
|
|
107
108
|
.scriptName('nx')
|
|
109
|
+
.middleware((args) => {
|
|
110
|
+
const context = exports.commandsObject.getInternalMethods().getContext();
|
|
111
|
+
const command = (context.commands ?? []).join(' ') ||
|
|
112
|
+
(args._ ?? []).slice(0, 1).join(' ');
|
|
113
|
+
if (command) {
|
|
114
|
+
(0, analytics_1.reportCommandRunEvent)(command, undefined, args);
|
|
115
|
+
}
|
|
116
|
+
})
|
|
108
117
|
.help(false)
|
|
109
118
|
// NOTE: we handle --version in nx.ts, this just tells yargs that the option exists
|
|
110
119
|
// so that it shows up in help. The default yargs implementation of --version is not
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-object.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/show/command-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAY,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"command-object.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/show/command-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAY,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAS1E,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG;IAC7C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,qBAAqB,GAAG;IAC7D,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAC1C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,UAAU,CA+CX,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.yargsShowCommand = void 0;
|
|
4
4
|
const yargs_1 = require("yargs");
|
|
5
|
+
const native_1 = require("../../native");
|
|
5
6
|
const handle_errors_1 = require("../../utils/handle-errors");
|
|
6
7
|
const shared_options_1 = require("../yargs-utils/shared-options");
|
|
7
8
|
exports.yargsShowCommand = {
|
|
@@ -15,6 +16,11 @@ exports.yargsShowCommand = {
|
|
|
15
16
|
.option('json', {
|
|
16
17
|
type: 'boolean',
|
|
17
18
|
description: 'Output JSON.',
|
|
19
|
+
})
|
|
20
|
+
.middleware((args) => {
|
|
21
|
+
if (args.json == null && (0, native_1.isAiAgent)()) {
|
|
22
|
+
args.json = true;
|
|
23
|
+
}
|
|
18
24
|
})
|
|
19
25
|
.example('$0 show projects', 'Show a list of all projects in the workspace')
|
|
20
26
|
.example('$0 show projects --with-target serve', 'Show a list of all projects in the workspace that have a "serve" target')
|
package/src/config/nx-json.d.ts
CHANGED
|
@@ -802,6 +802,10 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
|
|
|
802
802
|
* Set this to true to disable connection to Nx Cloud
|
|
803
803
|
*/
|
|
804
804
|
neverConnectToCloud?: boolean;
|
|
805
|
+
/**
|
|
806
|
+
* Set this to true to allow Nx to collect usage analytics.
|
|
807
|
+
*/
|
|
808
|
+
analytics?: boolean;
|
|
805
809
|
/**
|
|
806
810
|
* Configuration for the `nx sync` command.
|
|
807
811
|
*/
|