nx 24.0.2 → 24.0.4
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-cloud.js +9 -0
- package/dist/release/changelog-renderer/index.js +12 -5
- package/dist/src/ai/clone-ai-config-repo.d.ts +2 -1
- package/dist/src/ai/clone-ai-config-repo.js +48 -11
- package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +37 -8
- package/dist/src/analytics/analytics.js +7 -2
- package/dist/src/command-line/ai/ai-output.js +3 -3
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +2 -2
- package/dist/src/command-line/graph/graph.d.ts +10 -0
- package/dist/src/command-line/graph/graph.js +61 -2
- package/dist/src/command-line/import/import.js +18 -30
- package/dist/src/command-line/import/utils/merge-remote-source.d.ts +1 -0
- package/dist/src/command-line/import/utils/merge-remote-source.js +10 -1
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +17 -5
- package/dist/src/command-line/init/init-v1.js +2 -2
- package/dist/src/command-line/init/init-v2.js +4 -4
- package/dist/src/command-line/migrate/migrate-analytics.js +2 -2
- package/dist/src/command-line/migrate/migrate.d.ts +3 -0
- package/dist/src/command-line/migrate/migrate.js +40 -22
- package/dist/src/command-line/migrate/workspace-installation.d.ts +15 -0
- package/dist/src/command-line/migrate/workspace-installation.js +73 -0
- package/dist/src/command-line/nx-cloud/complete-run/command-object.js +1 -1
- package/dist/src/command-line/nx-cloud/fix-ci/command-object.js +1 -1
- package/dist/src/command-line/nx-cloud/logout/command-object.js +11 -2
- package/dist/src/command-line/nx-cloud/record/command-object.js +1 -1
- package/dist/src/command-line/nx-cloud/record/record.js +3 -2
- package/dist/src/command-line/nx-cloud/start-ci-run/command-object.js +1 -1
- package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.js +1 -1
- package/dist/src/command-line/nx-commands.js +3 -1
- package/dist/src/command-line/release/changelog/version-plan-filtering.js +4 -1
- package/dist/src/command-line/release/changelog.js +8 -3
- package/dist/src/command-line/release/config/version-plans.js +29 -29
- package/dist/src/command-line/release/utils/git.d.ts +2 -0
- package/dist/src/command-line/release/utils/git.js +49 -26
- package/dist/src/command-line/release/utils/markdown.js +4 -1
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +18 -7
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +3 -1
- package/dist/src/command-line/release/version/derive-specifier-from-conventional-commits.js +1 -1
- package/dist/src/command-line/release/version/version-actions.js +2 -1
- package/dist/src/command-line/release/version.js +2 -1
- package/dist/src/command-line/show/show-target/info.d.ts +1 -1
- package/dist/src/command-line/show/show-target/info.js +4 -4
- package/dist/src/core/graph/favicon.ico +0 -0
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/server/latest-nx.js +2 -2
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +3 -1
- package/dist/src/executors/run-commands/running-tasks.js +7 -0
- package/dist/src/executors/run-commands/schema.json +1 -1
- package/dist/src/hasher/native-task-hasher-impl.js +5 -2
- package/dist/src/native/index.d.ts +11 -1
- package/dist/src/native/index.js +12 -17
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +5 -6
- package/dist/src/nx-cloud/update-manager.d.ts +2 -0
- package/dist/src/nx-cloud/utilities/client.d.ts +1 -0
- package/dist/src/nx-cloud/utilities/client.js +5 -0
- package/dist/src/nx-cloud/utilities/get-cloud-options.d.ts +1 -1
- package/dist/src/nx-cloud/utilities/get-cloud-options.js +5 -2
- package/dist/src/nx-cloud/utilities/is-workspace-claimed.js +1 -1
- package/dist/src/nx-cloud/utilities/url-shorten.d.ts +1 -1
- package/dist/src/nx-cloud/utilities/url-shorten.js +4 -4
- package/dist/src/plugins/js/lock-file/yarn-parser.js +49 -2
- package/dist/src/plugins/js/project-graph/build-dependencies/build-dependencies.js +2 -1
- package/dist/src/plugins/js/utils/register.js +3 -2
- package/dist/src/plugins/js/utils/typescript.js +3 -2
- package/dist/src/project-graph/utils/retrieve-workspace-files.js +2 -2
- package/dist/src/tasks-runner/cache.js +24 -8
- package/dist/src/tasks-runner/default-tasks-runner.js +21 -13
- package/dist/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +34 -13
- package/dist/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +26 -5
- package/dist/src/tasks-runner/life-cycles/performance-report.js +2 -2
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +1 -1
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +1 -1
- package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.js +3 -3
- package/dist/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +76 -39
- package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +2 -2
- package/dist/src/tasks-runner/running-tasks/batch-process.js +1 -1
- package/dist/src/tasks-runner/task-orchestrator.d.ts +6 -3
- package/dist/src/tasks-runner/task-orchestrator.js +61 -29
- package/dist/src/utils/git-utils.js +3 -3
- package/dist/src/utils/git-utils.tree-filter.js +102 -24
- package/dist/src/utils/installation-directory.d.ts +8 -0
- package/dist/src/utils/installation-directory.js +13 -0
- package/dist/src/utils/package-manager.d.ts +9 -3
- package/dist/src/utils/package-manager.js +64 -34
- package/dist/src/utils/provenance.d.ts +14 -1
- package/dist/src/utils/provenance.js +44 -13
- package/dist/src/utils/redact-url-credentials.d.ts +1 -0
- package/dist/src/utils/redact-url-credentials.js +7 -0
- package/dist/src/utils/workspace-id.d.ts +4 -3
- package/dist/src/utils/workspace-id.js +4 -3
- package/package.json +12 -12
|
@@ -10,6 +10,7 @@ const object_sort_1 = require("../../../../utils/object-sort");
|
|
|
10
10
|
const output_1 = require("../../../../utils/output");
|
|
11
11
|
const package_json_1 = require("../../../../utils/package-json");
|
|
12
12
|
const package_manager_1 = require("../../../../utils/package-manager");
|
|
13
|
+
const provenance_1 = require("../../../../utils/provenance");
|
|
13
14
|
const connect_to_nx_cloud_1 = require("../../../nx-cloud/connect/connect-to-nx-cloud");
|
|
14
15
|
const utils_1 = require("../utils");
|
|
15
16
|
const format_1 = require("../format");
|
|
@@ -81,11 +82,22 @@ async function getLegacyMigrationFunctionIfApplicable(repoRoot, options) {
|
|
|
81
82
|
legacyMigrationCommand = `ng g ${pkgName}:ng-add ${preserveAngularCliLayoutFlag}`;
|
|
82
83
|
}
|
|
83
84
|
else {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
try {
|
|
86
|
+
// use the latest Nx version that supported the Angular version
|
|
87
|
+
pkgVersion = await (0, package_manager_1.resolvePackageVersionUsingRegistry)('nx', nxAngularLegacyVersionMap[majorAngularVersion]);
|
|
88
|
+
pkgScope = (0, semver_1.gte)(pkgVersion, versionWithRescopeToNx) ? '@nx' : '@nrwl';
|
|
89
|
+
unscopedPkgName = 'angular';
|
|
90
|
+
pkgName = `${pkgScope}/${unscopedPkgName}`;
|
|
91
|
+
for (const pkg of ['nx', `${pkgScope}/workspace`, pkgName]) {
|
|
92
|
+
await (0, provenance_1.ensurePackageHasProvenance)(pkg, pkgVersion);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
// errors are caught in the initHandler and not logged to the user, so we
|
|
97
|
+
// log it first and then throw to ensure it is logged to the user
|
|
98
|
+
output_1.output.error({ title: e.message });
|
|
99
|
+
throw e;
|
|
100
|
+
}
|
|
89
101
|
legacyMigrationCommand = `nx@${pkgVersion} init ${process.argv
|
|
90
102
|
.slice(2)
|
|
91
103
|
.join(' ')}`;
|
|
@@ -4,7 +4,6 @@ exports.initHandler = initHandler;
|
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const prompt_helpers_1 = require("../../utils/prompt-helpers");
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
|
-
const semver_1 = require("semver");
|
|
8
7
|
const add_nx_to_monorepo_1 = require("./implementation/add-nx-to-monorepo");
|
|
9
8
|
const add_nx_to_nest_1 = require("./implementation/add-nx-to-nest");
|
|
10
9
|
const add_nx_to_npm_repo_1 = require("./implementation/add-nx-to-npm-repo");
|
|
@@ -18,7 +17,8 @@ const format_1 = require("./implementation/format");
|
|
|
18
17
|
async function initHandler(options) {
|
|
19
18
|
// strip the 'init' command itself so we don't forward it
|
|
20
19
|
const args = process.argv.slice(3).join(' ');
|
|
21
|
-
|
|
20
|
+
// Resolving `latest` here would install a version nothing has verified.
|
|
21
|
+
const version = process.env.NX_VERSION ?? versions_1.nxVersion;
|
|
22
22
|
if (process.env.NX_VERSION) {
|
|
23
23
|
console.log(`Using version ${process.env.NX_VERSION}`);
|
|
24
24
|
}
|
|
@@ -6,7 +6,6 @@ exports.detectPlugins = detectPlugins;
|
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const prompt_helpers_1 = require("../../utils/prompt-helpers");
|
|
9
|
-
const semver_1 = require("semver");
|
|
10
9
|
const nx_json_1 = require("../../config/nx-json");
|
|
11
10
|
const fileutils_1 = require("../../utils/fileutils");
|
|
12
11
|
const get_package_name_from_import_path_1 = require("../../utils/get-package-name-from-import-path");
|
|
@@ -45,8 +44,8 @@ async function initHandler(options, inner = false) {
|
|
|
45
44
|
}
|
|
46
45
|
let cleanup;
|
|
47
46
|
try {
|
|
48
|
-
await (0, provenance_1.
|
|
49
|
-
const packageInstallResults = (0, package_json_1.installPackageToTmp)('nx',
|
|
47
|
+
const version = await (0, provenance_1.resolveVersionWithProvenance)('nx', 'latest', process.cwd());
|
|
48
|
+
const packageInstallResults = (0, package_json_1.installPackageToTmp)('nx', version, (0, package_manager_1.detectPackageManager)(process.cwd()));
|
|
50
49
|
cleanup = packageInstallResults.cleanup;
|
|
51
50
|
let modulePath = require.resolve('nx/src/command-line/init/init-v2.js', {
|
|
52
51
|
paths: [packageInstallResults.tempDir],
|
|
@@ -116,7 +115,8 @@ async function initHandlerImpl(options) {
|
|
|
116
115
|
}
|
|
117
116
|
}
|
|
118
117
|
async function runInit(options, baseMeta) {
|
|
119
|
-
|
|
118
|
+
// Resolving `latest` here would install a version nothing has verified.
|
|
119
|
+
const version = process.env.NX_VERSION ?? versions_1.nxVersion;
|
|
120
120
|
if (process.env.NX_VERSION) {
|
|
121
121
|
output_1.output.log({ title: `Using version ${process.env.NX_VERSION}` });
|
|
122
122
|
}
|
|
@@ -27,7 +27,7 @@ exports.safeReport = safeReport;
|
|
|
27
27
|
const semver_1 = require("semver");
|
|
28
28
|
const analytics_1 = require("../../analytics");
|
|
29
29
|
const provenance_1 = require("../../utils/provenance");
|
|
30
|
-
const
|
|
30
|
+
const workspace_installation_1 = require("./workspace-installation");
|
|
31
31
|
// Identifier-shaped tokens only (Node codes like ENOENT, class names like
|
|
32
32
|
// TypeError). Rejects anything with a slash, space, or punctuation so a
|
|
33
33
|
// settable `.code`/`.name` can't smuggle a path or message into GA.
|
|
@@ -347,7 +347,7 @@ function reportMigrateSingleMigrationAbandoned(opts) {
|
|
|
347
347
|
// workspace-local installation; same signal as the run-phase re-dispatch
|
|
348
348
|
// check in migrate.ts.
|
|
349
349
|
function cliSource() {
|
|
350
|
-
return
|
|
350
|
+
return (0, workspace_installation_1.isRunningWorkspaceNx)() ? 'local' : 'temp-latest';
|
|
351
351
|
}
|
|
352
352
|
// `coerce` tolerates ranges and partial versions from package.json entries
|
|
353
353
|
// (e.g. `^21.0.0`); dist-tags that never resolved coerce to null.
|
|
@@ -67,6 +67,7 @@ export declare class Migrator {
|
|
|
67
67
|
private readonly promptAnswers;
|
|
68
68
|
private readonly pendingPackageJsonUpdates;
|
|
69
69
|
private readonly appliedPackageJsonUpdates;
|
|
70
|
+
private readonly uninstalledDeclaredPackages;
|
|
70
71
|
private readonly nxInstallation;
|
|
71
72
|
private minVersionWithSkippedUpdates;
|
|
72
73
|
constructor(opts: MigratorOptions);
|
|
@@ -86,8 +87,10 @@ export declare class Migrator {
|
|
|
86
87
|
name: string;
|
|
87
88
|
}[];
|
|
88
89
|
promptContents?: Record<string, string>;
|
|
90
|
+
uninstalledDeclaredPackages?: string[];
|
|
89
91
|
minVersionWithSkippedUpdates: string;
|
|
90
92
|
}>;
|
|
93
|
+
private getDeclaredDependencies;
|
|
91
94
|
private createMigrateJson;
|
|
92
95
|
private buildPackageJsonUpdates;
|
|
93
96
|
private applyPackageJsonUpdate;
|
|
@@ -54,6 +54,7 @@ const catalog_1 = require("../../utils/catalog");
|
|
|
54
54
|
const migrate_analytics_1 = require("./migrate-analytics");
|
|
55
55
|
const multi_major_1 = require("./multi-major");
|
|
56
56
|
const prompt_files_1 = require("./prompt-files");
|
|
57
|
+
const workspace_installation_1 = require("./workspace-installation");
|
|
57
58
|
const command_object_1 = require("./command-object");
|
|
58
59
|
const migrate_config_1 = require("./migrate-config");
|
|
59
60
|
const types_1 = require("./agentic/types");
|
|
@@ -125,6 +126,7 @@ class Migrator {
|
|
|
125
126
|
this.promptAnswers = {};
|
|
126
127
|
this.pendingPackageJsonUpdates = new Map();
|
|
127
128
|
this.appliedPackageJsonUpdates = new Set();
|
|
129
|
+
this.uninstalledDeclaredPackages = new Set();
|
|
128
130
|
if ((opts.include === 'required' || opts.include === 'optional') &&
|
|
129
131
|
!opts.requiredPackages) {
|
|
130
132
|
throw new Error(`Error: 'requiredPackages' is required when 'include' is '${opts.include}'.`);
|
|
@@ -159,9 +161,20 @@ class Migrator {
|
|
|
159
161
|
packageUpdates: this.packageUpdates,
|
|
160
162
|
migrations,
|
|
161
163
|
...(Object.keys(promptContents).length > 0 ? { promptContents } : {}),
|
|
164
|
+
...(this.uninstalledDeclaredPackages.size > 0
|
|
165
|
+
? { uninstalledDeclaredPackages: [...this.uninstalledDeclaredPackages] }
|
|
166
|
+
: {}),
|
|
162
167
|
minVersionWithSkippedUpdates: this.minVersionWithSkippedUpdates,
|
|
163
168
|
};
|
|
164
169
|
}
|
|
170
|
+
getDeclaredDependencies() {
|
|
171
|
+
return {
|
|
172
|
+
...this.packageJson?.dependencies,
|
|
173
|
+
...this.packageJson?.devDependencies,
|
|
174
|
+
...this.nxInstallation?.plugins,
|
|
175
|
+
...(this.nxInstallation && { nx: this.nxInstallation.version }),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
165
178
|
async createMigrateJson(requiredPackageUpdates) {
|
|
166
179
|
const promptContents = {};
|
|
167
180
|
const collect = async (packageName, metadataVersion, fromVersion, toVersion) => {
|
|
@@ -288,6 +301,9 @@ class Migrator {
|
|
|
288
301
|
targetVersion = this.to[targetPackage];
|
|
289
302
|
}
|
|
290
303
|
if (!this.getPkgVersion(targetPackage)) {
|
|
304
|
+
if (this.getDeclaredDependencies()[targetPackage]) {
|
|
305
|
+
this.uninstalledDeclaredPackages.add(targetPackage);
|
|
306
|
+
}
|
|
291
307
|
this.addPackageUpdate(targetPackage, {
|
|
292
308
|
version: target.version,
|
|
293
309
|
addToPackageJson: target.addToPackageJson || false,
|
|
@@ -399,12 +415,7 @@ class Migrator {
|
|
|
399
415
|
this.gt(packageJsonUpdate.version, targetVersion)) {
|
|
400
416
|
continue;
|
|
401
417
|
}
|
|
402
|
-
const dependencies =
|
|
403
|
-
...this.packageJson?.dependencies,
|
|
404
|
-
...this.packageJson?.devDependencies,
|
|
405
|
-
...this.nxInstallation?.plugins,
|
|
406
|
-
...(this.nxInstallation && { nx: this.nxInstallation.version }),
|
|
407
|
-
};
|
|
418
|
+
const dependencies = this.getDeclaredDependencies();
|
|
408
419
|
const filtered = {};
|
|
409
420
|
for (const [packageName, packageUpdate] of Object.entries(packageJsonUpdate.packages)) {
|
|
410
421
|
if (this.shouldExcludePackage(packageName)) {
|
|
@@ -1138,7 +1149,7 @@ function createInstalledPackageVersionsResolver(root) {
|
|
|
1138
1149
|
for (const req of nxRequires) {
|
|
1139
1150
|
try {
|
|
1140
1151
|
const packageJsonPath = req.resolve('nx/package.json');
|
|
1141
|
-
if (
|
|
1152
|
+
if ((0, workspace_installation_1.isWorkspaceInstalledPackage)('nx', packageJsonPath, root)) {
|
|
1142
1153
|
return (0, fileutils_1.readJsonFile)(packageJsonPath).version;
|
|
1143
1154
|
}
|
|
1144
1155
|
}
|
|
@@ -1156,8 +1167,8 @@ function createInstalledPackageVersionsResolver(root) {
|
|
|
1156
1167
|
const { packageJson, path } = (0, package_json_1.readModulePackageJson)(packageName, (0, installation_directory_1.getNxRequirePaths)(root));
|
|
1157
1168
|
// old workspaces would have the temp installation of nx in the cache,
|
|
1158
1169
|
// so the resolved package is not the one we need
|
|
1159
|
-
if (!
|
|
1160
|
-
throw new Error('Resolved a package
|
|
1170
|
+
if (!(0, workspace_installation_1.isWorkspaceInstalledPackage)(packageName, path, root)) {
|
|
1171
|
+
throw new Error('Resolved a package the workspace does not install.');
|
|
1161
1172
|
}
|
|
1162
1173
|
cache[packageName] = packageJson.version;
|
|
1163
1174
|
}
|
|
@@ -1383,11 +1394,11 @@ async function getPackageMigrationsUsingInstall(packageName, packageVersion, pmc
|
|
|
1383
1394
|
async function getPackageMigrationsUsingInstallImpl(packageName, packageVersion, pmc) {
|
|
1384
1395
|
const { dir, cleanup } = (0, package_manager_1.createTempNpmDirectory)();
|
|
1385
1396
|
let result;
|
|
1386
|
-
|
|
1387
|
-
await (0, provenance_1.
|
|
1388
|
-
|
|
1397
|
+
const installVersion = (0, provenance_1.getNxPackageGroup)().includes(packageName)
|
|
1398
|
+
? await (0, provenance_1.resolveVersionWithProvenance)(packageName, packageVersion)
|
|
1399
|
+
: packageVersion;
|
|
1389
1400
|
try {
|
|
1390
|
-
const addCommand = `${pmc.add} ${packageName}@${
|
|
1401
|
+
const addCommand = `${pmc.add} ${packageName}@${installVersion}`;
|
|
1391
1402
|
try {
|
|
1392
1403
|
await execAsync(addCommand, {
|
|
1393
1404
|
cwd: dir,
|
|
@@ -1616,7 +1627,16 @@ async function generateMigrationsJsonAndUpdatePackageJson(root, opts, fetch) {
|
|
|
1616
1627
|
include,
|
|
1617
1628
|
requiredPackages,
|
|
1618
1629
|
});
|
|
1619
|
-
const { migrations, packageUpdates, promptContents, minVersionWithSkippedUpdates, } = await migrator.migrate(walkedTargetPackage, opts.targetVersion);
|
|
1630
|
+
const { migrations, packageUpdates, promptContents, minVersionWithSkippedUpdates, uninstalledDeclaredPackages, } = await migrator.migrate(walkedTargetPackage, opts.targetVersion);
|
|
1631
|
+
if (uninstalledDeclaredPackages) {
|
|
1632
|
+
output_1.output.warn({
|
|
1633
|
+
title: `nx migrate could not find these declared packages installed: ${uninstalledDeclaredPackages.join(', ')}`,
|
|
1634
|
+
bodyLines: [
|
|
1635
|
+
`- Their package groups and migrations were skipped.`,
|
|
1636
|
+
`- Undo this run's changes, install the workspace's dependencies and run nx migrate again.`,
|
|
1637
|
+
],
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1620
1640
|
// The cascade collects packageJsonUpdates entries against the cascade
|
|
1621
1641
|
// root's installed version, but inner per-package pins are only gated
|
|
1622
1642
|
// against the in-flight cascade tally — not against each inner package's
|
|
@@ -2188,7 +2208,7 @@ async function runMigrations(root, opts, args, isVerbose, shouldCreateCommits, c
|
|
|
2188
2208
|
await (0, execute_migration_1.runInstall)();
|
|
2189
2209
|
}
|
|
2190
2210
|
}
|
|
2191
|
-
if (!
|
|
2211
|
+
if (!(0, workspace_installation_1.isRunningWorkspaceNx)()) {
|
|
2192
2212
|
// we are running from a temp installation with nx latest, switch to running
|
|
2193
2213
|
// from local installation
|
|
2194
2214
|
if (isContinue) {
|
|
@@ -2737,7 +2757,7 @@ function readNxVersionFromNodeModules(searchPaths) {
|
|
|
2737
2757
|
// executes against the workspace-local nx that owns the run state, never the
|
|
2738
2758
|
// temp installation. Reconciles only read state and commit, so no install.
|
|
2739
2759
|
async function runOrchestratorReconcileFromCli(root, opts, args) {
|
|
2740
|
-
if (!
|
|
2760
|
+
if (!(0, workspace_installation_1.isRunningWorkspaceNx)()) {
|
|
2741
2761
|
// The workspace-local nx we are about to hand off to must be new enough to
|
|
2742
2762
|
// understand the new flags we forward to it.
|
|
2743
2763
|
(0, version_skew_guard_1.assertWorkspaceNxSupportsNewMigrateFlags)({
|
|
@@ -2770,7 +2790,7 @@ async function runSingleMigrationFromCli(root, opts, args, mergedArgs) {
|
|
|
2770
2790
|
checkRunsForSingleMigration(root);
|
|
2771
2791
|
await (0, execute_migration_1.runInstall)(undefined, 'pre-migration', (0, execute_migration_1.formatSingleMigrationRerunCommand)(opts.runMigration));
|
|
2772
2792
|
}
|
|
2773
|
-
if (!
|
|
2793
|
+
if (!(0, workspace_installation_1.isRunningWorkspaceNx)()) {
|
|
2774
2794
|
// Must stay after the pre-install: it reads the version that install may
|
|
2775
2795
|
// have just updated, so checking earlier would falsely refuse a workspace
|
|
2776
2796
|
// whose package.json bump was not installed yet.
|
|
@@ -2820,8 +2840,7 @@ async function runMigration() {
|
|
|
2820
2840
|
stdio: ['inherit', 'inherit', 'inherit'],
|
|
2821
2841
|
}));
|
|
2822
2842
|
if (!(0, version_skew_guard_1.targetsExistingRun)(process.argv.slice(3)) &&
|
|
2823
|
-
|
|
2824
|
-
process.env.NX_MIGRATE_USE_LOCAL === undefined) {
|
|
2843
|
+
!(0, workspace_installation_1.shouldSkipTempMigrateCli)()) {
|
|
2825
2844
|
// The version spec mirrors nxCliPath's; keep the two in sync.
|
|
2826
2845
|
const cliVersionSpec = process.env.NX_MIGRATE_CLI_VERSION || 'latest';
|
|
2827
2846
|
const target = await (0, version_skew_guard_1.resolveNewMigrateFlagsRunTarget)({
|
|
@@ -2876,9 +2895,9 @@ async function runMigration() {
|
|
|
2876
2895
|
});
|
|
2877
2896
|
}
|
|
2878
2897
|
async function nxCliPath(nxWorkspaceRoot) {
|
|
2879
|
-
const version = process.env.NX_MIGRATE_CLI_VERSION || 'latest';
|
|
2880
2898
|
const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
|
2881
|
-
|
|
2899
|
+
const root = nxWorkspaceRoot ?? workspace_root_1.workspaceRoot;
|
|
2900
|
+
const version = await (0, provenance_1.resolveVersionWithProvenance)('nx', process.env.NX_MIGRATE_CLI_VERSION || 'latest', root);
|
|
2882
2901
|
try {
|
|
2883
2902
|
const packageManager = (0, package_manager_1.detectPackageManager)();
|
|
2884
2903
|
const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
|
|
@@ -2890,7 +2909,6 @@ async function nxCliPath(nxWorkspaceRoot) {
|
|
|
2890
2909
|
},
|
|
2891
2910
|
license: 'MIT',
|
|
2892
2911
|
});
|
|
2893
|
-
const root = nxWorkspaceRoot ?? workspace_root_1.workspaceRoot;
|
|
2894
2912
|
const isNonJs = !(0, fs_1.existsSync)((0, path_1.join)(root, 'package.json'));
|
|
2895
2913
|
(0, package_manager_1.copyPackageManagerConfigurationFiles)(isNonJs ? (0, installation_directory_1.getNxInstallationPath)(root) : root, tmpDir);
|
|
2896
2914
|
// Let's print the output of the install process to the console when verbose
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether `packageJsonPath`, resolved for `packageName` from
|
|
3
|
+
* `getNxRequirePaths(root)`, is the workspace's install rather than the temp nx
|
|
4
|
+
* installation on NODE_PATH. The install may sit in an ancestor's node_modules
|
|
5
|
+
* or link outside the root (pnpm's global virtual store).
|
|
6
|
+
*/
|
|
7
|
+
export declare function isWorkspaceInstalledPackage(packageName: string, packageJsonPath: string, root: string): boolean;
|
|
8
|
+
export declare function shouldSkipTempMigrateCli(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the running nx is the workspace's installation rather than the temp
|
|
11
|
+
* one `nx migrate` runs first. Any nx on the lookup chain counts: the hand-off
|
|
12
|
+
* spawns the root's nearest `node_modules/nx` even when `.nx/installation`
|
|
13
|
+
* holds another copy.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isRunningWorkspaceNx(): boolean;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isWorkspaceInstalledPackage = isWorkspaceInstalledPackage;
|
|
4
|
+
exports.shouldSkipTempMigrateCli = shouldSkipTempMigrateCli;
|
|
5
|
+
exports.isRunningWorkspaceNx = isRunningWorkspaceNx;
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const installation_directory_1 = require("../../utils/installation-directory");
|
|
9
|
+
const path_2 = require("../../utils/path");
|
|
10
|
+
const workspace_root_1 = require("../../utils/workspace-root");
|
|
11
|
+
/**
|
|
12
|
+
* Whether `packageJsonPath`, resolved for `packageName` from
|
|
13
|
+
* `getNxRequirePaths(root)`, is the workspace's install rather than the temp nx
|
|
14
|
+
* installation on NODE_PATH. The install may sit in an ancestor's node_modules
|
|
15
|
+
* or link outside the root (pnpm's global virtual store).
|
|
16
|
+
*/
|
|
17
|
+
function isWorkspaceInstalledPackage(packageName, packageJsonPath, root) {
|
|
18
|
+
const resolved = realpathOrSelf(packageJsonPath);
|
|
19
|
+
return (isInside(resolved, realpathOrSelf(workspace_root_1.workspaceRoot)) ||
|
|
20
|
+
nodeModulesLookupEntries(packageName, root).some((entry) => realpathOrNull((0, path_1.join)(entry, 'package.json')) === resolved));
|
|
21
|
+
}
|
|
22
|
+
function shouldSkipTempMigrateCli() {
|
|
23
|
+
return (process.env.NX_USE_LOCAL === 'true' ||
|
|
24
|
+
process.env.NX_MIGRATE_USE_LOCAL !== undefined);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Whether the running nx is the workspace's installation rather than the temp
|
|
28
|
+
* one `nx migrate` runs first. Any nx on the lookup chain counts: the hand-off
|
|
29
|
+
* spawns the root's nearest `node_modules/nx` even when `.nx/installation`
|
|
30
|
+
* holds another copy.
|
|
31
|
+
*/
|
|
32
|
+
function isRunningWorkspaceNx() {
|
|
33
|
+
// The wrapper never starts the temp nx under these variables, and the hand-off
|
|
34
|
+
// sets one for its child, so a misjudged location cannot respawn without end.
|
|
35
|
+
if (shouldSkipTempMigrateCli()) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
const running = realpathOrSelf(__dirname);
|
|
39
|
+
return (isInside(running, realpathOrSelf(workspace_root_1.workspaceRoot)) ||
|
|
40
|
+
nodeModulesLookupEntries('nx', workspace_root_1.workspaceRoot).some((entry) => {
|
|
41
|
+
const target = realpathOrNull(entry);
|
|
42
|
+
return target !== null && isInside(running, target);
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
// The `<dir>/node_modules/<packageName>` paths Node's lookup from
|
|
46
|
+
// `getNxRequirePaths(root)` visits up to the filesystem root, wherever they
|
|
47
|
+
// link to.
|
|
48
|
+
function nodeModulesLookupEntries(packageName, root) {
|
|
49
|
+
const entries = new Set();
|
|
50
|
+
for (const start of (0, installation_directory_1.getNxRequirePaths)(root)) {
|
|
51
|
+
for (let dir = (0, path_1.resolve)(start);; dir = (0, path_1.dirname)(dir)) {
|
|
52
|
+
entries.add((0, path_1.join)(dir, 'node_modules', packageName));
|
|
53
|
+
if (dir === (0, path_1.dirname)(dir))
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return [...entries];
|
|
58
|
+
}
|
|
59
|
+
function isInside(path, dir) {
|
|
60
|
+
return (0, path_2.isContainedRelativePath)((0, path_1.relative)(dir, path));
|
|
61
|
+
}
|
|
62
|
+
// NX_WORKSPACE_ROOT_PATH is used verbatim, so the workspace root may not exist.
|
|
63
|
+
function realpathOrSelf(path) {
|
|
64
|
+
return realpathOrNull(path) ?? path;
|
|
65
|
+
}
|
|
66
|
+
function realpathOrNull(path) {
|
|
67
|
+
try {
|
|
68
|
+
return (0, fs_1.realpathSync)(path);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -6,7 +6,7 @@ const shared_options_1 = require("../../yargs-utils/shared-options");
|
|
|
6
6
|
exports.yargsStopAllAgentsCommand = {
|
|
7
7
|
command: 'stop-all-agents [options]',
|
|
8
8
|
aliases: ['complete-ci-run'],
|
|
9
|
-
describe: 'Terminates all dedicated agents associated with this CI pipeline execution. This command is an alias for [`nx-cloud stop-all-agents`](/docs/reference/nx-cloud-cli#nx-cloud-stop-all-
|
|
9
|
+
describe: 'Terminates all dedicated agents associated with this CI pipeline execution. This command is an alias for [`nx-cloud stop-all-agents`](/docs/reference/nx-cloud-cli#nx-cloud-stop-all-workers).',
|
|
10
10
|
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs)
|
|
11
11
|
.help(false)
|
|
12
12
|
.showHelpOnFail(false)
|
|
@@ -5,7 +5,7 @@ const shared_options_1 = require("../../yargs-utils/shared-options");
|
|
|
5
5
|
const handle_import_1 = require("../../../utils/handle-import");
|
|
6
6
|
exports.yargsFixCiCommand = {
|
|
7
7
|
command: 'fix-ci [options]',
|
|
8
|
-
describe: 'Fixes CI failures. This command is an alias for [`nx-cloud fix-ci`](/
|
|
8
|
+
describe: 'Fixes CI failures. This command is an alias for [`nx-cloud fix-ci`](/docs/reference/nx-cloud-cli#nx-cloud-fix-ci).',
|
|
9
9
|
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs)
|
|
10
10
|
.help(false)
|
|
11
11
|
.showHelpOnFail(false)
|
|
@@ -4,9 +4,18 @@ exports.yargsLogoutCommand = void 0;
|
|
|
4
4
|
const handle_import_1 = require("../../../utils/handle-import");
|
|
5
5
|
const shared_options_1 = require("../../yargs-utils/shared-options");
|
|
6
6
|
exports.yargsLogoutCommand = {
|
|
7
|
-
command: 'logout',
|
|
7
|
+
command: 'logout [nxCloudUrl]',
|
|
8
8
|
describe: 'Logout from Nx Cloud. This command is an alias for `nx-cloud logout`.',
|
|
9
|
-
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs
|
|
9
|
+
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs
|
|
10
|
+
.positional('nxCloudUrl', {
|
|
11
|
+
describe: 'The URL of the Nx Cloud instance to log out of. With several stored logins, pass one URL or --all.',
|
|
12
|
+
type: 'string',
|
|
13
|
+
required: false,
|
|
14
|
+
})
|
|
15
|
+
.option('all', {
|
|
16
|
+
describe: 'Log out of every Nx Cloud instance stored on this machine.',
|
|
17
|
+
type: 'boolean',
|
|
18
|
+
}))
|
|
10
19
|
.help(false)
|
|
11
20
|
.showHelpOnFail(false)
|
|
12
21
|
.option('help', { describe: 'Show help.', type: 'boolean' }),
|
|
@@ -5,7 +5,7 @@ const handle_import_1 = require("../../../utils/handle-import");
|
|
|
5
5
|
const shared_options_1 = require("../../yargs-utils/shared-options");
|
|
6
6
|
exports.yargsRecordCommand = {
|
|
7
7
|
command: 'record [options]',
|
|
8
|
-
describe: 'Records a command execution for distributed task execution. This command is an alias for [`nx-cloud record`](/
|
|
8
|
+
describe: 'Records a command execution for distributed task execution. This command is an alias for [`nx-cloud record`](/docs/reference/nx-cloud-cli#nx-cloud-record).',
|
|
9
9
|
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs)
|
|
10
10
|
.parserConfiguration({
|
|
11
11
|
'populate--': true,
|
|
@@ -5,14 +5,15 @@ const child_process_1 = require("child_process");
|
|
|
5
5
|
const nx_json_1 = require("../../../config/nx-json");
|
|
6
6
|
const output_1 = require("../../../utils/output");
|
|
7
7
|
const nx_cloud_utils_1 = require("../../../utils/nx-cloud-utils");
|
|
8
|
+
const shell_quoting_1 = require("../../../utils/shell-quoting");
|
|
8
9
|
const utils_1 = require("../utils");
|
|
9
10
|
function recordHandler(args) {
|
|
10
11
|
if (!(0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)())) {
|
|
11
12
|
let exitCode = 0;
|
|
12
13
|
const commandArgs = args['--'];
|
|
13
14
|
if (commandArgs && commandArgs.length > 0) {
|
|
14
|
-
const [cmd, ...cmdArgs] = commandArgs;
|
|
15
|
-
const result = (0, child_process_1.spawnSync)(cmd, cmdArgs, {
|
|
15
|
+
const [cmd, ...cmdArgs] = commandArgs.map(String);
|
|
16
|
+
const result = (0, child_process_1.spawnSync)(cmd, cmdArgs.map(shell_quoting_1.quoteShellArg), {
|
|
16
17
|
stdio: 'inherit',
|
|
17
18
|
shell: true,
|
|
18
19
|
encoding: 'utf-8',
|
|
@@ -5,7 +5,7 @@ const handle_import_1 = require("../../../utils/handle-import");
|
|
|
5
5
|
const shared_options_1 = require("../../yargs-utils/shared-options");
|
|
6
6
|
exports.yargsStartCiRunCommand = {
|
|
7
7
|
command: 'start-ci-run [options]',
|
|
8
|
-
describe: 'Starts a new CI run for distributed task execution. This command is an alias for [`nx-cloud start-ci-run`](/docs/reference/nx-cloud-cli#
|
|
8
|
+
describe: 'Starts a new CI run for distributed task execution. This command is an alias for [`nx-cloud start-ci-run`](/docs/reference/nx-cloud-cli#nx-cloud-start-ci-run).',
|
|
9
9
|
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs)
|
|
10
10
|
.help(false)
|
|
11
11
|
.showHelpOnFail(false)
|
|
@@ -5,7 +5,7 @@ const handle_import_1 = require("../../../utils/handle-import");
|
|
|
5
5
|
const shared_options_1 = require("../../yargs-utils/shared-options");
|
|
6
6
|
exports.yargsStartNxAgentsCommand = {
|
|
7
7
|
command: 'start-nx-agents [options]',
|
|
8
|
-
describe: 'Provisions Nx Agents for distributed task execution, reading configuration from `.nx/ci-config.yaml`. This command is an alias for [`nx-cloud start-nx-agents`](/docs/reference/nx-cloud-cli#nx-cloud-start-
|
|
8
|
+
describe: 'Provisions Nx Agents for distributed task execution, reading configuration from `.nx/ci-config.yaml`. This command is an alias for [`nx-cloud start-nx-agents`](/docs/reference/nx-cloud-cli#nx-cloud-start-workers).',
|
|
9
9
|
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs)
|
|
10
10
|
.help(false)
|
|
11
11
|
.showHelpOnFail(false)
|
|
@@ -118,8 +118,10 @@ exports.commandsObject = yargs
|
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
const context = exports.commandsObject.getInternalMethods().getContext();
|
|
121
|
+
// The infix command (`nx <target> [project]`) has no name of its own, and
|
|
122
|
+
// its target and `_` hold user input, so report it as `run`.
|
|
121
123
|
const command = (context.commands ?? []).join(' ') ||
|
|
122
|
-
(args.
|
|
124
|
+
(args.target && args.target !== 'undefined' ? 'run' : '');
|
|
123
125
|
// Internal commands (e.g. `_migrate`) are spawned by their public
|
|
124
126
|
// wrapper, which already reported the run - skip to avoid double counts.
|
|
125
127
|
if (command && !command.startsWith('_')) {
|
|
@@ -7,6 +7,7 @@ exports.extractPreidFromVersion = extractPreidFromVersion;
|
|
|
7
7
|
exports.extractProjectsPreidFromVersionData = extractProjectsPreidFromVersionData;
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const semver_1 = require("semver");
|
|
10
|
+
const git_revision_1 = require("../../../utils/git-revision");
|
|
10
11
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
|
11
12
|
const exec_command_1 = require("../utils/exec-command");
|
|
12
13
|
const git_1 = require("../utils/git");
|
|
@@ -48,6 +49,8 @@ async function filterVersionPlansByCommitRange(versionPlans, fromSHA, toSHA, isV
|
|
|
48
49
|
* @returns Set of absolute file paths that were added in the range
|
|
49
50
|
*/
|
|
50
51
|
async function getFilesAddedInCommitRange(fromSHA, toSHA, isVerbose) {
|
|
52
|
+
(0, git_revision_1.assertValidGitRevision)(fromSHA);
|
|
53
|
+
(0, git_revision_1.assertValidGitRevision)(toSHA);
|
|
51
54
|
try {
|
|
52
55
|
// Use git log to get version plan files added within the commit range
|
|
53
56
|
// --name-only shows just the file paths
|
|
@@ -102,7 +105,7 @@ async function resolveChangelogFromSHA({ fromRef, tagPattern, tagPatternValues,
|
|
|
102
105
|
strictPreid,
|
|
103
106
|
});
|
|
104
107
|
if (latestTag?.tag) {
|
|
105
|
-
return await (0, git_1.getCommitHash)(latestTag.tag);
|
|
108
|
+
return await (0, git_1.getCommitHash)(`refs/tags/${latestTag.tag}`);
|
|
106
109
|
}
|
|
107
110
|
// Finally, if automatic from ref is enabled, use the first commit as a fallback.
|
|
108
111
|
// When a projectRoot is provided, scope the fallback to the project's first commit
|
|
@@ -17,6 +17,7 @@ const interpolate_release_config_1 = require("./utils/interpolate-release-config
|
|
|
17
17
|
const handle_errors_1 = require("../../utils/handle-errors");
|
|
18
18
|
const is_ci_1 = require("../../utils/is-ci");
|
|
19
19
|
const output_1 = require("../../utils/output");
|
|
20
|
+
const redact_url_credentials_1 = require("../../utils/redact-url-credentials");
|
|
20
21
|
const path_1 = require("../../utils/path");
|
|
21
22
|
const workspace_root_1 = require("../../utils/workspace-root");
|
|
22
23
|
const commit_utils_1 = require("./changelog/commit-utils");
|
|
@@ -579,7 +580,7 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
|
|
|
579
580
|
}
|
|
580
581
|
}
|
|
581
582
|
if (args.gitPush ?? nxReleaseConfig.changelog.git.push) {
|
|
582
|
-
output_1.output.logSingleLine(`Pushing to git remote "${args.gitRemote ?? 'origin'}"`);
|
|
583
|
+
output_1.output.logSingleLine(`Pushing to git remote "${(0, redact_url_credentials_1.redactUrlCredentials)(args.gitRemote ?? 'origin')}"`);
|
|
583
584
|
await (0, git_1.gitPush)({
|
|
584
585
|
gitRemote: args.gitRemote,
|
|
585
586
|
dryRun: args.dryRun,
|
|
@@ -691,7 +692,9 @@ async function generateChangelogForWorkspace({ tree, args, nxReleaseConfig, work
|
|
|
691
692
|
}
|
|
692
693
|
else {
|
|
693
694
|
// No existing version, simply prepend the new release to the top of the file
|
|
694
|
-
rootChangelogContents =
|
|
695
|
+
rootChangelogContents = contents
|
|
696
|
+
? `${contents}\n\n${rootChangelogContents}`
|
|
697
|
+
: rootChangelogContents;
|
|
695
698
|
}
|
|
696
699
|
}
|
|
697
700
|
else {
|
|
@@ -803,7 +806,9 @@ async function generateChangelogForProjects({ tree, args, changes, projectsVersi
|
|
|
803
806
|
}
|
|
804
807
|
else {
|
|
805
808
|
// No existing version, simply prepend the new release to the top of the file
|
|
806
|
-
changelogContents =
|
|
809
|
+
changelogContents = contents
|
|
810
|
+
? `${contents}\n\n${changelogContents}`
|
|
811
|
+
: changelogContents;
|
|
807
812
|
}
|
|
808
813
|
}
|
|
809
814
|
else {
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.readRawVersionPlans = readRawVersionPlans;
|
|
4
4
|
exports.setResolvedVersionPlansOnGroups = setResolvedVersionPlansOnGroups;
|
|
5
5
|
exports.getVersionPlansAbsolutePath = getVersionPlansAbsolutePath;
|
|
6
|
-
const node_child_process_1 = require("node:child_process");
|
|
7
6
|
const node_fs_1 = require("node:fs");
|
|
8
7
|
const promises_1 = require("node:fs/promises");
|
|
9
8
|
const path_1 = require("path");
|
|
10
9
|
const semver_1 = require("semver");
|
|
11
10
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
|
11
|
+
const exec_command_1 = require("../utils/exec-command");
|
|
12
12
|
const config_1 = require("./config");
|
|
13
13
|
const { load } = require('@zkochan/js-yaml');
|
|
14
14
|
// Ported from https://github.com/jxson/front-matter/blob/master/index.js
|
|
@@ -247,32 +247,32 @@ function isReleaseType(value) {
|
|
|
247
247
|
return semver_1.RELEASE_TYPES.includes(value);
|
|
248
248
|
}
|
|
249
249
|
async function getCommitForVersionPlanFile(rawVersionPlan, isVerbose) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
250
|
+
let stdout;
|
|
251
|
+
try {
|
|
252
|
+
stdout = await (0, exec_command_1.execCommand)('git', [
|
|
253
|
+
'--literal-pathspecs',
|
|
254
|
+
'log',
|
|
255
|
+
'--diff-filter=A',
|
|
256
|
+
'--pretty=format:%s%x00%h%x00%an%x00%ae%x00%b',
|
|
257
|
+
'-n',
|
|
258
|
+
'1',
|
|
259
|
+
'--',
|
|
260
|
+
rawVersionPlan.absolutePath,
|
|
261
|
+
]);
|
|
262
|
+
}
|
|
263
|
+
catch (error) {
|
|
264
|
+
if (isVerbose) {
|
|
265
|
+
console.error(`Error executing git command for ${rawVersionPlan.relativePath}: ${error?.message ?? error}`);
|
|
266
|
+
}
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
const [message, shortHash, authorName, authorEmail, body] = stdout
|
|
270
|
+
.trim()
|
|
271
|
+
.split('\0');
|
|
272
|
+
return {
|
|
273
|
+
message: message || '',
|
|
274
|
+
shortHash: shortHash || '',
|
|
275
|
+
author: { name: authorName || '', email: authorEmail || '' },
|
|
276
|
+
body: body || '',
|
|
277
|
+
};
|
|
278
278
|
}
|