nx 23.1.0 → 23.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/nx.js +1 -1
- package/dist/src/ai/configure-ai-agents-disclaimer.d.ts +5 -0
- package/dist/src/ai/configure-ai-agents-disclaimer.js +31 -0
- package/dist/src/command-line/add/add.js +8 -1
- package/dist/src/command-line/import/import.js +1 -1
- package/dist/src/command-line/init/ai-agent-prompts.d.ts +1 -1
- package/dist/src/command-line/init/ai-agent-prompts.js +7 -6
- package/dist/src/command-line/init/command-object.js +10 -2
- package/dist/src/command-line/init/configure-plugins.js +3 -2
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +4 -2
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +4 -3
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +4 -3
- package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +4 -3
- package/dist/src/command-line/init/implementation/angular/index.js +4 -2
- package/dist/src/command-line/init/implementation/utils.d.ts +3 -3
- package/dist/src/command-line/init/implementation/utils.js +22 -3
- package/dist/src/command-line/migrate/execute-migration.d.ts +72 -0
- package/dist/src/command-line/migrate/execute-migration.js +389 -0
- package/dist/src/command-line/migrate/migrate-ui-api.js +17 -12
- package/dist/src/command-line/migrate/migrate.d.ts +14 -45
- package/dist/src/command-line/migrate/migrate.js +58 -375
- package/dist/src/command-line/release/utils/git.js +6 -2
- package/dist/src/command-line/release/utils/release-graph.d.ts +2 -2
- package/dist/src/command-line/release/utils/shared.d.ts +2 -2
- package/dist/src/command-line/show/show-target/info.js +11 -2
- package/dist/src/commands-runner/create-command-graph.js +5 -0
- package/dist/src/config/nx-json.d.ts +1 -1
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/daemon/client/client.d.ts +0 -2
- package/dist/src/daemon/client/client.js +17 -19
- package/dist/src/devkit-internals.d.ts +2 -0
- package/dist/src/devkit-internals.js +7 -1
- package/dist/src/generators/utils/nx-json.js +13 -3
- package/dist/src/native/index.d.ts +1 -1
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/plugins/js/lock-file/npm-parser.js +71 -27
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +46 -15
- package/dist/src/plugins/js/lock-file/project-graph-pruning.js +1 -1
- package/dist/src/plugins/js/lock-file/yarn-parser.js +32 -5
- package/dist/src/plugins/js/utils/register.d.ts +18 -0
- package/dist/src/plugins/js/utils/register.js +81 -0
- package/dist/src/plugins/js/utils/typescript.d.ts +9 -0
- package/dist/src/plugins/js/utils/typescript.js +15 -0
- package/dist/src/project-graph/error-types.js +41 -1
- package/dist/src/project-graph/file-utils.js +6 -1
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +4 -0
- package/dist/src/project-graph/plugins/transpiler.js +4 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +9 -12
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.js +77 -61
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +1 -1
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +1 -1
- package/dist/src/project-graph/utils/project-configuration-utils.js +4 -6
- package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +11 -4
- package/dist/src/tasks-runner/life-cycles/performance-analysis.js +15 -6
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +5 -4
- package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +18 -8
- package/dist/src/tasks-runner/life-cycles/performance-report.js +66 -29
- package/dist/src/tasks-runner/run-command.js +5 -3
- package/dist/src/utils/acknowledge-build-scripts.d.ts +13 -0
- package/dist/src/utils/acknowledge-build-scripts.js +100 -0
- package/dist/src/utils/catalog/manager-utils.d.ts +1 -2
- package/dist/src/utils/catalog/manager-utils.js +22 -5
- package/dist/src/utils/catalog/pnpm-manager.d.ts +1 -0
- package/dist/src/utils/catalog/pnpm-manager.js +3 -15
- package/dist/src/utils/catalog/yarn-manager.d.ts +1 -0
- package/dist/src/utils/catalog/yarn-manager.js +3 -15
- package/dist/src/utils/command-line-utils.js +30 -20
- package/dist/src/utils/git-revision.d.ts +12 -0
- package/dist/src/utils/git-revision.js +25 -0
- package/dist/src/utils/git-utils.d.ts +2 -3
- package/dist/src/utils/git-utils.js +101 -47
- package/dist/src/utils/min-release-age/behavior/pnpm.js +9 -7
- package/dist/src/utils/package-manager.js +6 -2
- package/dist/src/utils/provenance.js +12 -2
- package/migrations.json +7 -1
- package/package.json +11 -11
- package/dist/src/migrations/update-17-3-0/nx-release-path.d.ts +0 -3
- package/dist/src/migrations/update-17-3-0/nx-release-path.js +0 -47
package/dist/bin/nx.js
CHANGED
|
@@ -258,7 +258,7 @@ function warnIfUsingOutdatedGlobalInstall(globalNxVersion, localNxVersion) {
|
|
|
258
258
|
`Your repository uses a higher version of Nx (${localNxVersion}) than your global CLI version (${globalNxVersion})`,
|
|
259
259
|
]
|
|
260
260
|
: [];
|
|
261
|
-
bodyLines.push('For more information, see https://nx.dev/
|
|
261
|
+
bodyLines.push('For more information, see https://nx.dev/docs/getting-started/installation#global-installation');
|
|
262
262
|
output_1.output.warn({
|
|
263
263
|
title: `It's time to update Nx 🎉`,
|
|
264
264
|
bodyLines,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AgentStatusInfo } from '../daemon/message-types/configure-ai-agents';
|
|
2
|
+
/**
|
|
3
|
+
* Whether to show the "configure-ai-agents is outdated" banner after a task run.
|
|
4
|
+
*/
|
|
5
|
+
export declare function shouldPrintConfigureAiAgentsDisclaimer(outdatedAgents: AgentStatusInfo[], workspaceRoot: string): boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shouldPrintConfigureAiAgentsDisclaimer = shouldPrintConfigureAiAgentsDisclaimer;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const detect_ai_agent_1 = require("./detect-ai-agent");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
/**
|
|
8
|
+
* Whether to show the "configure-ai-agents is outdated" banner after a task run.
|
|
9
|
+
*/
|
|
10
|
+
function shouldPrintConfigureAiAgentsDisclaimer(outdatedAgents, workspaceRoot) {
|
|
11
|
+
if (outdatedAgents.length === 0) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
const detectedAgent = (0, detect_ai_agent_1.detectAiAgent)();
|
|
15
|
+
if (detectedAgent) {
|
|
16
|
+
return outdatedAgents.some((agent) => agent.name === detectedAgent);
|
|
17
|
+
}
|
|
18
|
+
// Unsupported agents (e.g. qwen) cannot be configured via `nx configure-ai-agents`.
|
|
19
|
+
// If the repo already has Nx rules in AGENTS.md, skip the misleading warning.
|
|
20
|
+
const agentsMd = (0, constants_1.agentsMdPath)(workspaceRoot);
|
|
21
|
+
if (!(0, fs_1.existsSync)(agentsMd)) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const content = (0, fs_1.readFileSync)(agentsMd, 'utf-8');
|
|
26
|
+
return !constants_1.rulesRegex.test(content);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -38,9 +38,16 @@ async function installPackage(pkgName, version, nxJson) {
|
|
|
38
38
|
const pmv = (0, package_manager_1.getPackageManagerVersion)(pm);
|
|
39
39
|
const pmc = (0, package_manager_1.getPackageManagerCommand)(pm);
|
|
40
40
|
// if we explicitly specify latest in yarn berry, it won't resolve the version
|
|
41
|
-
|
|
41
|
+
let command = pm === 'yarn' && (0, semver_1.gte)(pmv, '2.0.0') && version === 'latest'
|
|
42
42
|
? `${pmc.addDev} ${pkgName}`
|
|
43
43
|
: `${pmc.addDev} ${pkgName}@${version}`;
|
|
44
|
+
// pnpm 11+ fails the install when the plugin's own dependency tree
|
|
45
|
+
// carries unacknowledged build scripts, and the plugin's generators can
|
|
46
|
+
// only record allowBuilds decisions after this install. Warn and skip
|
|
47
|
+
// for this one install, like pnpm 10 did.
|
|
48
|
+
if (pm === 'pnpm' && (0, semver_1.gte)(pmv, '11.0.0')) {
|
|
49
|
+
command += ' --config.strictDepBuilds=false';
|
|
50
|
+
}
|
|
44
51
|
await new Promise((resolve) => (0, child_process_1.exec)(command, {
|
|
45
52
|
windowsHide: true,
|
|
46
53
|
}, (error, stdout, stderr) => {
|
|
@@ -489,7 +489,7 @@ async function runInstallDestinationRepo(packageManager, destinationGitClient) {
|
|
|
489
489
|
output_1.output.log({
|
|
490
490
|
title: 'Installing dependencies for imported code',
|
|
491
491
|
});
|
|
492
|
-
(0, utils_1.runInstall)(workspace_root_1.workspaceRoot, (0, package_manager_1.getPackageManagerCommand)(packageManager));
|
|
492
|
+
(0, utils_1.runInstall)(workspace_root_1.workspaceRoot, packageManager, (0, package_manager_1.getPackageManagerCommand)(packageManager));
|
|
493
493
|
await destinationGitClient.amendCommit();
|
|
494
494
|
}
|
|
495
495
|
catch (e) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Agent } from '../../ai/utils';
|
|
2
|
-
export declare function determineAiAgents(aiAgents?: Agent[], interactive?: boolean): Promise<Agent[]>;
|
|
2
|
+
export declare function determineAiAgents(aiAgents?: (Agent | 'none')[], interactive?: boolean): Promise<Agent[]>;
|
|
@@ -8,16 +8,17 @@ const utils_1 = require("../../ai/utils");
|
|
|
8
8
|
const detect_ai_agent_1 = require("../../ai/detect-ai-agent");
|
|
9
9
|
const pc = tslib_1.__importStar(require("picocolors"));
|
|
10
10
|
async function determineAiAgents(aiAgents, interactive) {
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
if (aiAgents) {
|
|
12
|
+
const filtered = aiAgents.filter((a) => a !== 'none');
|
|
13
|
+
if (filtered.length > 0) {
|
|
14
|
+
return filtered;
|
|
14
15
|
}
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
if (interactive === false || (0, is_ci_1.isCI)()) {
|
|
15
19
|
const detected = (0, detect_ai_agent_1.detectAiAgent)();
|
|
16
20
|
return detected ? [detected] : [];
|
|
17
21
|
}
|
|
18
|
-
if (aiAgents) {
|
|
19
|
-
return aiAgents;
|
|
20
|
-
}
|
|
21
22
|
return await aiAgentsPrompt();
|
|
22
23
|
}
|
|
23
24
|
async function aiAgentsPrompt() {
|
|
@@ -64,8 +64,16 @@ async function withInitOptions(yargs) {
|
|
|
64
64
|
.option('aiAgents', {
|
|
65
65
|
type: 'array',
|
|
66
66
|
string: true,
|
|
67
|
-
description: 'List of AI agents to set up.',
|
|
68
|
-
choices: [
|
|
67
|
+
description: 'List of AI agents to set up. Use "none" to skip.',
|
|
68
|
+
choices: [
|
|
69
|
+
'claude',
|
|
70
|
+
'codex',
|
|
71
|
+
'copilot',
|
|
72
|
+
'cursor',
|
|
73
|
+
'gemini',
|
|
74
|
+
'opencode',
|
|
75
|
+
'none',
|
|
76
|
+
],
|
|
69
77
|
})
|
|
70
78
|
.option('plugins', {
|
|
71
79
|
type: 'string',
|
|
@@ -25,8 +25,9 @@ function installPluginPackages(repoRoot, pmc = (0, package_manager_1.getPackageM
|
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
if ((0, fs_1.existsSync)((0, path_1.join)(repoRoot, 'package.json'))) {
|
|
28
|
-
(0,
|
|
29
|
-
(0, utils_1.
|
|
28
|
+
const packageManager = (0, package_manager_1.detectPackageManager)(repoRoot);
|
|
29
|
+
(0, utils_1.addDepsToPackageJson)(repoRoot, packageManager, plugins);
|
|
30
|
+
(0, utils_1.runInstall)(repoRoot, packageManager, pmc);
|
|
30
31
|
}
|
|
31
32
|
else {
|
|
32
33
|
const nxJson = (0, configuration_1.readNxJson)(repoRoot);
|
|
@@ -7,6 +7,7 @@ const ignore = require("ignore");
|
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const fileutils_1 = require("../../../utils/fileutils");
|
|
9
9
|
const output_1 = require("../../../utils/output");
|
|
10
|
+
const package_manager_1 = require("../../../utils/package-manager");
|
|
10
11
|
const utils_1 = require("./utils");
|
|
11
12
|
const connect_to_nx_cloud_1 = require("../../nx-cloud/connect/connect-to-nx-cloud");
|
|
12
13
|
async function addNxToMonorepo(options, guided = true) {
|
|
@@ -76,9 +77,10 @@ async function addNxToMonorepo(options, guided = true) {
|
|
|
76
77
|
}
|
|
77
78
|
(0, utils_1.createNxJsonFile)(repoRoot, targetDefaults, cacheableOperations, scriptOutputs);
|
|
78
79
|
(0, utils_1.updateGitIgnore)(repoRoot);
|
|
79
|
-
(0,
|
|
80
|
+
const packageManager = (0, package_manager_1.detectPackageManager)(repoRoot);
|
|
81
|
+
(0, utils_1.addDepsToPackageJson)(repoRoot, packageManager);
|
|
80
82
|
output_1.output.log({ title: '📦 Installing dependencies' });
|
|
81
|
-
(0, utils_1.runInstall)(repoRoot);
|
|
83
|
+
(0, utils_1.runInstall)(repoRoot, packageManager);
|
|
82
84
|
if (nxCloudChoice === 'yes') {
|
|
83
85
|
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
|
|
84
86
|
await (0, utils_1.initCloud)('nx-init-monorepo');
|
|
@@ -86,9 +86,10 @@ async function addNxToNest(options, packageJson) {
|
|
|
86
86
|
: 'skip';
|
|
87
87
|
}
|
|
88
88
|
(0, utils_1.createNxJsonFile)(repoRoot, [], [...cacheableOperations, ...nestCacheableScripts], scriptOutputs);
|
|
89
|
-
const
|
|
89
|
+
const packageManager = (0, package_manager_1.detectPackageManager)(repoRoot);
|
|
90
|
+
const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
|
|
90
91
|
(0, utils_1.updateGitIgnore)(repoRoot);
|
|
91
|
-
(0, utils_1.addDepsToPackageJson)(repoRoot);
|
|
92
|
+
(0, utils_1.addDepsToPackageJson)(repoRoot, packageManager);
|
|
92
93
|
addNestPluginToPackageJson(repoRoot);
|
|
93
94
|
(0, utils_1.markRootPackageJsonAsNxProjectLegacy)(repoRoot, cacheableOperations, pmc);
|
|
94
95
|
createProjectJson(repoRoot, packageJson, nestCLIConfiguration);
|
|
@@ -98,7 +99,7 @@ async function addNxToNest(options, packageJson) {
|
|
|
98
99
|
updateTsConfig(repoRoot, nestCLIConfiguration.sourceRoot);
|
|
99
100
|
}
|
|
100
101
|
output_1.output.log({ title: '📦 Installing dependencies' });
|
|
101
|
-
(0, utils_1.runInstall)(repoRoot);
|
|
102
|
+
(0, utils_1.runInstall)(repoRoot, packageManager, pmc);
|
|
102
103
|
if (nxCloudChoice === 'yes') {
|
|
103
104
|
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
|
|
104
105
|
await (0, utils_1.initCloud)('nx-init-nest');
|
|
@@ -61,9 +61,10 @@ async function addNxToNpmRepo(options, guided = true) {
|
|
|
61
61
|
: 'skip';
|
|
62
62
|
}
|
|
63
63
|
(0, utils_1.createNxJsonFile)(repoRoot, [], cacheableOperations, scriptOutputs);
|
|
64
|
-
const
|
|
64
|
+
const packageManager = (0, package_manager_1.detectPackageManager)(repoRoot);
|
|
65
|
+
const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
|
|
65
66
|
(0, utils_1.updateGitIgnore)(repoRoot);
|
|
66
|
-
(0, utils_1.addDepsToPackageJson)(repoRoot);
|
|
67
|
+
(0, utils_1.addDepsToPackageJson)(repoRoot, packageManager);
|
|
67
68
|
if (options.legacy) {
|
|
68
69
|
(0, utils_1.markRootPackageJsonAsNxProjectLegacy)(repoRoot, cacheableOperations, pmc);
|
|
69
70
|
}
|
|
@@ -71,7 +72,7 @@ async function addNxToNpmRepo(options, guided = true) {
|
|
|
71
72
|
(0, utils_1.markPackageJsonAsNxProject)((0, path_1.join)(repoRoot, 'package.json'));
|
|
72
73
|
}
|
|
73
74
|
output_1.output.log({ title: '📦 Installing dependencies' });
|
|
74
|
-
(0, utils_1.runInstall)(repoRoot, pmc);
|
|
75
|
+
(0, utils_1.runInstall)(repoRoot, packageManager, pmc);
|
|
75
76
|
if (nxCloudChoice === 'yes') {
|
|
76
77
|
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
|
|
77
78
|
await (0, utils_1.initCloud)('nx-init-npm-repo');
|
|
@@ -42,9 +42,10 @@ async function addNxToTurborepo(_options) {
|
|
|
42
42
|
// Apply fallback JSON write
|
|
43
43
|
(0, fileutils_1.writeJsonFile)(nxJsonPath, nxJson);
|
|
44
44
|
}
|
|
45
|
-
const
|
|
45
|
+
const packageManager = (0, package_manager_1.detectPackageManager)(repoRoot);
|
|
46
|
+
const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
|
|
46
47
|
(0, utils_1.updateGitIgnore)(repoRoot);
|
|
47
|
-
(0, utils_1.addDepsToPackageJson)(repoRoot);
|
|
48
|
+
(0, utils_1.addDepsToPackageJson)(repoRoot, packageManager);
|
|
48
49
|
output_1.output.log({ title: '📦 Installing dependencies' });
|
|
49
|
-
(0, utils_1.runInstall)(repoRoot, pmc);
|
|
50
|
+
(0, utils_1.runInstall)(repoRoot, packageManager, pmc);
|
|
50
51
|
}
|
|
@@ -7,6 +7,7 @@ const fileutils_1 = require("../../../../utils/fileutils");
|
|
|
7
7
|
const versions_1 = require("../../../../utils/versions");
|
|
8
8
|
const object_sort_1 = require("../../../../utils/object-sort");
|
|
9
9
|
const output_1 = require("../../../../utils/output");
|
|
10
|
+
const package_manager_1 = require("../../../../utils/package-manager");
|
|
10
11
|
const package_json_1 = require("../../../../utils/package-json");
|
|
11
12
|
const utils_1 = require("../utils");
|
|
12
13
|
const integrated_workspace_1 = require("./integrated-workspace");
|
|
@@ -86,9 +87,10 @@ async function collectCacheableOperations(options) {
|
|
|
86
87
|
return cacheableOperations;
|
|
87
88
|
}
|
|
88
89
|
function installDependencies() {
|
|
89
|
-
(0,
|
|
90
|
+
const packageManager = (0, package_manager_1.detectPackageManager)(repoRoot);
|
|
91
|
+
(0, utils_1.addDepsToPackageJson)(repoRoot, packageManager);
|
|
90
92
|
addPluginDependencies();
|
|
91
|
-
(0, utils_1.runInstall)(repoRoot);
|
|
93
|
+
(0, utils_1.runInstall)(repoRoot, packageManager);
|
|
92
94
|
}
|
|
93
95
|
function addPluginDependencies() {
|
|
94
96
|
const packageJsonPath = (0, path_1.join)(repoRoot, 'package.json');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NxJsonConfiguration, TargetDefaultEntry, TargetDefaults } from '../../../config/nx-json';
|
|
2
2
|
import { PackageJson } from '../../../utils/package-json';
|
|
3
|
-
import { PackageManagerCommands } from '../../../utils/package-manager';
|
|
3
|
+
import { PackageManager, PackageManagerCommands } from '../../../utils/package-manager';
|
|
4
4
|
export declare function createNxJsonFile(repoRoot: string, topologicalTargets: string[], cacheableOperations: string[], scriptOutputs: {
|
|
5
5
|
[name: string]: string;
|
|
6
6
|
}): void;
|
|
@@ -13,9 +13,9 @@ export declare function createNxJsonFile(repoRoot: string, topologicalTargets: s
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function upsertTargetDefaultEntry(targetDefaults: TargetDefaults, target: string, patch: Partial<TargetDefaultEntry>): void;
|
|
15
15
|
export declare function createNxJsonFromTurboJson(turboJson: Record<string, any>): NxJsonConfiguration;
|
|
16
|
-
export declare function addDepsToPackageJson(repoRoot: string, additionalPackages?: string[]): void;
|
|
16
|
+
export declare function addDepsToPackageJson(repoRoot: string, packageManager: PackageManager, additionalPackages?: string[]): void;
|
|
17
17
|
export declare function updateGitIgnore(root: string): void;
|
|
18
|
-
export declare function runInstall(repoRoot: string, pmc?: PackageManagerCommands): void;
|
|
18
|
+
export declare function runInstall(repoRoot: string, packageManager?: PackageManager, pmc?: PackageManagerCommands): void;
|
|
19
19
|
/**
|
|
20
20
|
* Coerce any thrown value into a non-empty telemetry string. The naive
|
|
21
21
|
* `error.message || String(error)` yields "" for bare `new Error()`.
|
|
@@ -18,9 +18,11 @@ exports.printFinalMessage = printFinalMessage;
|
|
|
18
18
|
exports.isMonorepo = isMonorepo;
|
|
19
19
|
const child_process_1 = require("child_process");
|
|
20
20
|
const path_1 = require("path");
|
|
21
|
+
const semver_1 = require("semver");
|
|
21
22
|
const fileutils_1 = require("../../../utils/fileutils");
|
|
22
23
|
const output_1 = require("../../../utils/output");
|
|
23
24
|
const package_manager_1 = require("../../../utils/package-manager");
|
|
25
|
+
const acknowledge_build_scripts_1 = require("../../../utils/acknowledge-build-scripts");
|
|
24
26
|
const path_2 = require("../../../utils/path");
|
|
25
27
|
const versions_1 = require("../../../utils/versions");
|
|
26
28
|
const fs_1 = require("fs");
|
|
@@ -207,7 +209,7 @@ function createNxJsonFromTurboJson(turboJson) {
|
|
|
207
209
|
}
|
|
208
210
|
return nxJson;
|
|
209
211
|
}
|
|
210
|
-
function addDepsToPackageJson(repoRoot, additionalPackages) {
|
|
212
|
+
function addDepsToPackageJson(repoRoot, packageManager, additionalPackages) {
|
|
211
213
|
const path = (0, path_2.joinPathFragments)(repoRoot, `package.json`);
|
|
212
214
|
const json = (0, fileutils_1.readJsonFile)(path);
|
|
213
215
|
if (!json.devDependencies)
|
|
@@ -219,6 +221,9 @@ function addDepsToPackageJson(repoRoot, additionalPackages) {
|
|
|
219
221
|
}
|
|
220
222
|
}
|
|
221
223
|
(0, fileutils_1.writeJsonFile)(path, json);
|
|
224
|
+
// nx has a postinstall script, which pnpm 11+ refuses to install
|
|
225
|
+
// unacknowledged.
|
|
226
|
+
(0, acknowledge_build_scripts_1.acknowledgeBuildScripts)(repoRoot, packageManager, { nx: true });
|
|
222
227
|
}
|
|
223
228
|
function updateGitIgnore(root) {
|
|
224
229
|
const ignorePath = (0, path_1.join)(root, '.gitignore');
|
|
@@ -251,9 +256,23 @@ function updateGitIgnore(root) {
|
|
|
251
256
|
}
|
|
252
257
|
catch { }
|
|
253
258
|
}
|
|
254
|
-
function runInstall(repoRoot, pmc = (0, package_manager_1.getPackageManagerCommand)()) {
|
|
259
|
+
function runInstall(repoRoot, packageManager = (0, package_manager_1.detectPackageManager)(repoRoot), pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager)) {
|
|
260
|
+
let command = pmc.install;
|
|
261
|
+
// Plugins added during init can pull build-script deps whose allowBuilds
|
|
262
|
+
// entries are only recorded by their init generators after this install;
|
|
263
|
+
// warn and skip for this one install, like pnpm 10 did.
|
|
264
|
+
if (packageManager === 'pnpm') {
|
|
265
|
+
try {
|
|
266
|
+
if ((0, semver_1.gte)((0, package_manager_1.getPackageManagerVersion)('pnpm', repoRoot), '11.0.0')) {
|
|
267
|
+
command += ' --config.strictDepBuilds=false';
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
catch {
|
|
271
|
+
// The version cannot be probed; run the install unmodified.
|
|
272
|
+
}
|
|
273
|
+
}
|
|
255
274
|
try {
|
|
256
|
-
(0, child_process_1.execSync)(
|
|
275
|
+
(0, child_process_1.execSync)(command, {
|
|
257
276
|
stdio: ['ignore', 'ignore', 'pipe'],
|
|
258
277
|
encoding: 'utf8',
|
|
259
278
|
cwd: repoRoot,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { MigrationsJson } from '../../config/misc-interfaces';
|
|
2
|
+
import { FileChange } from '../../generators/tree';
|
|
3
|
+
import { ArrayPackageGroup, NxMigrationsConfiguration, PackageJson } from '../../utils/package-json';
|
|
4
|
+
interface PackageMigrationConfig extends NxMigrationsConfiguration {
|
|
5
|
+
packageJson: PackageJson;
|
|
6
|
+
packageGroup: ArrayPackageGroup;
|
|
7
|
+
}
|
|
8
|
+
export declare function readPackageMigrationConfig(packageName: string, dir: string): PackageMigrationConfig;
|
|
9
|
+
export declare function runInstall(nxWorkspaceRoot?: string, phase?: MigrationInstallPhase): Promise<void>;
|
|
10
|
+
export type MigrationInstallPhase = 'pre-migration' | 'post-migration';
|
|
11
|
+
export declare class NpmPeerDepsInstallError extends Error {
|
|
12
|
+
constructor();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Detects npm peer-dependency resolution failures. Keyed on the `ERESOLVE`
|
|
16
|
+
* error code, which npm consistently emits for this class of failure across
|
|
17
|
+
* v7+ (`npm ERR! code ERESOLVE` / `npm error code ERESOLVE`). Falls back to a
|
|
18
|
+
* small set of stable phrases in case the code line is missing from the
|
|
19
|
+
* captured output.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isNpmPeerDepsError(stderr: string): boolean;
|
|
22
|
+
export declare function logNpmPeerDepsError(phase: MigrationInstallPhase): void;
|
|
23
|
+
export declare class ChangedDepInstaller {
|
|
24
|
+
private readonly root;
|
|
25
|
+
private readonly shouldSkipInstall;
|
|
26
|
+
private initialDeps;
|
|
27
|
+
private _skippedInstall;
|
|
28
|
+
constructor(root: string, shouldSkipInstall?: boolean);
|
|
29
|
+
get skippedInstall(): boolean;
|
|
30
|
+
installDepsIfChanged(): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
export declare function runNxOrAngularMigration(root: string, migration: {
|
|
33
|
+
package: string;
|
|
34
|
+
name: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
version: string;
|
|
37
|
+
}, isVerbose: boolean, captureGeneratorOutput?: boolean, resolvedCollection?: {
|
|
38
|
+
collection: MigrationsJson;
|
|
39
|
+
collectionPath: string;
|
|
40
|
+
}): Promise<{
|
|
41
|
+
changes: FileChange[];
|
|
42
|
+
nextSteps: string[];
|
|
43
|
+
agentContext: string[];
|
|
44
|
+
logs: string;
|
|
45
|
+
madeChanges: boolean;
|
|
46
|
+
}>;
|
|
47
|
+
export declare function getStringifiedPackageJsonDeps(root: string): string;
|
|
48
|
+
export declare function runNxMigration(root: string, collectionPath: string, collection: MigrationsJson, name: string, migrationVersion: string | undefined, captureGeneratorOutput: boolean): Promise<{
|
|
49
|
+
changes: FileChange[];
|
|
50
|
+
nextSteps: string[];
|
|
51
|
+
agentContext: string[];
|
|
52
|
+
logs: string;
|
|
53
|
+
}>;
|
|
54
|
+
export declare function parseMigrationReturn(value: unknown): {
|
|
55
|
+
nextSteps: string[];
|
|
56
|
+
agentContext: string[];
|
|
57
|
+
};
|
|
58
|
+
export declare function filterStrings(value: unknown): string[];
|
|
59
|
+
export declare function readMigrationCollection(packageName: string, root: string): {
|
|
60
|
+
collection: MigrationsJson;
|
|
61
|
+
collectionPath: string;
|
|
62
|
+
};
|
|
63
|
+
export declare function getImplementationPath(collection: MigrationsJson, collectionPath: string, name: string, migrationVersion?: string): {
|
|
64
|
+
path: string;
|
|
65
|
+
fnSymbol: string;
|
|
66
|
+
};
|
|
67
|
+
export declare class MigrationImplementationMissingError extends Error {
|
|
68
|
+
constructor(baseMessage: string, collectionPath: string, migrationVersion: string | undefined);
|
|
69
|
+
}
|
|
70
|
+
export declare function isAngularMigration(collection: MigrationsJson, name: string): import("../../config/misc-interfaces").MigrationsJsonEntry;
|
|
71
|
+
export declare const getNgCompatLayer: () => Promise<typeof import("../../adapter/ngcli-adapter")>;
|
|
72
|
+
export {};
|