nx 22.2.0-canary.20251121-9a6c7ad → 22.2.0-canary.20251124-70bbbe9
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 -40
- package/executors.json +16 -16
- package/generators.json +13 -13
- package/migrations.json +143 -143
- package/package.json +14 -11
- package/presets/npm.json +4 -4
- package/schemas/nx-schema.json +1285 -1285
- package/schemas/project-schema.json +359 -359
- package/schemas/workspace-schema.json +165 -165
- package/src/ai/set-up-ai-agents/schema.json +31 -31
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts +1 -1
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts.map +1 -1
- package/src/command-line/release/utils/resolve-semver-specifier.js +3 -3
- package/src/command-line/release/utils/shared.d.ts +2 -1
- package/src/command-line/release/utils/shared.d.ts.map +1 -1
- package/src/command-line/release/utils/shared.js +27 -1
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.js +1 -1
- package/src/daemon/client/client.d.ts +0 -3
- package/src/daemon/client/client.d.ts.map +1 -1
- package/src/daemon/client/client.js +0 -14
- package/src/daemon/server/server.d.ts.map +1 -1
- package/src/daemon/server/server.js +0 -12
- package/src/daemon/server/shutdown-utils.d.ts.map +1 -1
- package/src/daemon/server/shutdown-utils.js +0 -3
- package/src/devkit-internals.d.ts +1 -1
- package/src/devkit-internals.d.ts.map +1 -1
- package/src/devkit-internals.js +1 -2
- package/src/executors/noop/schema.json +8 -8
- package/src/executors/run-commands/schema.json +187 -187
- package/src/executors/run-script/schema.json +25 -25
- package/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +38 -38
- package/src/utils/package-json.d.ts +0 -4
- package/src/utils/package-json.d.ts.map +1 -1
- package/src/utils/package-json.js +11 -45
- package/src/daemon/message-types/nx-console.d.ts +0 -18
- package/src/daemon/message-types/nx-console.d.ts.map +0 -1
- package/src/daemon/message-types/nx-console.js +0 -19
- package/src/daemon/server/handle-nx-console.d.ts +0 -4
- package/src/daemon/server/handle-nx-console.d.ts.map +0 -1
- package/src/daemon/server/handle-nx-console.js +0 -54
- package/src/daemon/server/nx-console-operations.d.ts +0 -31
- package/src/daemon/server/nx-console-operations.d.ts.map +0 -1
- package/src/daemon/server/nx-console-operations.js +0 -135
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/package-json.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/package-json.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACpB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAM/C,OAAO,EAML,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,WAAW,iCACf,SAAQ,OAAO,CAAC,oBAAoB,CAAC;IACrC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,MAAM,iBAAiB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC;AACvE,MAAM,MAAM,iBAAiB,GACzB,CAAC,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,GACjD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC3B,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAEjE,MAAM,MAAM,4BAA4B,GACpC,cAAc,GACd,iBAAiB,GACjB,kBAAkB,GAClB,sBAAsB,CAAC;AAE3B,MAAM,WAAW,yBAAyB;IACxC,UAAU,CAAC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AAC,EAAE,MAAM,EAC1B,eAAe,CAAC,EAAE,MAAM,EACxB,gBAAgB,CAAC,EAAE,4BAA4B,EAAE,GAChD,MAAM,GAAG,IAAI,CAAC;AACjB,wBAAgB,mCAAmC,CACjD,WAAW,EAAE,MAAM,EACnB,iBAAiB,CAAC,EAAE,MAAM,EAC1B,WAAW,CAAC,EAAE,WAAW,EACzB,gBAAgB,CAAC,EAAE,4BAA4B,EAAE,GAChD,MAAM,GAAG,IAAI,CAAC"}
|
|
@@ -9,13 +9,10 @@ exports.readTargetsFromPackageJson = readTargetsFromPackageJson;
|
|
|
9
9
|
exports.readModulePackageJsonWithoutFallbacks = readModulePackageJsonWithoutFallbacks;
|
|
10
10
|
exports.readModulePackageJson = readModulePackageJson;
|
|
11
11
|
exports.installPackageToTmp = installPackageToTmp;
|
|
12
|
-
exports.installPackageToTmpAsync = installPackageToTmpAsync;
|
|
13
12
|
exports.getDependencyVersionFromPackageJson = getDependencyVersionFromPackageJson;
|
|
14
13
|
const child_process_1 = require("child_process");
|
|
15
|
-
const util_1 = require("util");
|
|
16
14
|
const fs_1 = require("fs");
|
|
17
15
|
const path_1 = require("path");
|
|
18
|
-
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
19
16
|
const tmp_1 = require("tmp");
|
|
20
17
|
const json_1 = require("../generators/utils/json");
|
|
21
18
|
const project_configuration_utils_1 = require("../project-graph/utils/project-configuration-utils");
|
|
@@ -202,11 +199,7 @@ function readModulePackageJson(moduleSpecifier, requirePaths = (0, installation_
|
|
|
202
199
|
path: packageJsonPath,
|
|
203
200
|
};
|
|
204
201
|
}
|
|
205
|
-
|
|
206
|
-
* Prepares all necessary information for installing a package to a temporary directory.
|
|
207
|
-
* This is used by both sync and async installation functions.
|
|
208
|
-
*/
|
|
209
|
-
function preparePackageInstallation(pkg, requiredVersion) {
|
|
202
|
+
function installPackageToTmp(pkg, requiredVersion) {
|
|
210
203
|
const { dir: tempDir, cleanup } = (0, package_manager_1.createTempNpmDirectory)?.() ?? {
|
|
211
204
|
dir: (0, tmp_1.dirSync)().name,
|
|
212
205
|
cleanup: () => { },
|
|
@@ -216,56 +209,29 @@ function preparePackageInstallation(pkg, requiredVersion) {
|
|
|
216
209
|
const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
|
217
210
|
generatePackageManagerFiles(tempDir, packageManager);
|
|
218
211
|
const preInstallCommand = (0, package_manager_1.getPackageManagerCommand)(packageManager).preInstall;
|
|
212
|
+
if (preInstallCommand) {
|
|
213
|
+
// ensure package.json and repo in tmp folder is set to a proper package manager state
|
|
214
|
+
(0, child_process_1.execSync)(preInstallCommand, {
|
|
215
|
+
cwd: tempDir,
|
|
216
|
+
stdio: isVerbose ? 'inherit' : 'ignore',
|
|
217
|
+
windowsHide: false,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
219
220
|
const pmCommands = (0, package_manager_1.getPackageManagerCommand)(packageManager);
|
|
220
221
|
let addCommand = pmCommands.addDev;
|
|
221
222
|
if (packageManager === 'pnpm') {
|
|
222
223
|
addCommand = 'pnpm add -D'; // we need to ensure that we are not using workspace command
|
|
223
224
|
}
|
|
224
|
-
|
|
225
|
-
const execOptions = {
|
|
225
|
+
(0, child_process_1.execSync)(`${addCommand} ${pkg}@${requiredVersion} ${pmCommands.ignoreScriptsFlag ?? ''}`, {
|
|
226
226
|
cwd: tempDir,
|
|
227
227
|
stdio: isVerbose ? 'inherit' : 'ignore',
|
|
228
228
|
windowsHide: false,
|
|
229
|
-
};
|
|
230
|
-
return {
|
|
231
|
-
tempDir,
|
|
232
|
-
cleanup,
|
|
233
|
-
preInstallCommand,
|
|
234
|
-
installCommand,
|
|
235
|
-
execOptions,
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
function installPackageToTmp(pkg, requiredVersion) {
|
|
239
|
-
const { tempDir, cleanup, preInstallCommand, installCommand, execOptions } = preparePackageInstallation(pkg, requiredVersion);
|
|
240
|
-
if (preInstallCommand) {
|
|
241
|
-
// ensure package.json and repo in tmp folder is set to a proper package manager state
|
|
242
|
-
(0, child_process_1.execSync)(preInstallCommand, execOptions);
|
|
243
|
-
}
|
|
244
|
-
(0, child_process_1.execSync)(installCommand, execOptions);
|
|
229
|
+
});
|
|
245
230
|
return {
|
|
246
231
|
tempDir,
|
|
247
232
|
cleanup,
|
|
248
233
|
};
|
|
249
234
|
}
|
|
250
|
-
async function installPackageToTmpAsync(pkg, requiredVersion) {
|
|
251
|
-
const { tempDir, cleanup, preInstallCommand, installCommand, execOptions } = preparePackageInstallation(pkg, requiredVersion);
|
|
252
|
-
try {
|
|
253
|
-
if (preInstallCommand) {
|
|
254
|
-
// ensure package.json and repo in tmp folder is set to a proper package manager state
|
|
255
|
-
await execAsync(preInstallCommand, execOptions);
|
|
256
|
-
}
|
|
257
|
-
await execAsync(installCommand, execOptions);
|
|
258
|
-
return {
|
|
259
|
-
tempDir,
|
|
260
|
-
cleanup,
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
catch (error) {
|
|
264
|
-
// Clean up on error
|
|
265
|
-
cleanup();
|
|
266
|
-
throw error;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
235
|
function getDependencyVersionFromPackageJson(treeOrPackageName, packageNameOrRoot, packageJsonPathOrObjectOrRoot, dependencyLookup) {
|
|
270
236
|
if (typeof treeOrPackageName !== 'string') {
|
|
271
237
|
return getDependencyVersionFromPackageJsonFromTree(treeOrPackageName, packageNameOrRoot, packageJsonPathOrObjectOrRoot, dependencyLookup);
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare const GET_NX_CONSOLE_STATUS: "GET_NX_CONSOLE_STATUS";
|
|
2
|
-
export declare const SET_NX_CONSOLE_PREFERENCE_AND_INSTALL: "SET_NX_CONSOLE_PREFERENCE_AND_INSTALL";
|
|
3
|
-
export type HandleGetNxConsoleStatusMessage = {
|
|
4
|
-
type: typeof GET_NX_CONSOLE_STATUS;
|
|
5
|
-
};
|
|
6
|
-
export type NxConsoleStatusResponse = {
|
|
7
|
-
shouldPrompt: boolean;
|
|
8
|
-
};
|
|
9
|
-
export type HandleSetNxConsolePreferenceAndInstallMessage = {
|
|
10
|
-
type: typeof SET_NX_CONSOLE_PREFERENCE_AND_INSTALL;
|
|
11
|
-
preference: boolean;
|
|
12
|
-
};
|
|
13
|
-
export type SetNxConsolePreferenceAndInstallResponse = {
|
|
14
|
-
installed: boolean;
|
|
15
|
-
};
|
|
16
|
-
export declare function isHandleGetNxConsoleStatusMessage(message: unknown): message is HandleGetNxConsoleStatusMessage;
|
|
17
|
-
export declare function isHandleSetNxConsolePreferenceAndInstallMessage(message: unknown): message is HandleSetNxConsolePreferenceAndInstallMessage;
|
|
18
|
-
//# sourceMappingURL=nx-console.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nx-console.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/message-types/nx-console.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,EAAG,uBAAgC,CAAC;AACtE,eAAO,MAAM,qCAAqC,EAChD,uCAAgD,CAAC;AAEnD,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,OAAO,qBAAqB,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,OAAO,qCAAqC,CAAC;IACnD,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,wCAAwC,GAAG;IACrD,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,OAAO,GACf,OAAO,IAAI,+BAA+B,CAO5C;AAED,wBAAgB,+CAA+C,CAC7D,OAAO,EAAE,OAAO,GACf,OAAO,IAAI,6CAA6C,CAO1D"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SET_NX_CONSOLE_PREFERENCE_AND_INSTALL = exports.GET_NX_CONSOLE_STATUS = void 0;
|
|
4
|
-
exports.isHandleGetNxConsoleStatusMessage = isHandleGetNxConsoleStatusMessage;
|
|
5
|
-
exports.isHandleSetNxConsolePreferenceAndInstallMessage = isHandleSetNxConsolePreferenceAndInstallMessage;
|
|
6
|
-
exports.GET_NX_CONSOLE_STATUS = 'GET_NX_CONSOLE_STATUS';
|
|
7
|
-
exports.SET_NX_CONSOLE_PREFERENCE_AND_INSTALL = 'SET_NX_CONSOLE_PREFERENCE_AND_INSTALL';
|
|
8
|
-
function isHandleGetNxConsoleStatusMessage(message) {
|
|
9
|
-
return (typeof message === 'object' &&
|
|
10
|
-
message !== null &&
|
|
11
|
-
'type' in message &&
|
|
12
|
-
message['type'] === exports.GET_NX_CONSOLE_STATUS);
|
|
13
|
-
}
|
|
14
|
-
function isHandleSetNxConsolePreferenceAndInstallMessage(message) {
|
|
15
|
-
return (typeof message === 'object' &&
|
|
16
|
-
message !== null &&
|
|
17
|
-
'type' in message &&
|
|
18
|
-
message['type'] === exports.SET_NX_CONSOLE_PREFERENCE_AND_INSTALL);
|
|
19
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { HandlerResult } from './server';
|
|
2
|
-
export declare function handleGetNxConsoleStatus(): Promise<HandlerResult>;
|
|
3
|
-
export declare function handleSetNxConsolePreferenceAndInstall(preference: boolean): Promise<HandlerResult>;
|
|
4
|
-
//# sourceMappingURL=handle-nx-console.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handle-nx-console.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/server/handle-nx-console.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAU9C,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,aAAa,CAAC,CAmCvE;AAED,wBAAsB,sCAAsC,CAC1D,UAAU,EAAE,OAAO,GAClB,OAAO,CAAC,aAAa,CAAC,CAexB"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handleGetNxConsoleStatus = handleGetNxConsoleStatus;
|
|
4
|
-
exports.handleSetNxConsolePreferenceAndInstall = handleSetNxConsolePreferenceAndInstall;
|
|
5
|
-
const nx_console_operations_1 = require("./nx-console-operations");
|
|
6
|
-
// Module-level state for caching
|
|
7
|
-
let cachedShouldPrompt = null;
|
|
8
|
-
let isComputing = false;
|
|
9
|
-
async function handleGetNxConsoleStatus() {
|
|
10
|
-
// Return cached result if available
|
|
11
|
-
if (cachedShouldPrompt !== null) {
|
|
12
|
-
const response = {
|
|
13
|
-
shouldPrompt: cachedShouldPrompt,
|
|
14
|
-
};
|
|
15
|
-
return {
|
|
16
|
-
response,
|
|
17
|
-
description: 'handleGetNxConsoleStatus',
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
// Kick off background computation if not already running
|
|
21
|
-
if (!isComputing) {
|
|
22
|
-
isComputing = true;
|
|
23
|
-
(0, nx_console_operations_1.getNxConsoleStatus)()
|
|
24
|
-
.then((result) => {
|
|
25
|
-
cachedShouldPrompt = result;
|
|
26
|
-
isComputing = false;
|
|
27
|
-
})
|
|
28
|
-
.catch(() => {
|
|
29
|
-
cachedShouldPrompt = null;
|
|
30
|
-
isComputing = false;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
// Return false for shouldPrompt if cache not ready (main process will noop)
|
|
34
|
-
const response = {
|
|
35
|
-
shouldPrompt: false,
|
|
36
|
-
};
|
|
37
|
-
return {
|
|
38
|
-
response,
|
|
39
|
-
description: 'handleGetNxConsoleStatus',
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
async function handleSetNxConsolePreferenceAndInstall(preference) {
|
|
43
|
-
// Immediately update cache - we know the answer now!
|
|
44
|
-
// User answered the prompt, so we won't prompt again
|
|
45
|
-
cachedShouldPrompt = false;
|
|
46
|
-
const result = await (0, nx_console_operations_1.handleNxConsolePreferenceAndInstall)({ preference });
|
|
47
|
-
const response = {
|
|
48
|
-
installed: result.installed,
|
|
49
|
-
};
|
|
50
|
-
return {
|
|
51
|
-
response,
|
|
52
|
-
description: 'handleSetNxConsolePreferenceAndInstall',
|
|
53
|
-
};
|
|
54
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gets the Nx Console status (whether we should prompt the user to install).
|
|
3
|
-
* Uses latest Nx version if available, falls back to local implementation.
|
|
4
|
-
*
|
|
5
|
-
* @returns boolean indicating whether we should prompt the user
|
|
6
|
-
*/
|
|
7
|
-
export declare function getNxConsoleStatus({ inner, }?: {
|
|
8
|
-
inner?: boolean;
|
|
9
|
-
}): Promise<boolean>;
|
|
10
|
-
/**
|
|
11
|
-
* Handles user preference submission and installs Nx Console if requested.
|
|
12
|
-
* Uses latest Nx version if available, falls back to local implementation.
|
|
13
|
-
*
|
|
14
|
-
* @param preference - whether the user wants to install Nx Console
|
|
15
|
-
* @returns object indicating whether installation succeeded
|
|
16
|
-
*/
|
|
17
|
-
export declare function handleNxConsolePreferenceAndInstall({ preference, inner, }: {
|
|
18
|
-
preference: boolean;
|
|
19
|
-
inner?: boolean;
|
|
20
|
-
}): Promise<{
|
|
21
|
-
installed: boolean;
|
|
22
|
-
}>;
|
|
23
|
-
/**
|
|
24
|
-
* Clean up the latest Nx installation on daemon shutdown.
|
|
25
|
-
*/
|
|
26
|
-
export declare function cleanupLatestNxInstallation(): void;
|
|
27
|
-
export declare function getNxConsoleStatusImpl(): Promise<boolean>;
|
|
28
|
-
export declare function handleNxConsolePreferenceAndInstallImpl(preference: boolean): Promise<{
|
|
29
|
-
installed: boolean;
|
|
30
|
-
}>;
|
|
31
|
-
//# sourceMappingURL=nx-console-operations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nx-console-operations.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/server/nx-console-operations.ts"],"names":[],"mappings":"AAiBA;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,KAAK,GACN,GAAE;IACD,KAAK,CAAC,EAAE,OAAO,CAAC;CACZ,GAAG,OAAO,CAAC,OAAO,CAAC,CAwCxB;AAED;;;;;;GAMG;AACH,wBAAsB,mCAAmC,CAAC,EACxD,UAAU,EACV,KAAK,GACN,EAAE;IACD,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC,CAgDlC;AAED;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAOlD;AAED,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,OAAO,CAAC,CAsB/D;AAED,wBAAsB,uCAAuC,CAC3D,UAAU,EAAE,OAAO,GAClB,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC,CAUjC"}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getNxConsoleStatus = getNxConsoleStatus;
|
|
4
|
-
exports.handleNxConsolePreferenceAndInstall = handleNxConsolePreferenceAndInstall;
|
|
5
|
-
exports.cleanupLatestNxInstallation = cleanupLatestNxInstallation;
|
|
6
|
-
exports.getNxConsoleStatusImpl = getNxConsoleStatusImpl;
|
|
7
|
-
exports.handleNxConsolePreferenceAndInstallImpl = handleNxConsolePreferenceAndInstallImpl;
|
|
8
|
-
const devkit_internals_1 = require("../../devkit-internals");
|
|
9
|
-
const os_1 = require("os");
|
|
10
|
-
const native_1 = require("../../native");
|
|
11
|
-
const logger_1 = require("./logger");
|
|
12
|
-
// Module-level state - persists across invocations within daemon lifecycle
|
|
13
|
-
let latestNxTmpPath = null;
|
|
14
|
-
let cleanupFn = null;
|
|
15
|
-
const log = (...messageParts) => {
|
|
16
|
-
logger_1.serverLogger.log('[NX-CONSOLE]:', ...messageParts);
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Gets the Nx Console status (whether we should prompt the user to install).
|
|
20
|
-
* Uses latest Nx version if available, falls back to local implementation.
|
|
21
|
-
*
|
|
22
|
-
* @returns boolean indicating whether we should prompt the user
|
|
23
|
-
*/
|
|
24
|
-
async function getNxConsoleStatus({ inner, } = {}) {
|
|
25
|
-
// Use local implementation if explicitly requested
|
|
26
|
-
if (process.env.NX_USE_LOCAL === 'true' || inner === true) {
|
|
27
|
-
log('Using local implementation (NX_USE_LOCAL=true or inner call)');
|
|
28
|
-
return await getNxConsoleStatusImpl();
|
|
29
|
-
}
|
|
30
|
-
try {
|
|
31
|
-
// If we don't have a tmp path yet, pull latest Nx
|
|
32
|
-
if (latestNxTmpPath === null) {
|
|
33
|
-
log('Pulling latest Nx (latest) to check console status...');
|
|
34
|
-
const packageInstallResults = await (0, devkit_internals_1.installPackageToTmpAsync)('nx', 'latest');
|
|
35
|
-
latestNxTmpPath = packageInstallResults.tempDir;
|
|
36
|
-
cleanupFn = packageInstallResults.cleanup;
|
|
37
|
-
log('Successfully pulled latest Nx to', latestNxTmpPath);
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
log('Reusing cached Nx installation from', latestNxTmpPath);
|
|
41
|
-
}
|
|
42
|
-
// Try to use the cached tmp path
|
|
43
|
-
const modulePath = require.resolve('nx/src/daemon/server/nx-console-operations.js', { paths: [latestNxTmpPath] });
|
|
44
|
-
const module = await Promise.resolve(`${modulePath}`).then(s => require(s));
|
|
45
|
-
const result = await module.getNxConsoleStatus({ inner: true });
|
|
46
|
-
log('Console status check completed, shouldPrompt:', result);
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
// If tmp path failed (e.g., directory was deleted), fall back to local immediately
|
|
51
|
-
log('Failed to use latest Nx, falling back to local implementation. Error:', error.message);
|
|
52
|
-
return await getNxConsoleStatusImpl();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Handles user preference submission and installs Nx Console if requested.
|
|
57
|
-
* Uses latest Nx version if available, falls back to local implementation.
|
|
58
|
-
*
|
|
59
|
-
* @param preference - whether the user wants to install Nx Console
|
|
60
|
-
* @returns object indicating whether installation succeeded
|
|
61
|
-
*/
|
|
62
|
-
async function handleNxConsolePreferenceAndInstall({ preference, inner, }) {
|
|
63
|
-
log('Handling user preference:', preference);
|
|
64
|
-
// Use local implementation if explicitly requested
|
|
65
|
-
if (process.env.NX_USE_LOCAL === 'true' || inner === true) {
|
|
66
|
-
log('Using local implementation (NX_USE_LOCAL=true or inner call)');
|
|
67
|
-
return await handleNxConsolePreferenceAndInstallImpl(preference);
|
|
68
|
-
}
|
|
69
|
-
try {
|
|
70
|
-
// If we don't have a tmp path yet, pull latest Nx
|
|
71
|
-
if (latestNxTmpPath === null) {
|
|
72
|
-
log('Pulling latest Nx (latest) to handle preference and install...');
|
|
73
|
-
const packageInstallResults = await (0, devkit_internals_1.installPackageToTmpAsync)('nx', 'latest');
|
|
74
|
-
latestNxTmpPath = packageInstallResults.tempDir;
|
|
75
|
-
cleanupFn = packageInstallResults.cleanup;
|
|
76
|
-
log('Successfully pulled latest Nx to', latestNxTmpPath);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
log('Reusing cached Nx installation from', latestNxTmpPath);
|
|
80
|
-
}
|
|
81
|
-
// Try to use the cached tmp path
|
|
82
|
-
const modulePath = require.resolve('nx/src/daemon/server/nx-console-operations.js', { paths: [latestNxTmpPath] });
|
|
83
|
-
const module = await Promise.resolve(`${modulePath}`).then(s => require(s));
|
|
84
|
-
const result = await module.handleNxConsolePreferenceAndInstall({
|
|
85
|
-
preference,
|
|
86
|
-
inner: true,
|
|
87
|
-
});
|
|
88
|
-
log('Preference saved and installation', result.installed ? 'succeeded' : 'skipped/failed');
|
|
89
|
-
return result;
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
// If tmp path failed (e.g., directory was deleted), fall back to local immediately
|
|
93
|
-
log('Failed to use latest Nx, falling back to local implementation. Error:', error.message);
|
|
94
|
-
return await handleNxConsolePreferenceAndInstallImpl(preference);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Clean up the latest Nx installation on daemon shutdown.
|
|
99
|
-
*/
|
|
100
|
-
function cleanupLatestNxInstallation() {
|
|
101
|
-
if (cleanupFn) {
|
|
102
|
-
log('Cleaning up latest Nx installation from', latestNxTmpPath);
|
|
103
|
-
cleanupFn();
|
|
104
|
-
}
|
|
105
|
-
latestNxTmpPath = null;
|
|
106
|
-
cleanupFn = null;
|
|
107
|
-
}
|
|
108
|
-
async function getNxConsoleStatusImpl() {
|
|
109
|
-
// If no cached preference, read from disk
|
|
110
|
-
const preferences = new native_1.NxConsolePreferences((0, os_1.homedir)());
|
|
111
|
-
const preference = preferences.getAutoInstallPreference();
|
|
112
|
-
const canInstallConsole = (0, native_1.canInstallNxConsole)();
|
|
113
|
-
// If user previously opted in but extension is not installed,
|
|
114
|
-
// they must have manually uninstalled it - respect that choice
|
|
115
|
-
if (preference === true && canInstallConsole) {
|
|
116
|
-
const preferences = new native_1.NxConsolePreferences((0, os_1.homedir)());
|
|
117
|
-
preferences.setAutoInstallPreference(false);
|
|
118
|
-
return false; // Don't prompt
|
|
119
|
-
}
|
|
120
|
-
// Noop if can't install
|
|
121
|
-
if (!canInstallConsole) {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
// Prompt if we can install and user hasn't answered yet
|
|
125
|
-
return typeof preference !== 'boolean';
|
|
126
|
-
}
|
|
127
|
-
async function handleNxConsolePreferenceAndInstallImpl(preference) {
|
|
128
|
-
const preferences = new native_1.NxConsolePreferences((0, os_1.homedir)());
|
|
129
|
-
preferences.setAutoInstallPreference(preference);
|
|
130
|
-
let installed = false;
|
|
131
|
-
if (preference) {
|
|
132
|
-
installed = (0, native_1.installNxConsole)();
|
|
133
|
-
}
|
|
134
|
-
return { installed };
|
|
135
|
-
}
|