nx 21.6.0-canary.20250915-98c47f0 → 21.6.0-canary.20250916-a429972
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/generators.json +6 -0
- package/package.json +11 -11
- package/src/ai/set-up-ai-agents/get-agent-rules.d.ts +2 -0
- package/src/ai/set-up-ai-agents/get-agent-rules.d.ts.map +1 -0
- package/src/ai/set-up-ai-agents/get-agent-rules.js +26 -0
- package/src/ai/set-up-ai-agents/schema.d.ts +8 -0
- package/src/ai/set-up-ai-agents/schema.json +25 -0
- package/src/ai/set-up-ai-agents/set-up-ai-agents.d.ts +6 -0
- package/src/ai/set-up-ai-agents/set-up-ai-agents.d.ts.map +1 -0
- package/src/ai/set-up-ai-agents/set-up-ai-agents.js +84 -0
- package/src/devkit-internals.d.ts +1 -1
- package/src/devkit-internals.d.ts.map +1 -1
- package/src/devkit-internals.js +2 -1
- package/src/executors/run-script/run-script.impl.d.ts.map +1 -1
- package/src/executors/run-script/run-script.impl.js +33 -8
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/tasks-runner/task-orchestrator.js +2 -2
- package/src/utils/package-json.d.ts +4 -0
- package/src/utils/package-json.d.ts.map +1 -1
- package/src/utils/package-json.js +50 -0
- package/src/utils/package-manager.d.ts +5 -1
- package/src/utils/package-manager.d.ts.map +1 -1
- package/src/utils/package-manager.js +9 -3
package/generators.json
CHANGED
@@ -5,6 +5,12 @@
|
|
5
5
|
"schema": "./src/nx-cloud/generators/connect-to-nx-cloud/schema.json",
|
6
6
|
"description": "Connect a workspace to Nx Cloud",
|
7
7
|
"x-hidden": true
|
8
|
+
},
|
9
|
+
"set-up-ai-agents": {
|
10
|
+
"factory": "./src/ai/set-up-ai-agents/set-up-ai-agents",
|
11
|
+
"schema": "./src/ai/set-up-ai-agents/schema.json",
|
12
|
+
"description": "Sets up the Nx MCP & rule files for common AI Agents",
|
13
|
+
"hidden": true
|
8
14
|
}
|
9
15
|
}
|
10
16
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "21.6.0-canary.
|
3
|
+
"version": "21.6.0-canary.20250916-a429972",
|
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": {
|
@@ -83,16 +83,16 @@
|
|
83
83
|
}
|
84
84
|
},
|
85
85
|
"optionalDependencies": {
|
86
|
-
"@nx/nx-darwin-arm64": "21.6.0-canary.
|
87
|
-
"@nx/nx-darwin-x64": "21.6.0-canary.
|
88
|
-
"@nx/nx-freebsd-x64": "21.6.0-canary.
|
89
|
-
"@nx/nx-linux-arm-gnueabihf": "21.6.0-canary.
|
90
|
-
"@nx/nx-linux-arm64-gnu": "21.6.0-canary.
|
91
|
-
"@nx/nx-linux-arm64-musl": "21.6.0-canary.
|
92
|
-
"@nx/nx-linux-x64-gnu": "21.6.0-canary.
|
93
|
-
"@nx/nx-linux-x64-musl": "21.6.0-canary.
|
94
|
-
"@nx/nx-win32-arm64-msvc": "21.6.0-canary.
|
95
|
-
"@nx/nx-win32-x64-msvc": "21.6.0-canary.
|
86
|
+
"@nx/nx-darwin-arm64": "21.6.0-canary.20250916-a429972",
|
87
|
+
"@nx/nx-darwin-x64": "21.6.0-canary.20250916-a429972",
|
88
|
+
"@nx/nx-freebsd-x64": "21.6.0-canary.20250916-a429972",
|
89
|
+
"@nx/nx-linux-arm-gnueabihf": "21.6.0-canary.20250916-a429972",
|
90
|
+
"@nx/nx-linux-arm64-gnu": "21.6.0-canary.20250916-a429972",
|
91
|
+
"@nx/nx-linux-arm64-musl": "21.6.0-canary.20250916-a429972",
|
92
|
+
"@nx/nx-linux-x64-gnu": "21.6.0-canary.20250916-a429972",
|
93
|
+
"@nx/nx-linux-x64-musl": "21.6.0-canary.20250916-a429972",
|
94
|
+
"@nx/nx-win32-arm64-msvc": "21.6.0-canary.20250916-a429972",
|
95
|
+
"@nx/nx-win32-x64-msvc": "21.6.0-canary.20250916-a429972"
|
96
96
|
},
|
97
97
|
"nx-migrations": {
|
98
98
|
"migrations": "./migrations.json",
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"get-agent-rules.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/ai/set-up-ai-agents/get-agent-rules.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,UAwB7C"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getAgentRules = getAgentRules;
|
4
|
+
function getAgentRules(nxCloud) {
|
5
|
+
return `
|
6
|
+
# General Guidelines for working with Nx
|
7
|
+
|
8
|
+
- When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through \`nx\` (i.e. \`nx run\`, \`nx run-many\`, \`nx affected\`) instead of using the underlying tooling directly
|
9
|
+
- You have access to the Nx MCP server and its tools, use them to help the user
|
10
|
+
- When answering questions about the repository, use the \`nx_workspace\` tool first to gain an understanding of the workspace architecture where applicable.
|
11
|
+
- When working in individual projects, use the \`nx_project_details\` mcp tool to analyze and understand the specific project structure and dependencies
|
12
|
+
- For questions around nx configuration, best practices or if you're unsure, use the \`nx_docs\` tool to get relevant, up-to-date docs. Always use this instead of assuming things about nx configuration
|
13
|
+
- If the user needs help with an Nx configuration or project graph error, use the \`nx_workspace\` tool to get any errors
|
14
|
+
${nxCloud
|
15
|
+
? `
|
16
|
+
# CI Error Guidelines
|
17
|
+
|
18
|
+
If the user wants help with fixing an error in their CI pipeline, use the following flow:
|
19
|
+
- Retrieve the list of current CI Pipeline Executions (CIPEs) using the \`nx_cloud_cipe_details\` tool
|
20
|
+
- If there are any errors, use the \`nx_cloud_fix_cipe_failure\` tool to retrieve the logs for a specific task
|
21
|
+
- Use the task logs to see what's wrong and help the user fix their problem. Use the appropriate tools if necessary
|
22
|
+
- Make sure that the problem is fixed by running the task that you passed into the \`nx_cloud_fix_cipe_failure\` tool
|
23
|
+
`
|
24
|
+
: ''}
|
25
|
+
`;
|
26
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
3
|
+
"$id": "SetupAiAgents",
|
4
|
+
"title": "Set Up AI Agents",
|
5
|
+
"description": "Sets up the Nx MCP & rule files for common AI Agents.",
|
6
|
+
"type": "object",
|
7
|
+
"properties": {
|
8
|
+
"directory": {
|
9
|
+
"type": "string",
|
10
|
+
"description": "Directory where the AI agent configuration files will be generated",
|
11
|
+
"default": "."
|
12
|
+
},
|
13
|
+
"writeNxCloudRules": {
|
14
|
+
"type": "boolean",
|
15
|
+
"description": "Whether to write Nx Cloud rules",
|
16
|
+
"default": false
|
17
|
+
},
|
18
|
+
"packageVersion": {
|
19
|
+
"type": "string",
|
20
|
+
"description": "The version of the package to use",
|
21
|
+
"default": "latest"
|
22
|
+
}
|
23
|
+
},
|
24
|
+
"required": ["directory"]
|
25
|
+
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { Tree } from '../../generators/tree';
|
2
|
+
import { NormalizedSetupAiAgentsGeneratorSchema, SetupAiAgentsGeneratorSchema } from './schema';
|
3
|
+
export declare function setupAiAgentsGenerator(tree: Tree, options: SetupAiAgentsGeneratorSchema, inner?: boolean): Promise<any>;
|
4
|
+
export declare function setupAiAgentsGeneratorImpl(tree: Tree, options: NormalizedSetupAiAgentsGeneratorSchema): Promise<void>;
|
5
|
+
export default setupAiAgentsGenerator;
|
6
|
+
//# sourceMappingURL=set-up-ai-agents.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"set-up-ai-agents.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/ai/set-up-ai-agents/set-up-ai-agents.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAK7C,OAAO,EACL,sCAAsC,EACtC,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAElB,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,EACrC,KAAK,UAAQ,gBAoCd;AAYD,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,sCAAsC,iBAgChD;AAqBD,eAAe,sBAAsB,CAAC"}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.setupAiAgentsGenerator = setupAiAgentsGenerator;
|
4
|
+
exports.setupAiAgentsGeneratorImpl = setupAiAgentsGeneratorImpl;
|
5
|
+
const path_1 = require("path");
|
6
|
+
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
7
|
+
const json_1 = require("../../generators/utils/json");
|
8
|
+
const package_json_1 = require("../../utils/package-json");
|
9
|
+
const provenance_1 = require("../../utils/provenance");
|
10
|
+
const get_agent_rules_1 = require("./get-agent-rules");
|
11
|
+
async function setupAiAgentsGenerator(tree, options, inner = false) {
|
12
|
+
const normalizedOptions = normalizeOptions(options);
|
13
|
+
// Use environment variable to force local execution
|
14
|
+
if (process.env.NX_AI_FILES_USE_LOCAL === 'true' || inner) {
|
15
|
+
return await setupAiAgentsGeneratorImpl(tree, normalizedOptions);
|
16
|
+
}
|
17
|
+
try {
|
18
|
+
await (0, provenance_1.ensurePackageHasProvenance)('nx', normalizedOptions.packageVersion);
|
19
|
+
const { tempDir, cleanup } = (0, package_json_1.installPackageToTmp)('nx', normalizedOptions.packageVersion);
|
20
|
+
let modulePath = (0, path_1.join)(tempDir, 'node_modules', 'nx', 'src/ai/set-up-ai-agents/set-up-ai-agents.js');
|
21
|
+
const module = await Promise.resolve(`${modulePath}`).then(s => require(s));
|
22
|
+
const setupAiAgentsGeneratorResult = await module.setupAiAgentsGenerator(tree, normalizedOptions, true);
|
23
|
+
cleanup();
|
24
|
+
return setupAiAgentsGeneratorResult;
|
25
|
+
}
|
26
|
+
catch (error) {
|
27
|
+
return await setupAiAgentsGeneratorImpl(tree, normalizedOptions);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
function normalizeOptions(options) {
|
31
|
+
return {
|
32
|
+
directory: options.directory,
|
33
|
+
writeNxCloudRules: options.writeNxCloudRules ?? false,
|
34
|
+
packageVersion: options.packageVersion ?? 'latest',
|
35
|
+
};
|
36
|
+
}
|
37
|
+
async function setupAiAgentsGeneratorImpl(tree, options) {
|
38
|
+
const claudePath = (0, path_1.join)(options.directory, 'CLAUDE.md');
|
39
|
+
if (!tree.exists(claudePath)) {
|
40
|
+
tree.write(claudePath, (0, get_agent_rules_1.getAgentRules)(options.writeNxCloudRules));
|
41
|
+
}
|
42
|
+
const agentsPath = (0, path_1.join)(options.directory, 'AGENTS.md');
|
43
|
+
if (!tree.exists(agentsPath)) {
|
44
|
+
tree.write(agentsPath, (0, get_agent_rules_1.getAgentRules)(options.writeNxCloudRules));
|
45
|
+
}
|
46
|
+
const mcpJsonPath = (0, path_1.join)(options.directory, '.mcp.json');
|
47
|
+
if (!tree.exists(mcpJsonPath)) {
|
48
|
+
(0, json_1.writeJson)(tree, mcpJsonPath, {});
|
49
|
+
}
|
50
|
+
(0, json_1.updateJson)(tree, mcpJsonPath, mcpConfigUpdater);
|
51
|
+
const geminiPath = (0, path_1.join)(options.directory, '.gemini', 'settings.json');
|
52
|
+
if (!tree.exists(geminiPath)) {
|
53
|
+
(0, json_1.writeJson)(tree, geminiPath, {});
|
54
|
+
}
|
55
|
+
(0, json_1.updateJson)(tree, geminiPath, mcpConfigUpdater);
|
56
|
+
// Only set contextFileName to AGENTS.md if GEMINI.md doesn't exist already to preserve existing setups
|
57
|
+
if (!tree.exists((0, path_1.join)(options.directory, 'GEMINI.md'))) {
|
58
|
+
(0, json_1.updateJson)(tree, geminiPath, (json) => ({
|
59
|
+
...json,
|
60
|
+
contextFileName: 'AGENTS.md',
|
61
|
+
}));
|
62
|
+
}
|
63
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
64
|
+
}
|
65
|
+
function mcpConfigUpdater(existing) {
|
66
|
+
if (existing.mcpServers) {
|
67
|
+
existing.mcpServers['nx-mcp'] = {
|
68
|
+
type: 'stdio',
|
69
|
+
command: 'npx',
|
70
|
+
args: ['nx', 'mcp'],
|
71
|
+
};
|
72
|
+
}
|
73
|
+
else {
|
74
|
+
existing.mcpServers = {
|
75
|
+
'nx-mcp': {
|
76
|
+
type: 'stdio',
|
77
|
+
command: 'npx',
|
78
|
+
args: ['nx', 'mcp'],
|
79
|
+
},
|
80
|
+
};
|
81
|
+
}
|
82
|
+
return existing;
|
83
|
+
}
|
84
|
+
exports.default = setupAiAgentsGenerator;
|
@@ -14,7 +14,7 @@ export { splitTarget } from './utils/split-target';
|
|
14
14
|
export { combineOptionsForExecutor } from './utils/params';
|
15
15
|
export { sortObjectByKeys } from './utils/object-sort';
|
16
16
|
export { stripIndent } from './utils/logger';
|
17
|
-
export { readModulePackageJson } from './utils/package-json';
|
17
|
+
export { readModulePackageJson, installPackageToTmp, } from './utils/package-json';
|
18
18
|
export { splitByColons } from './utils/split-target';
|
19
19
|
export { hashObject } from './hasher/file-hasher';
|
20
20
|
export { hashWithWorkspaceContext, hashMultiGlobWithWorkspaceContext, } from './utils/workspace-context';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"devkit-internals.d.ts","sourceRoot":"","sources":["../../../../packages/nx/src/devkit-internals.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EACL,sBAAsB,EACtB,aAAa,GACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;A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,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,wBAAwB,EACxB,iCAAiC,GAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,kDAAkD,EAClD,kBAAkB,GACnB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC"}
|
package/src/devkit-internals.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.isUsingPrettierInTree = exports.isCI = exports.interpolate = exports.registerTsProject = exports.LoadedNxPlugin = exports.retrieveProjectConfigurations = exports.findProjectForPath = exports.createProjectRootMappingsFromProjectConfigurations = exports.hashMultiGlobWithWorkspaceContext = exports.hashWithWorkspaceContext = exports.hashObject = exports.splitByColons = exports.readModulePackageJson = exports.stripIndent = exports.sortObjectByKeys = exports.combineOptionsForExecutor = exports.splitTarget = exports.findMatchingConfigFiles = exports.readProjectConfigurationsFromRootMap = exports.mergeTargetConfigurations = exports.retrieveProjectConfigurationsWithAngularProjects = exports.calculateDefaultProjectName = exports.readNxJsonFromDisk = exports.parseExecutor = exports.getExecutorInformation = exports.createTempNpmDirectory = void 0;
|
3
|
+
exports.isUsingPrettierInTree = exports.isCI = exports.interpolate = exports.registerTsProject = exports.LoadedNxPlugin = exports.retrieveProjectConfigurations = exports.findProjectForPath = exports.createProjectRootMappingsFromProjectConfigurations = exports.hashMultiGlobWithWorkspaceContext = exports.hashWithWorkspaceContext = exports.hashObject = exports.splitByColons = exports.installPackageToTmp = exports.readModulePackageJson = exports.stripIndent = exports.sortObjectByKeys = exports.combineOptionsForExecutor = exports.splitTarget = exports.findMatchingConfigFiles = exports.readProjectConfigurationsFromRootMap = exports.mergeTargetConfigurations = exports.retrieveProjectConfigurationsWithAngularProjects = exports.calculateDefaultProjectName = exports.readNxJsonFromDisk = exports.parseExecutor = exports.getExecutorInformation = exports.createTempNpmDirectory = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
/**
|
6
6
|
* Note to developers: STOP! These exports are available via requireNx in @nx/devkit.
|
@@ -33,6 +33,7 @@ var logger_1 = require("./utils/logger");
|
|
33
33
|
Object.defineProperty(exports, "stripIndent", { enumerable: true, get: function () { return logger_1.stripIndent; } });
|
34
34
|
var package_json_1 = require("./utils/package-json");
|
35
35
|
Object.defineProperty(exports, "readModulePackageJson", { enumerable: true, get: function () { return package_json_1.readModulePackageJson; } });
|
36
|
+
Object.defineProperty(exports, "installPackageToTmp", { enumerable: true, get: function () { return package_json_1.installPackageToTmp; } });
|
36
37
|
var split_target_2 = require("./utils/split-target");
|
37
38
|
Object.defineProperty(exports, "splitByColons", { enumerable: true, get: function () { return split_target_2.splitByColons; } });
|
38
39
|
var file_hasher_1 = require("./hasher/file-hasher");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"run-script.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/run-script/run-script.impl.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"run-script.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/run-script/run-script.impl.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AASpE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,yBACE,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,eAAe;;GA6BzB"}
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = default_1;
|
4
4
|
const child_process_1 = require("child_process");
|
5
5
|
const path = require("path");
|
6
|
+
const treeKill = require("tree-kill");
|
6
7
|
const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal");
|
7
8
|
const package_manager_1 = require("../../utils/package-manager");
|
9
|
+
const LARGE_BUFFER = 1024 * 1000000;
|
8
10
|
async function default_1(options, context) {
|
9
11
|
const pm = (0, package_manager_1.getPackageManagerCommand)();
|
10
12
|
try {
|
@@ -22,7 +24,7 @@ async function default_1(options, context) {
|
|
22
24
|
await ptyProcess(command, cwd, env);
|
23
25
|
}
|
24
26
|
else {
|
25
|
-
nodeProcess(command, cwd, env);
|
27
|
+
await nodeProcess(command, cwd, env);
|
26
28
|
}
|
27
29
|
return { success: true };
|
28
30
|
}
|
@@ -31,19 +33,42 @@ async function default_1(options, context) {
|
|
31
33
|
}
|
32
34
|
}
|
33
35
|
function nodeProcess(command, cwd, env) {
|
34
|
-
(
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
return new Promise((res, rej) => {
|
37
|
+
let cp = (0, child_process_1.exec)(command, { cwd, env, maxBuffer: LARGE_BUFFER, windowsHide: false }, (error) => {
|
38
|
+
if (error) {
|
39
|
+
rej(error);
|
40
|
+
}
|
41
|
+
else {
|
42
|
+
res();
|
43
|
+
}
|
44
|
+
});
|
45
|
+
// Forward stdout/stderr to parent process
|
46
|
+
cp.stdout.pipe(process.stdout);
|
47
|
+
cp.stderr.pipe(process.stderr);
|
48
|
+
const exitHandler = (signal) => {
|
49
|
+
if (cp && cp.pid && !cp.killed) {
|
50
|
+
treeKill(cp.pid, signal, (error) => {
|
51
|
+
// On Windows, tree-kill (which uses taskkill) may fail when the process or its child process is already terminated.
|
52
|
+
// Ignore the errors, otherwise we will log them unnecessarily.
|
53
|
+
if (error && process.platform !== 'win32') {
|
54
|
+
rej(error);
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
res();
|
58
|
+
}
|
59
|
+
});
|
60
|
+
}
|
61
|
+
};
|
62
|
+
process.on('SIGINT', () => exitHandler('SIGINT'));
|
63
|
+
process.on('SIGTERM', () => exitHandler('SIGTERM'));
|
64
|
+
process.on('SIGHUP', () => exitHandler('SIGHUP'));
|
39
65
|
});
|
40
66
|
}
|
41
|
-
let cp;
|
42
67
|
async function ptyProcess(command, cwd, env) {
|
43
68
|
const terminal = (0, pseudo_terminal_1.createPseudoTerminal)();
|
44
69
|
await terminal.init();
|
45
70
|
return new Promise((res, rej) => {
|
46
|
-
cp = terminal.runCommand(command, { cwd, jsEnv: env });
|
71
|
+
let cp = terminal.runCommand(command, { cwd, jsEnv: env });
|
47
72
|
cp.onExit((code) => {
|
48
73
|
if (code === 0) {
|
49
74
|
res();
|
Binary file
|
@@ -667,7 +667,7 @@ class TaskOrchestrator {
|
|
667
667
|
...Array.from(this.runningContinuousTasks).map(async ([taskId, t]) => {
|
668
668
|
try {
|
669
669
|
await t.kill();
|
670
|
-
this.options.lifeCycle.setTaskStatus(taskId, 9 /* NativeTaskStatus.Stopped */);
|
670
|
+
this.options.lifeCycle.setTaskStatus?.(taskId, 9 /* NativeTaskStatus.Stopped */);
|
671
671
|
}
|
672
672
|
catch (e) {
|
673
673
|
console.error(`Unable to terminate ${taskId}\nError:`, e);
|
@@ -700,7 +700,7 @@ class TaskOrchestrator {
|
|
700
700
|
const runningTask = this.runningContinuousTasks.get(taskId);
|
701
701
|
if (runningTask) {
|
702
702
|
runningTask.kill();
|
703
|
-
this.options.lifeCycle.setTaskStatus(taskId, 9 /* NativeTaskStatus.Stopped */);
|
703
|
+
this.options.lifeCycle.setTaskStatus?.(taskId, 9 /* NativeTaskStatus.Stopped */);
|
704
704
|
}
|
705
705
|
}
|
706
706
|
}
|
@@ -104,5 +104,9 @@ export declare function readModulePackageJson(moduleSpecifier: string, requirePa
|
|
104
104
|
packageJson: PackageJson;
|
105
105
|
path: string;
|
106
106
|
};
|
107
|
+
export declare function installPackageToTmp(pkg: string, requiredVersion: string): {
|
108
|
+
tempDir: string;
|
109
|
+
cleanup: () => void;
|
110
|
+
};
|
107
111
|
export {};
|
108
112
|
//# sourceMappingURL=package-json.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/package-json.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACpB,MAAM,uCAAuC,CAAC;AAI/C,OAAO,
|
1
|
+
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/package-json.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACpB,MAAM,uCAAuC,CAAC;AAI/C,OAAO,EAML,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAI3B,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,WAAW,yBAAyB;IACxC,UAAU,CAAC,E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W,EACxB,4BAA4B,EAAE,OAAO,GACpC,eAAe,CAejB;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,EAAE,CASzE;AAED,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,4CA8CtB;AAcD;;;;;;GAMG;AACH,wBAAgB,qCAAqC,CACnD,eAAe,EAAE,MAAM,EACvB,YAAY,WAAsB,GACjC;IACD,WAAW,EAAE,WAAW,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,CAaA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACnC,eAAe,EAAE,MAAM,EACvB,YAAY,WAAsB,GACjC;IACD,WAAW,EAAE,WAAW,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,CAgCA;AAED,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,EACX,eAAe,EAAE,MAAM,GACtB;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAwCA"}
|
@@ -8,12 +8,15 @@ exports.getTagsFromPackageJson = getTagsFromPackageJson;
|
|
8
8
|
exports.readTargetsFromPackageJson = readTargetsFromPackageJson;
|
9
9
|
exports.readModulePackageJsonWithoutFallbacks = readModulePackageJsonWithoutFallbacks;
|
10
10
|
exports.readModulePackageJson = readModulePackageJson;
|
11
|
+
exports.installPackageToTmp = installPackageToTmp;
|
11
12
|
const fs_1 = require("fs");
|
12
13
|
const path_1 = require("path");
|
13
14
|
const project_configuration_utils_1 = require("../project-graph/utils/project-configuration-utils");
|
14
15
|
const fileutils_1 = require("./fileutils");
|
15
16
|
const installation_directory_1 = require("./installation-directory");
|
16
17
|
const package_manager_1 = require("./package-manager");
|
18
|
+
const tmp_1 = require("tmp");
|
19
|
+
const child_process_1 = require("child_process");
|
17
20
|
function normalizePackageGroup(packageGroup) {
|
18
21
|
return Array.isArray(packageGroup)
|
19
22
|
? packageGroup.map((x) => typeof x === 'string' ? { package: x, version: '*' } : x)
|
@@ -191,3 +194,50 @@ function readModulePackageJson(moduleSpecifier, requirePaths = (0, installation_
|
|
191
194
|
path: packageJsonPath,
|
192
195
|
};
|
193
196
|
}
|
197
|
+
function installPackageToTmp(pkg, requiredVersion) {
|
198
|
+
const { dir: tempDir, cleanup } = (0, package_manager_1.createTempNpmDirectory)?.() ?? {
|
199
|
+
dir: (0, tmp_1.dirSync)().name,
|
200
|
+
cleanup: () => { },
|
201
|
+
};
|
202
|
+
console.log(`Fetching ${pkg}...`);
|
203
|
+
const packageManager = (0, package_manager_1.detectPackageManager)();
|
204
|
+
const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
205
|
+
generatePackageManagerFiles(tempDir, packageManager);
|
206
|
+
const preInstallCommand = (0, package_manager_1.getPackageManagerCommand)(packageManager).preInstall;
|
207
|
+
if (preInstallCommand) {
|
208
|
+
// ensure package.json and repo in tmp folder is set to a proper package manager state
|
209
|
+
(0, child_process_1.execSync)(preInstallCommand, {
|
210
|
+
cwd: tempDir,
|
211
|
+
stdio: isVerbose ? 'inherit' : 'ignore',
|
212
|
+
windowsHide: false,
|
213
|
+
});
|
214
|
+
}
|
215
|
+
const pmCommands = (0, package_manager_1.getPackageManagerCommand)(packageManager);
|
216
|
+
let addCommand = pmCommands.addDev;
|
217
|
+
if (packageManager === 'pnpm') {
|
218
|
+
addCommand = 'pnpm add -D'; // we need to ensure that we are not using workspace command
|
219
|
+
}
|
220
|
+
(0, child_process_1.execSync)(`${addCommand} ${pkg}@${requiredVersion} ${pmCommands.ignoreScriptsFlag ?? ''}`, {
|
221
|
+
cwd: tempDir,
|
222
|
+
stdio: isVerbose ? 'inherit' : 'ignore',
|
223
|
+
windowsHide: false,
|
224
|
+
});
|
225
|
+
return {
|
226
|
+
tempDir,
|
227
|
+
cleanup,
|
228
|
+
};
|
229
|
+
}
|
230
|
+
/**
|
231
|
+
* Generates necessary files needed for the package manager to work
|
232
|
+
* and for the node_modules to be accessible.
|
233
|
+
*/
|
234
|
+
function generatePackageManagerFiles(root, packageManager = (0, package_manager_1.detectPackageManager)()) {
|
235
|
+
const [pmMajor] = (0, package_manager_1.getPackageManagerVersion)(packageManager).split('.');
|
236
|
+
switch (packageManager) {
|
237
|
+
case 'yarn':
|
238
|
+
if (+pmMajor >= 2) {
|
239
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(root, '.yarnrc.yml'), 'nodeLinker: node-modules\nenableScripts: false');
|
240
|
+
}
|
241
|
+
break;
|
242
|
+
}
|
243
|
+
}
|
@@ -81,8 +81,12 @@ export declare function copyPackageManagerConfigurationFiles(root: string, desti
|
|
81
81
|
* For cases where you'd want to install packages that require an `.npmrc` set up,
|
82
82
|
* this function looks up for the nearest `.npmrc` (if exists) and copies it over to the
|
83
83
|
* temp directory.
|
84
|
+
*
|
85
|
+
* @param skipCopy - If true, skips copying package manager configuration files to the temporary directory.
|
86
|
+
* This is useful when creating a workspace from scratch (e.g., in create-nx-workspace)
|
87
|
+
* where no existing configuration files are available to copy.
|
84
88
|
*/
|
85
|
-
export declare function createTempNpmDirectory(): {
|
89
|
+
export declare function createTempNpmDirectory(skipCopy?: boolean): {
|
86
90
|
dir: string;
|
87
91
|
cleanup: () => Promise<void>;
|
88
92
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/package-manager.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IAC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,EAAE,MAAM,GAAG,MAAM,CAOtE;AAED,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,QAuCpB;AAED
|
1
|
+
{"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/package-manager.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAE/C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,CACP,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,MAAM,EACzB,GAAG,EAAE,MAAM,KACR,MAAM,CAAC;IAEZ,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,MAAW,GAAG,cAAc,CAYrE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,GAAE,cAAuC,EACvD,IAAI,GAAE,MAAsB,GAC3B,OAAO,CAmBT;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CACtC,cAAc,GAAE,cAAuC,EACvD,IAAI,GAAE,MAAsB,GAC3B,sBAAsB,CAiIxB;A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AAc,GAAE,cAAuC,EACvD,IAAI,GAAE,MAAsB,GAC3B,MAAM,EAAE,CAoBV;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,EACnB,cAAc,GAAE,cAAuC,EACvD,UAAU,GAAE,MAAM,EAAyC,EAC3D,IAAI,GAAE,MAAsB,GAC3B,IAAI,CAiEN"}
|
@@ -339,13 +339,19 @@ function copyPackageManagerConfigurationFiles(root, destination) {
|
|
339
339
|
* For cases where you'd want to install packages that require an `.npmrc` set up,
|
340
340
|
* this function looks up for the nearest `.npmrc` (if exists) and copies it over to the
|
341
341
|
* temp directory.
|
342
|
+
*
|
343
|
+
* @param skipCopy - If true, skips copying package manager configuration files to the temporary directory.
|
344
|
+
* This is useful when creating a workspace from scratch (e.g., in create-nx-workspace)
|
345
|
+
* where no existing configuration files are available to copy.
|
342
346
|
*/
|
343
|
-
function createTempNpmDirectory() {
|
347
|
+
function createTempNpmDirectory(skipCopy = false) {
|
344
348
|
const dir = (0, tmp_1.dirSync)().name;
|
345
349
|
// A package.json is needed for pnpm pack and for .npmrc to resolve
|
346
350
|
(0, fileutils_1.writeJsonFile)(`${dir}/package.json`, {});
|
347
|
-
|
348
|
-
|
351
|
+
if (!skipCopy) {
|
352
|
+
const isNonJs = !(0, fs_1.existsSync)((0, path_1.join)(workspace_root_1.workspaceRoot, 'package.json'));
|
353
|
+
copyPackageManagerConfigurationFiles(isNonJs ? (0, installation_directory_1.getNxInstallationPath)(workspace_root_1.workspaceRoot) : workspace_root_1.workspaceRoot, dir);
|
354
|
+
}
|
349
355
|
const cleanup = async () => {
|
350
356
|
try {
|
351
357
|
await (0, promises_1.rm)(dir, { recursive: true, force: true });
|