nx 21.3.0-beta.6 → 21.3.0-canary.20250614-db86a35
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.js +0 -6
- package/bin/nx.js +9 -5
- package/package.json +12 -12
- package/release/changelog-renderer/index.js +2 -10
- package/src/adapter/decorate-cli.js +1 -2
- package/src/adapter/ngcli-adapter.d.ts +0 -11
- package/src/adapter/ngcli-adapter.js +7 -101
- package/src/command-line/affected/affected.js +1 -1
- package/src/command-line/{nx-cloud/connect → connect}/command-object.js +4 -4
- package/src/command-line/{nx-cloud/connect → connect}/connect-to-nx-cloud.d.ts +4 -4
- package/src/command-line/{nx-cloud/connect → connect}/connect-to-nx-cloud.js +10 -10
- package/src/command-line/{nx-cloud/connect → connect}/view-logs.js +6 -6
- package/src/command-line/format/command-object.js +6 -12
- package/src/command-line/init/implementation/add-nx-to-monorepo.js +1 -1
- package/src/command-line/init/implementation/add-nx-to-nest.js +1 -1
- package/src/command-line/init/implementation/add-nx-to-npm-repo.js +1 -1
- package/src/command-line/init/implementation/angular/index.js +1 -1
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +1 -1
- package/src/command-line/init/implementation/utils.js +1 -1
- package/src/command-line/init/init-v2.js +1 -1
- package/src/command-line/{nx-cloud/login → login}/command-object.js +1 -1
- package/src/command-line/login/login.js +19 -0
- package/src/command-line/{nx-cloud/logout → logout}/command-object.js +1 -1
- package/src/command-line/{nx-cloud/utils.js → logout/logout.js} +4 -4
- package/src/command-line/migrate/migrate-ui-api.d.ts +3 -20
- package/src/command-line/migrate/migrate-ui-api.js +12 -115
- package/src/command-line/migrate/migrate.js +1 -1
- package/src/command-line/nx-commands.js +6 -12
- package/src/command-line/release/changelog.js +13 -3
- package/src/command-line/release/config/config.js +0 -12
- package/src/command-line/release/utils/git.d.ts +1 -1
- package/src/command-line/release/utils/git.js +10 -18
- package/src/command-line/release/utils/shared.js +1 -7
- package/src/command-line/release/version/release-group-processor.js +1 -1
- package/src/command-line/run/run-one.js +1 -1
- package/src/command-line/run-many/run-many.js +1 -1
- package/src/command-line/yargs-utils/shared-options.d.ts +0 -1
- package/src/command-line/yargs-utils/shared-options.js +0 -5
- package/src/config/nx-json.d.ts +0 -14
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.css +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/server/server.js +1 -7
- package/src/native/index.d.ts +1 -2
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +1 -1
- package/src/plugins/js/lock-file/lock-file.d.ts +0 -1
- package/src/plugins/js/lock-file/lock-file.js +0 -2
- package/src/plugins/js/lock-file/npm-parser.js +3 -42
- package/src/plugins/js/lock-file/pnpm-parser.js +16 -43
- package/src/plugins/js/lock-file/project-graph-pruning.d.ts +1 -4
- package/src/plugins/js/lock-file/project-graph-pruning.js +5 -32
- package/src/plugins/js/lock-file/yarn-parser.js +7 -19
- package/src/plugins/package-json/create-nodes.js +1 -4
- package/src/tasks-runner/forked-process-task-runner.js +0 -4
- package/src/tasks-runner/is-tui-enabled.js +0 -8
- package/src/tasks-runner/run-command.js +1 -1
- package/src/tasks-runner/running-tasks/node-child-process.d.ts +0 -2
- package/src/tasks-runner/running-tasks/node-child-process.js +2 -16
- package/src/tasks-runner/task-orchestrator.js +1 -7
- package/src/utils/command-line-utils.d.ts +0 -1
- package/src/utils/package-json.js +1 -1
- package/src/utils/package-manager.d.ts +0 -1
- package/src/utils/package-manager.js +1 -10
- package/src/utils/project-graph-utils.d.ts +1 -6
- package/src/utils/project-graph-utils.js +6 -11
- package/src/utils/workspace-context.js +1 -1
- package/src/command-line/migrate/run-migration-process.js +0 -85
- package/src/command-line/nx-cloud/fix-ci/command-object.d.ts +0 -2
- package/src/command-line/nx-cloud/fix-ci/command-object.js +0 -12
- package/src/command-line/nx-cloud/fix-ci/fix-ci.d.ts +0 -4
- package/src/command-line/nx-cloud/fix-ci/fix-ci.js +0 -7
- package/src/command-line/nx-cloud/login/login.js +0 -10
- package/src/command-line/nx-cloud/logout/logout.js +0 -7
- package/src/command-line/nx-cloud/record/command-object.d.ts +0 -2
- package/src/command-line/nx-cloud/record/command-object.js +0 -12
- package/src/command-line/nx-cloud/record/record.d.ts +0 -4
- package/src/command-line/nx-cloud/record/record.js +0 -7
- package/src/command-line/nx-cloud/start-ci-run/command-object.d.ts +0 -2
- package/src/command-line/nx-cloud/start-ci-run/command-object.js +0 -12
- package/src/command-line/nx-cloud/start-ci-run/start-ci-run.d.ts +0 -4
- package/src/command-line/nx-cloud/start-ci-run/start-ci-run.js +0 -7
- package/src/command-line/nx-cloud/utils.d.ts +0 -1
- package/src/plugins/js/utils/get-workspace-packages-from-graph.d.ts +0 -2
- package/src/plugins/js/utils/get-workspace-packages-from-graph.js +0 -13
- /package/src/command-line/{nx-cloud/connect → connect}/command-object.d.ts +0 -0
- /package/src/command-line/{nx-cloud/connect → connect}/view-logs.d.ts +0 -0
- /package/src/command-line/{nx-cloud/login → login}/command-object.d.ts +0 -0
- /package/src/command-line/{nx-cloud/login → login}/login.d.ts +0 -0
- /package/src/command-line/{nx-cloud/logout → logout}/command-object.d.ts +0 -0
- /package/src/command-line/{nx-cloud/logout → logout}/logout.d.ts +0 -0
@@ -9,7 +9,6 @@ const semver_1 = require("semver");
|
|
9
9
|
const project_graph_1 = require("../../../config/project-graph");
|
10
10
|
const file_hasher_1 = require("../../../hasher/file-hasher");
|
11
11
|
const object_sort_1 = require("../../../utils/object-sort");
|
12
|
-
const get_workspace_packages_from_graph_1 = require("../utils/get-workspace-packages-from-graph");
|
13
12
|
let currentLockFileHash;
|
14
13
|
let cachedParsedLockFile;
|
15
14
|
// we use key => node map to avoid duplicate work when parsing keys
|
@@ -245,8 +244,7 @@ function stringifyYarnLockfile(graph, rootLockFileContent, packageJson) {
|
|
245
244
|
const { parseSyml, stringifySyml } = require('@yarnpkg/parsers');
|
246
245
|
const { __metadata, ...dependencies } = parseSyml(rootLockFileContent);
|
247
246
|
const isBerry = !!__metadata;
|
248
|
-
const
|
249
|
-
const snapshots = mapSnapshots(dependencies, graph.externalNodes, packageJson, workspaceModules, isBerry);
|
247
|
+
const snapshots = mapSnapshots(dependencies, graph.externalNodes, packageJson, isBerry);
|
250
248
|
if (isBerry) {
|
251
249
|
// add root workspace package
|
252
250
|
const workspacePackage = generateRootWorkspacePackage(packageJson);
|
@@ -295,7 +293,7 @@ function addPackageVersion(packageName, version, collection, isBerry) {
|
|
295
293
|
collection.get(packageName).add(`${packageName}@npm:${version}`);
|
296
294
|
}
|
297
295
|
}
|
298
|
-
function mapSnapshots(rootDependencies, nodes, packageJson,
|
296
|
+
function mapSnapshots(rootDependencies, nodes, packageJson, isBerry) {
|
299
297
|
// map snapshot to set of keys (e.g. `eslint@^7.0.0, eslint@npm:^7.0.0`)
|
300
298
|
const snapshotMap = new Map();
|
301
299
|
// track all existing dependencies's keys
|
@@ -313,7 +311,7 @@ function mapSnapshots(rootDependencies, nodes, packageJson, workspaceModules, is
|
|
313
311
|
const groupedDependencies = groupDependencies(rootDependencies, isBerry);
|
314
312
|
// collect snapshots and their matching keys
|
315
313
|
Object.values(nodes).forEach((node) => {
|
316
|
-
const foundOriginalKeys = findOriginalKeys(groupedDependencies, node
|
314
|
+
const foundOriginalKeys = findOriginalKeys(groupedDependencies, node);
|
317
315
|
if (!foundOriginalKeys) {
|
318
316
|
throw new Error(`Original key(s) not found for "${node.data.packageName}@${node.data.version}" while pruning yarn.lock.`);
|
319
317
|
}
|
@@ -324,7 +322,7 @@ function mapSnapshots(rootDependencies, nodes, packageJson, workspaceModules, is
|
|
324
322
|
Object.entries(section || {}).forEach(([name, versionSpec]) => addPackageVersion(name, versionSpec, existingKeys, isBerry));
|
325
323
|
});
|
326
324
|
// add package.json requested version to keys
|
327
|
-
const requestedVersion = getPackageJsonVersion(combinedDependencies, node
|
325
|
+
const requestedVersion = getPackageJsonVersion(combinedDependencies, node);
|
328
326
|
if (requestedVersion) {
|
329
327
|
addPackageVersion(node.data.packageName, requestedVersion, existingKeys, isBerry);
|
330
328
|
const requestedKey = isBerry
|
@@ -334,7 +332,7 @@ function mapSnapshots(rootDependencies, nodes, packageJson, workspaceModules, is
|
|
334
332
|
snapshotMap.get(snapshot).add(requestedKey);
|
335
333
|
}
|
336
334
|
}
|
337
|
-
const requestedResolutionsVersion = getPackageJsonVersion(resolutions, node
|
335
|
+
const requestedResolutionsVersion = getPackageJsonVersion(resolutions, node);
|
338
336
|
if (requestedResolutionsVersion) {
|
339
337
|
addPackageVersion(node.data.packageName, requestedResolutionsVersion, existingKeys, isBerry);
|
340
338
|
const requestedKey = isBerry
|
@@ -396,11 +394,8 @@ function reverseMapBerryKey(node, version, snapshot) {
|
|
396
394
|
}
|
397
395
|
return `${node.data.packageName}@npm:${version}`;
|
398
396
|
}
|
399
|
-
function getPackageJsonVersion(dependencies, node
|
397
|
+
function getPackageJsonVersion(dependencies, node) {
|
400
398
|
const { packageName, version } = node.data;
|
401
|
-
if (workspaceModules.has(packageName)) {
|
402
|
-
return `file:./workspace_modules/${packageName}`;
|
403
|
-
}
|
404
399
|
if (dependencies[packageName]) {
|
405
400
|
const patchRegex = new RegExp(`^patch:${packageName}@(.*)|#.*$`);
|
406
401
|
// extract the version from the patch or use the full version
|
@@ -421,20 +416,13 @@ function isClassicAlias(node, keys) {
|
|
421
416
|
return (node.data.version.startsWith('npm:') &&
|
422
417
|
keys.some((k) => k === `${node.data.packageName}@${node.data.version}`));
|
423
418
|
}
|
424
|
-
function findOriginalKeys(dependencies, node
|
419
|
+
function findOriginalKeys(dependencies, node) {
|
425
420
|
for (const keyExpr of Object.keys(dependencies)) {
|
426
421
|
const snapshot = dependencies[keyExpr];
|
427
422
|
const keys = keyExpr.split(', ');
|
428
423
|
if (!keys.some((k) => k.startsWith(`${node.data.packageName}@`))) {
|
429
424
|
continue;
|
430
425
|
}
|
431
|
-
if (keys.some((k) => workspaceModules.has(k) || workspaceModules.has(k.split('@file:')[0]))) {
|
432
|
-
const packageName = keys[0].split('@file:')[0];
|
433
|
-
return [
|
434
|
-
[`${packageName}@file:./workspace_modules/${packageName}`],
|
435
|
-
snapshot,
|
436
|
-
];
|
437
|
-
}
|
438
426
|
if (isStandardPackage(snapshot, node.data.version) ||
|
439
427
|
isBerryAlias(snapshot, node.data.version) ||
|
440
428
|
isClassicAlias(node, keys)) {
|
@@ -25,10 +25,7 @@ exports.createNodesV2 = [
|
|
25
25
|
(configFiles, _, context) => {
|
26
26
|
const { packageJsons, projectJsonRoots } = splitConfigFiles(configFiles);
|
27
27
|
const readJson = (f) => (0, fileutils_1.readJsonFile)((0, node_path_1.join)(context.workspaceRoot, f));
|
28
|
-
const isInPackageJsonWorkspaces =
|
29
|
-
!configFiles.includes('package.json')
|
30
|
-
? () => true
|
31
|
-
: buildPackageJsonWorkspacesMatcher(context.workspaceRoot, readJson);
|
28
|
+
const isInPackageJsonWorkspaces = buildPackageJsonWorkspacesMatcher(context.workspaceRoot, readJson);
|
32
29
|
const isNextToProjectJson = (packageJsonPath) => {
|
33
30
|
return projectJsonRoots.has((0, node_path_1.dirname)(packageJsonPath));
|
34
31
|
};
|
@@ -89,7 +89,6 @@ class ForkedProcessTaskRunner {
|
|
89
89
|
if (pseudo_terminal_1.PseudoTerminal.isSupported() &&
|
90
90
|
!disablePseudoTerminal &&
|
91
91
|
(this.tuiEnabled || (streamOutput && !shouldPrefix))) {
|
92
|
-
// Use pseudo-terminal for interactive tasks that can support user input
|
93
92
|
return this.forkProcessWithPseudoTerminal(task, {
|
94
93
|
temporaryOutputPath,
|
95
94
|
streamOutput,
|
@@ -98,9 +97,6 @@ class ForkedProcessTaskRunner {
|
|
98
97
|
});
|
99
98
|
}
|
100
99
|
else {
|
101
|
-
// Use non-interactive process with piped output
|
102
|
-
// Tradeoff: These tasks cannot support interactivity but can still provide
|
103
|
-
// progressive output to the TUI if it's enabled
|
104
100
|
return this.forkProcessWithPrefixAndNotTTY(task, {
|
105
101
|
temporaryOutputPath,
|
106
102
|
streamOutput,
|
@@ -4,7 +4,6 @@ exports.isTuiEnabled = isTuiEnabled;
|
|
4
4
|
exports.shouldUseTui = shouldUseTui;
|
5
5
|
const native_1 = require("../native");
|
6
6
|
const is_ci_1 = require("../utils/is-ci");
|
7
|
-
const logger_1 = require("../utils/logger");
|
8
7
|
let tuiEnabled = undefined;
|
9
8
|
/**
|
10
9
|
* @returns If tui is enabled
|
@@ -26,13 +25,6 @@ function shouldUseTui(nxJson, nxArgs, skipCapabilityCheck = process.env.NX_TUI_S
|
|
26
25
|
// If the current terminal/environment is not capable of displaying the TUI, we don't run it
|
27
26
|
const isWindows = process.platform === 'win32';
|
28
27
|
const isCapable = skipCapabilityCheck || (process.stderr.isTTY && isUnicodeSupported());
|
29
|
-
if (typeof nxArgs.tui === 'boolean') {
|
30
|
-
if (nxArgs.tui && !isCapable) {
|
31
|
-
logger_1.logger.warn('Nx Terminal UI was not enabled as it is not supported in this environment.');
|
32
|
-
return false;
|
33
|
-
}
|
34
|
-
return nxArgs.tui;
|
35
|
-
}
|
36
28
|
if (!isCapable) {
|
37
29
|
return false;
|
38
30
|
}
|
@@ -128,7 +128,7 @@ async function getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, pr
|
|
128
128
|
const lifeCycles = [tsLifeCycle];
|
129
129
|
// Only run the TUI if there are tasks to run
|
130
130
|
if (tasks.length > 0) {
|
131
|
-
appLifeCycle = new AppLifeCycle(tasks, initiatingTasks.map((t) => t.id), isRunOne ? 0 /* RunMode.RunOne */ : 1 /* RunMode.RunMany */, pinnedTasks, nxArgs ?? {}, nxJson.tui ?? {}, titleText, workspace_root_1.workspaceRoot
|
131
|
+
appLifeCycle = new AppLifeCycle(tasks, initiatingTasks.map((t) => t.id), isRunOne ? 0 /* RunMode.RunOne */ : 1 /* RunMode.RunMany */, pinnedTasks, nxArgs ?? {}, nxJson.tui ?? {}, titleText, workspace_root_1.workspaceRoot);
|
132
132
|
lifeCycles.unshift(appLifeCycle);
|
133
133
|
/**
|
134
134
|
* Patch stdout.write and stderr.write methods to pass Nx Cloud client logs to the TUI via the lifecycle
|
@@ -4,14 +4,12 @@ export declare class NodeChildProcessWithNonDirectOutput implements RunningTask
|
|
4
4
|
private childProcess;
|
5
5
|
private terminalOutput;
|
6
6
|
private exitCallbacks;
|
7
|
-
private outputCallbacks;
|
8
7
|
private exitCode;
|
9
8
|
constructor(childProcess: ChildProcess, { streamOutput, prefix }: {
|
10
9
|
streamOutput: boolean;
|
11
10
|
prefix: string;
|
12
11
|
});
|
13
12
|
onExit(cb: (code: number, terminalOutput: string) => void): void;
|
14
|
-
onOutput(cb: (output: string) => void): void;
|
15
13
|
getResults(): Promise<{
|
16
14
|
code: number;
|
17
15
|
terminalOutput: string;
|
@@ -10,7 +10,6 @@ class NodeChildProcessWithNonDirectOutput {
|
|
10
10
|
this.childProcess = childProcess;
|
11
11
|
this.terminalOutput = '';
|
12
12
|
this.exitCallbacks = [];
|
13
|
-
this.outputCallbacks = [];
|
14
13
|
if (streamOutput) {
|
15
14
|
if (process.env.NX_PREFIX_OUTPUT === 'true') {
|
16
15
|
const color = getColor(prefix);
|
@@ -48,28 +47,15 @@ class NodeChildProcessWithNonDirectOutput {
|
|
48
47
|
}
|
49
48
|
});
|
50
49
|
this.childProcess.stdout.on('data', (chunk) => {
|
51
|
-
|
52
|
-
this.terminalOutput += output;
|
53
|
-
// Stream output to TUI via callbacks
|
54
|
-
for (const cb of this.outputCallbacks) {
|
55
|
-
cb(output);
|
56
|
-
}
|
50
|
+
this.terminalOutput += chunk.toString();
|
57
51
|
});
|
58
52
|
this.childProcess.stderr.on('data', (chunk) => {
|
59
|
-
|
60
|
-
this.terminalOutput += output;
|
61
|
-
// Stream output to TUI via callbacks
|
62
|
-
for (const cb of this.outputCallbacks) {
|
63
|
-
cb(output);
|
64
|
-
}
|
53
|
+
this.terminalOutput += chunk.toString();
|
65
54
|
});
|
66
55
|
}
|
67
56
|
onExit(cb) {
|
68
57
|
this.exitCallbacks.push(cb);
|
69
58
|
}
|
70
|
-
onOutput(cb) {
|
71
|
-
this.outputCallbacks.push(cb);
|
72
|
-
}
|
73
59
|
async getResults() {
|
74
60
|
if (typeof this.exitCode === 'number') {
|
75
61
|
return {
|
@@ -398,18 +398,12 @@ class TaskOrchestrator {
|
|
398
398
|
this.options.lifeCycle.appendTaskOutput(task.id, output, true);
|
399
399
|
});
|
400
400
|
}
|
401
|
-
else if ('onOutput' in runningTask
|
402
|
-
typeof runningTask.onOutput === 'function') {
|
403
|
-
// Register task that can provide progressive output but isn't interactive (e.g., NodeChildProcessWithNonDirectOutput)
|
401
|
+
else if ('onOutput' in runningTask) {
|
404
402
|
this.options.lifeCycle.registerRunningTaskWithEmptyParser(task.id);
|
405
403
|
runningTask.onOutput((output) => {
|
406
404
|
this.options.lifeCycle.appendTaskOutput(task.id, output, false);
|
407
405
|
});
|
408
406
|
}
|
409
|
-
else {
|
410
|
-
// Fallback for tasks that don't support progressive output
|
411
|
-
this.options.lifeCycle.registerRunningTaskWithEmptyParser(task.id);
|
412
|
-
}
|
413
407
|
}
|
414
408
|
return runningTask;
|
415
409
|
}
|
@@ -124,7 +124,7 @@ function readTargetsFromPackageJson(packageJson, nxJson, projectRoot, workspaceR
|
|
124
124
|
function hasNxJsPlugin(projectRoot, workspaceRoot) {
|
125
125
|
try {
|
126
126
|
// nx-ignore-next-line
|
127
|
-
require.resolve('@nx/js
|
127
|
+
require.resolve('@nx/js', {
|
128
128
|
paths: [projectRoot, ...(0, installation_directory_1.getNxRequirePaths)(workspaceRoot), __dirname],
|
129
129
|
});
|
130
130
|
return true;
|
@@ -12,7 +12,6 @@ export interface PackageManagerCommands {
|
|
12
12
|
list: string;
|
13
13
|
run: (script: string, args?: string) => string;
|
14
14
|
getRegistryUrl?: string;
|
15
|
-
publish: (packageRoot: string, registry: string, registryConfigKey: string, tag: string) => string;
|
16
15
|
}
|
17
16
|
/**
|
18
17
|
* Detects which package manager is used in the workspace based on the lock file.
|
@@ -102,23 +102,18 @@ function getPackageManagerCommand(packageManager = detectPackageManager(), root
|
|
102
102
|
getRegistryUrl: useBerry
|
103
103
|
? 'yarn config get npmRegistryServer'
|
104
104
|
: 'yarn config get registry',
|
105
|
-
publish: (packageRoot, registry, registryConfigKey, tag) => `npm publish "${packageRoot}" --json --"${registryConfigKey}=${registry}" --tag=${tag}`,
|
106
105
|
};
|
107
106
|
},
|
108
107
|
pnpm: () => {
|
109
|
-
let modernPnpm, includeDoubleDashBeforeArgs
|
108
|
+
let modernPnpm, includeDoubleDashBeforeArgs;
|
110
109
|
try {
|
111
110
|
const pnpmVersion = getPackageManagerVersion('pnpm', root);
|
112
111
|
modernPnpm = (0, semver_1.gte)(pnpmVersion, '6.13.0');
|
113
112
|
includeDoubleDashBeforeArgs = (0, semver_1.lt)(pnpmVersion, '7.0.0');
|
114
|
-
// Support for --@scope:registry was added in pnpm v10.5.0 and backported to v9.15.7.
|
115
|
-
// Versions >=10.0.0 and <10.5.0 do NOT support this CLI option.
|
116
|
-
allowRegistryConfigKey = (0, semver_1.satisfies)(pnpmVersion, '>=9.15.7 <10.0.0 || >=10.5.0');
|
117
113
|
}
|
118
114
|
catch {
|
119
115
|
modernPnpm = true;
|
120
116
|
includeDoubleDashBeforeArgs = true;
|
121
|
-
allowRegistryConfigKey = false;
|
122
117
|
}
|
123
118
|
const isPnpmWorkspace = (0, fs_1.existsSync)((0, path_1.join)(root, 'pnpm-workspace.yaml'));
|
124
119
|
return {
|
@@ -137,7 +132,6 @@ function getPackageManagerCommand(packageManager = detectPackageManager(), root
|
|
137
132
|
: ''}`,
|
138
133
|
list: 'pnpm ls --depth 100',
|
139
134
|
getRegistryUrl: 'pnpm config get registry',
|
140
|
-
publish: (packageRoot, registry, registryConfigKey, tag) => `pnpm publish "${packageRoot}" --json --"${allowRegistryConfigKey ? registryConfigKey : 'registry'}=${registry}" --tag=${tag} --no-git-checks`,
|
141
135
|
};
|
142
136
|
},
|
143
137
|
npm: () => {
|
@@ -155,7 +149,6 @@ function getPackageManagerCommand(packageManager = detectPackageManager(), root
|
|
155
149
|
run: (script, args) => `npm run ${script}${args ? ' -- ' + args : ''}`,
|
156
150
|
list: 'npm ls',
|
157
151
|
getRegistryUrl: 'npm config get registry',
|
158
|
-
publish: (packageRoot, registry, registryConfigKey, tag) => `npm publish "${packageRoot}" --json --"${registryConfigKey}=${registry}" --tag=${tag}`,
|
159
152
|
};
|
160
153
|
},
|
161
154
|
bun: () => {
|
@@ -171,8 +164,6 @@ function getPackageManagerCommand(packageManager = detectPackageManager(), root
|
|
171
164
|
dlx: 'bunx',
|
172
165
|
run: (script, args) => `bun run ${script} -- ${args}`,
|
173
166
|
list: 'bun pm ls',
|
174
|
-
// Unlike npm, bun publish does not support a custom registryConfigKey option
|
175
|
-
publish: (packageRoot, registry, registryConfigKey, tag) => `bun publish --cwd="${packageRoot}" --json --registry="${registry}" --tag=${tag}`,
|
176
167
|
};
|
177
168
|
},
|
178
169
|
};
|
@@ -1,11 +1,7 @@
|
|
1
1
|
import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
|
2
|
-
import type { ProjectConfiguration } from '../config/workspace-json-project-json';
|
3
2
|
export declare function projectHasTarget(project: ProjectGraphProjectNode, target: string): boolean;
|
4
3
|
export declare function projectHasTargetAndConfiguration(project: ProjectGraphProjectNode, target: string, configuration: string): any;
|
5
|
-
export declare function getSourceDirOfDependentProjects(projectName: string, projectGraph?: ProjectGraph): [
|
6
|
-
projectDirs: string[],
|
7
|
-
warnings: string[]
|
8
|
-
];
|
4
|
+
export declare function getSourceDirOfDependentProjects(projectName: string, projectGraph?: ProjectGraph): [projectDirs: string[], warnings: string[]];
|
9
5
|
/**
|
10
6
|
* Find all internal project dependencies.
|
11
7
|
* All the external (npm) dependencies will be filtered out unless includeExternalDependencies is set to true
|
@@ -15,4 +11,3 @@ export declare function getSourceDirOfDependentProjects(projectName: string, pro
|
|
15
11
|
* @returns {string[]}
|
16
12
|
*/
|
17
13
|
export declare function findAllProjectNodeDependencies(parentNodeName: string, projectGraph?: ProjectGraph, includeExternalDependencies?: boolean): string[];
|
18
|
-
export declare function getProjectSourceRoot(project: ProjectConfiguration): string | undefined;
|
@@ -4,9 +4,6 @@ exports.projectHasTarget = projectHasTarget;
|
|
4
4
|
exports.projectHasTargetAndConfiguration = projectHasTargetAndConfiguration;
|
5
5
|
exports.getSourceDirOfDependentProjects = getSourceDirOfDependentProjects;
|
6
6
|
exports.findAllProjectNodeDependencies = findAllProjectNodeDependencies;
|
7
|
-
exports.getProjectSourceRoot = getProjectSourceRoot;
|
8
|
-
const node_fs_1 = require("node:fs");
|
9
|
-
const node_path_1 = require("node:path");
|
10
7
|
const project_graph_1 = require("../project-graph/project-graph");
|
11
8
|
function projectHasTarget(project, target) {
|
12
9
|
return !!(project.data &&
|
@@ -24,8 +21,12 @@ function getSourceDirOfDependentProjects(projectName, projectGraph = (0, project
|
|
24
21
|
}
|
25
22
|
const nodeNames = findAllProjectNodeDependencies(projectName, projectGraph);
|
26
23
|
return nodeNames.reduce((result, nodeName) => {
|
27
|
-
|
28
|
-
|
24
|
+
if (projectGraph.nodes[nodeName].data.sourceRoot) {
|
25
|
+
result[0].push(projectGraph.nodes[nodeName].data.sourceRoot);
|
26
|
+
}
|
27
|
+
else {
|
28
|
+
result[1].push(nodeName);
|
29
|
+
}
|
29
30
|
return result;
|
30
31
|
}, [[], []]);
|
31
32
|
}
|
@@ -70,9 +71,3 @@ function collectDependentProjectNodesNames(nxDeps, dependencyNodeNames, parentNo
|
|
70
71
|
collectDependentProjectNodesNames(nxDeps, dependencyNodeNames, dependencyName, includeExternalDependencies);
|
71
72
|
}
|
72
73
|
}
|
73
|
-
function getProjectSourceRoot(project) {
|
74
|
-
return (project.sourceRoot ??
|
75
|
-
((0, node_fs_1.existsSync)(node_path_1.posix.join(project.root, 'src'))
|
76
|
-
? node_path_1.posix.join(project.root, 'src')
|
77
|
-
: project.root));
|
78
|
-
}
|
@@ -44,7 +44,7 @@ function globWithWorkspaceContextSync(workspaceRoot, globs, exclude) {
|
|
44
44
|
return workspaceContext.glob(globs, exclude);
|
45
45
|
}
|
46
46
|
async function globWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
47
|
-
if (
|
47
|
+
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
48
48
|
ensureContextAvailable(workspaceRoot);
|
49
49
|
return workspaceContext.glob(globs, exclude);
|
50
50
|
}
|
@@ -1,85 +0,0 @@
|
|
1
|
-
const { runNxOrAngularMigration } = require('./migrate');
|
2
|
-
const { execSync } = require('child_process');
|
3
|
-
|
4
|
-
async function runMigrationProcess() {
|
5
|
-
const [
|
6
|
-
,
|
7
|
-
,
|
8
|
-
workspacePath,
|
9
|
-
migrationId,
|
10
|
-
migrationPackage,
|
11
|
-
migrationName,
|
12
|
-
migrationVersion,
|
13
|
-
createCommits,
|
14
|
-
commitPrefix,
|
15
|
-
] = process.argv;
|
16
|
-
|
17
|
-
const migration = {
|
18
|
-
id: migrationId,
|
19
|
-
package: migrationPackage,
|
20
|
-
name: migrationName,
|
21
|
-
version: migrationVersion,
|
22
|
-
};
|
23
|
-
|
24
|
-
const configuration = {
|
25
|
-
createCommits: createCommits === 'true',
|
26
|
-
commitPrefix: commitPrefix || 'chore: [nx migration] ',
|
27
|
-
};
|
28
|
-
|
29
|
-
try {
|
30
|
-
const gitRefBefore = execSync('git rev-parse HEAD', {
|
31
|
-
cwd: workspacePath,
|
32
|
-
encoding: 'utf-8',
|
33
|
-
}).trim();
|
34
|
-
|
35
|
-
const { changes: fileChanges, nextSteps } = await runNxOrAngularMigration(
|
36
|
-
workspacePath,
|
37
|
-
migration,
|
38
|
-
false,
|
39
|
-
configuration.createCommits,
|
40
|
-
configuration.commitPrefix,
|
41
|
-
undefined,
|
42
|
-
true
|
43
|
-
);
|
44
|
-
|
45
|
-
const gitRefAfter = execSync('git rev-parse HEAD', {
|
46
|
-
cwd: workspacePath,
|
47
|
-
encoding: 'utf-8',
|
48
|
-
}).trim();
|
49
|
-
|
50
|
-
// Report success
|
51
|
-
process.stdout.write(
|
52
|
-
JSON.stringify({
|
53
|
-
type: 'success',
|
54
|
-
fileChanges: fileChanges.map((change) => ({
|
55
|
-
path: change.path,
|
56
|
-
type: change.type,
|
57
|
-
})),
|
58
|
-
gitRefAfter,
|
59
|
-
nextSteps,
|
60
|
-
})
|
61
|
-
);
|
62
|
-
|
63
|
-
process.exit(0);
|
64
|
-
} catch (error) {
|
65
|
-
// Report failure
|
66
|
-
process.stdout.write(
|
67
|
-
JSON.stringify({
|
68
|
-
type: 'error',
|
69
|
-
message: error.message,
|
70
|
-
})
|
71
|
-
);
|
72
|
-
|
73
|
-
process.exit(1);
|
74
|
-
}
|
75
|
-
}
|
76
|
-
|
77
|
-
runMigrationProcess().catch((error) => {
|
78
|
-
process.stdout.write(
|
79
|
-
JSON.stringify({
|
80
|
-
type: 'error',
|
81
|
-
message: error.message,
|
82
|
-
})
|
83
|
-
);
|
84
|
-
process.exit(1);
|
85
|
-
});
|
@@ -1,12 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.yargsFixCiCommand = void 0;
|
4
|
-
const shared_options_1 = require("../../yargs-utils/shared-options");
|
5
|
-
exports.yargsFixCiCommand = {
|
6
|
-
command: 'fix-ci [options]',
|
7
|
-
describe: 'Fixes CI failures. This command is an alias for [`nx-cloud fix-ci`](/ci/reference/nx-cloud-cli#npx-nxcloud-fix-ci).',
|
8
|
-
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs),
|
9
|
-
handler: async (args) => {
|
10
|
-
process.exit(await (await Promise.resolve().then(() => require('./fix-ci'))).fixCiHandler(args));
|
11
|
-
},
|
12
|
-
};
|
@@ -1,10 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.loginHandler = loginHandler;
|
4
|
-
const utils_1 = require("../utils");
|
5
|
-
function loginHandler(args) {
|
6
|
-
if (args.nxCloudUrl) {
|
7
|
-
process.env.NX_CLOUD_API = args.nxCloudUrl;
|
8
|
-
}
|
9
|
-
return (0, utils_1.executeNxCloudCommand)('login', args.verbose);
|
10
|
-
}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.yargsRecordCommand = void 0;
|
4
|
-
const shared_options_1 = require("../../yargs-utils/shared-options");
|
5
|
-
exports.yargsRecordCommand = {
|
6
|
-
command: 'record [options]',
|
7
|
-
describe: 'Records a command execution for distributed task execution. This command is an alias for [`nx-cloud record`](/ci/reference/nx-cloud-cli#npx-nxcloud-record).',
|
8
|
-
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs),
|
9
|
-
handler: async (args) => {
|
10
|
-
process.exit(await (await Promise.resolve().then(() => require('./record'))).recordHandler(args));
|
11
|
-
},
|
12
|
-
};
|
@@ -1,12 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.yargsStartCiRunCommand = void 0;
|
4
|
-
const shared_options_1 = require("../../yargs-utils/shared-options");
|
5
|
-
exports.yargsStartCiRunCommand = {
|
6
|
-
command: 'start-ci-run [options]',
|
7
|
-
describe: 'Starts a new CI run for distributed task execution. This command is an alias for [`nx-cloud start-ci-run`](/ci/reference/nx-cloud-cli#npx-nxcloud-start-ci-run).',
|
8
|
-
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs),
|
9
|
-
handler: async (args) => {
|
10
|
-
process.exit(await (await Promise.resolve().then(() => require('./start-ci-run'))).startCiRunHandler(args));
|
11
|
-
},
|
12
|
-
};
|
@@ -1,7 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.startCiRunHandler = startCiRunHandler;
|
4
|
-
const utils_1 = require("../utils");
|
5
|
-
function startCiRunHandler(args) {
|
6
|
-
return (0, utils_1.executeNxCloudCommand)('start-ci-run', args.verbose);
|
7
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare function executeNxCloudCommand(commandName: string, verbose?: boolean): Promise<number>;
|
@@ -1,13 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getWorkspacePackagesFromGraph = getWorkspacePackagesFromGraph;
|
4
|
-
function getWorkspacePackagesFromGraph(graph) {
|
5
|
-
const workspacePackages = new Map();
|
6
|
-
for (const [projectName, project] of Object.entries(graph.nodes)) {
|
7
|
-
const pkgName = project.data?.metadata?.js?.packageName;
|
8
|
-
if (pkgName) {
|
9
|
-
workspacePackages.set(pkgName, project);
|
10
|
-
}
|
11
|
-
}
|
12
|
-
return workspacePackages;
|
13
|
-
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|