@git.zone/cli 9.2.2 → 11.0.0
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/.smartconfig.json +5 -3
- package/assets/templates/asset_binary_installer/install.sh +109 -34
- package/assets/templates/asset_binary_release_gitea/.gitea/workflows/release.yml +17 -4
- package/assets/templates/ci_rust/.gitea/workflows/rust_nottags.yaml +29 -0
- package/assets/templates/ci_rust/.gitea/workflows/rust_tags.yaml +32 -0
- package/assets/templates/cli/cli.ts.js +1 -1
- package/assets/templates/gitignore/_gitignore +1 -1
- package/assets/templates/gitignore_rust/_gitignore +31 -0
- package/assets/templates/license_mit/license +4 -1
- package/assets/templates/npm/.package.json +4 -6
- package/assets/templates/npm/test/test.ts +1 -1
- package/assets/templates/rust/.smartscaf.yml +16 -0
- package/assets/templates/rust/_Cargo.toml +12 -0
- package/assets/templates/rust/_crate_Cargo.toml +10 -0
- package/assets/templates/rust/_crate_lib.rs +19 -0
- package/assets/templates/rust/_smartconfig.json +27 -0
- package/assets/templates/rust/readme.md +23 -0
- package/assets/templates/service/.package.json +3 -6
- package/assets/templates/wcc/.package.json +3 -6
- package/assets/templates/wcc_update/html/index.html +2 -2
- package/assets/templates/website/.package.json +3 -6
- package/assets/templates/website/npmextra.json +3 -1
- package/assets/templates/website_update/html/index.html +4 -4
- package/dist_ts/00_commitinfo_data.js +2 -2
- package/dist_ts/classes.gitzoneconfig.d.ts +3 -1
- package/dist_ts/classes.gitzoneconfig.js +9 -1
- package/dist_ts/helpers.managedassets.d.ts +1 -1
- package/dist_ts/helpers.managedassets.js +58 -14
- package/dist_ts/helpers.packagefiles.js +2 -2
- package/dist_ts/helpers.releasetargets.d.ts +6 -0
- package/dist_ts/helpers.releasetargets.js +13 -0
- package/dist_ts/helpers.smartconfigmigrations.js +42 -1
- package/dist_ts/helpers.toolconfig.d.ts +50 -0
- package/dist_ts/helpers.toolconfig.js +212 -0
- package/dist_ts/helpers.tssea.d.ts +11 -4
- package/dist_ts/helpers.tssea.js +47 -17
- package/dist_ts/helpers.tstest.d.ts +27 -8
- package/dist_ts/helpers.tstest.js +64 -26
- package/dist_ts/helpers.versionsource.d.ts +37 -0
- package/dist_ts/helpers.versionsource.js +112 -0
- package/dist_ts/helpers.workflow.d.ts +45 -1
- package/dist_ts/helpers.workflow.js +120 -5
- package/dist_ts/mod_commit/mod.helpers.d.ts +0 -24
- package/dist_ts/mod_commit/mod.helpers.js +1 -94
- package/dist_ts/mod_commit/mod.plugins.d.ts +1 -1
- package/dist_ts/mod_commit/mod.plugins.js +2 -2
- package/dist_ts/mod_config/index.js +131 -18
- package/dist_ts/mod_format/formatters/assets.formatter.js +30 -28
- package/dist_ts/mod_format/formatters/gitignore.formatter.d.ts +4 -2
- package/dist_ts/mod_format/formatters/gitignore.formatter.js +10 -7
- package/dist_ts/mod_format/formatters/license.formatter.d.ts +8 -0
- package/dist_ts/mod_format/formatters/license.formatter.js +25 -2
- package/dist_ts/mod_format/formatters/packagejson.formatter.js +14 -3
- package/dist_ts/mod_format/formatters/rustfmt.formatter.d.ts +19 -0
- package/dist_ts/mod_format/formatters/rustfmt.formatter.js +97 -0
- package/dist_ts/mod_format/formatters/smartconfig.formatter.js +5 -2
- package/dist_ts/mod_format/formatters/templates.formatter.d.ts +3 -2
- package/dist_ts/mod_format/formatters/templates.formatter.js +61 -14
- package/dist_ts/mod_format/formatters/tsconfig.formatter.js +2 -2
- package/dist_ts/mod_format/index.js +3 -1
- package/dist_ts/mod_format/interfaces.format.js +2 -1
- package/dist_ts/mod_release/classes.releasejournal.d.ts +38 -2
- package/dist_ts/mod_release/classes.releasejournal.js +238 -66
- package/dist_ts/mod_release/helpers.cargorelease.d.ts +52 -0
- package/dist_ts/mod_release/helpers.cargorelease.js +195 -0
- package/dist_ts/mod_release/helpers.npmpackages.d.ts +18 -0
- package/dist_ts/mod_release/helpers.npmpackages.js +40 -2
- package/dist_ts/mod_release/helpers.releasecheck.d.ts +73 -0
- package/dist_ts/mod_release/helpers.releasecheck.js +269 -0
- package/dist_ts/mod_release/helpers.releasepreparation.d.ts +22 -8
- package/dist_ts/mod_release/helpers.releasepreparation.js +74 -26
- package/dist_ts/mod_release/helpers.releasepublication.d.ts +21 -1
- package/dist_ts/mod_release/helpers.releasepublication.js +249 -4
- package/dist_ts/mod_release/helpers.releaseversionsource.d.ts +10 -0
- package/dist_ts/mod_release/helpers.releaseversionsource.js +18 -0
- package/dist_ts/mod_release/helpers.rsrepoengine.d.ts +192 -0
- package/dist_ts/mod_release/helpers.rsrepoengine.js +457 -0
- package/dist_ts/mod_release/index.d.ts +3 -0
- package/dist_ts/mod_release/index.js +177 -65
- package/dist_ts/mod_template/index.js +6 -2
- package/dist_ts/mod_tools/index.js +3 -8
- package/dist_ts/plugins.d.ts +1 -1
- package/dist_ts/plugins.js +2 -2
- package/package.json +6 -11
- package/readme.md +244 -26
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.gitzoneconfig.ts +10 -1
- package/ts/helpers.managedassets.ts +64 -14
- package/ts/helpers.packagefiles.ts +1 -1
- package/ts/helpers.releasetargets.ts +13 -0
- package/ts/helpers.smartconfigmigrations.ts +48 -0
- package/ts/helpers.toolconfig.ts +280 -0
- package/ts/helpers.tssea.ts +62 -19
- package/ts/helpers.tstest.ts +105 -35
- package/ts/helpers.versionsource.ts +169 -0
- package/ts/helpers.workflow.ts +197 -5
- package/ts/mod_commit/mod.helpers.ts +0 -119
- package/ts/mod_commit/mod.plugins.ts +1 -1
- package/ts/mod_config/index.ts +169 -19
- package/ts/mod_format/formatters/assets.formatter.ts +29 -28
- package/ts/mod_format/formatters/gitignore.formatter.ts +10 -6
- package/ts/mod_format/formatters/license.formatter.ts +26 -1
- package/ts/mod_format/formatters/packagejson.formatter.ts +14 -2
- package/ts/mod_format/formatters/rustfmt.formatter.ts +107 -0
- package/ts/mod_format/formatters/smartconfig.formatter.ts +8 -1
- package/ts/mod_format/formatters/templates.formatter.ts +80 -14
- package/ts/mod_format/formatters/tsconfig.formatter.ts +1 -1
- package/ts/mod_format/index.ts +2 -0
- package/ts/mod_format/interfaces.format.ts +1 -0
- package/ts/mod_release/classes.releasejournal.ts +312 -39
- package/ts/mod_release/helpers.cargorelease.ts +289 -0
- package/ts/mod_release/helpers.npmpackages.ts +76 -1
- package/ts/mod_release/helpers.releasecheck.ts +409 -0
- package/ts/mod_release/helpers.releasepreparation.ts +116 -36
- package/ts/mod_release/helpers.releasepublication.ts +462 -1
- package/ts/mod_release/helpers.releaseversionsource.ts +29 -0
- package/ts/mod_release/helpers.rsrepoengine.ts +790 -0
- package/ts/mod_release/index.ts +277 -84
- package/ts/mod_template/index.ts +5 -1
- package/ts/mod_tools/index.ts +2 -7
- package/ts/plugins.ts +1 -1
package/ts/mod_config/index.ts
CHANGED
|
@@ -23,6 +23,9 @@ import {
|
|
|
23
23
|
} from "../helpers.smartconfigmigrations.js";
|
|
24
24
|
import {
|
|
25
25
|
getDeclaredTsdockerRange,
|
|
26
|
+
isCargoTargetEnabled,
|
|
27
|
+
releaseTargetConfigKeys,
|
|
28
|
+
resolveCargoTargetConfiguration,
|
|
26
29
|
resolveGiteaAssetsConfiguration,
|
|
27
30
|
resolveGiteaAssetConcurrency,
|
|
28
31
|
resolveGiteaAssetTransferLimits,
|
|
@@ -32,6 +35,13 @@ import {
|
|
|
32
35
|
normalizeReleaseRegistryUrl,
|
|
33
36
|
} from "../helpers.workflow.js";
|
|
34
37
|
import { resolvePackageFiles } from "../helpers.packagefiles.js";
|
|
38
|
+
import { gitzoneProjectTypes } from "../classes.gitzoneconfig.js";
|
|
39
|
+
import {
|
|
40
|
+
collectToolConfigFindings,
|
|
41
|
+
declaresPackage,
|
|
42
|
+
moveLegacyToolSectionsIntoTsrepo,
|
|
43
|
+
tsrepoNamespace,
|
|
44
|
+
} from "../helpers.toolconfig.js";
|
|
35
45
|
import { hasInstalledProjectTsdockerBinary } from "../helpers.tsdocker.js";
|
|
36
46
|
import {
|
|
37
47
|
TsdockerReleaseClient,
|
|
@@ -712,7 +722,7 @@ async function handleProject(mode: ICliMode): Promise<void> {
|
|
|
712
722
|
type: "list",
|
|
713
723
|
name: "projectType",
|
|
714
724
|
message: "What kind of project is this?",
|
|
715
|
-
choices: stringChoices([
|
|
725
|
+
choices: stringChoices([...gitzoneProjectTypes]),
|
|
716
726
|
default: cliConfig.projectType || "npm",
|
|
717
727
|
});
|
|
718
728
|
const githost = await ask({
|
|
@@ -739,16 +749,20 @@ async function handleProject(mode: ICliMode): Promise<void> {
|
|
|
739
749
|
message: "Project description:",
|
|
740
750
|
default: moduleConfig.description || packageJson.description || "",
|
|
741
751
|
});
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
+
// A Rust project publishes crates, never an npm package.
|
|
753
|
+
const npmPackagename =
|
|
754
|
+
projectType === "rust"
|
|
755
|
+
? moduleConfig.npmPackagename || moduleConfig.npmPackageName || ""
|
|
756
|
+
: await ask({
|
|
757
|
+
type: "input",
|
|
758
|
+
name: "npmPackagename",
|
|
759
|
+
message: "npm package name:",
|
|
760
|
+
default:
|
|
761
|
+
moduleConfig.npmPackagename ||
|
|
762
|
+
moduleConfig.npmPackageName ||
|
|
763
|
+
packageJson.name ||
|
|
764
|
+
"",
|
|
765
|
+
});
|
|
752
766
|
const license = await ask({
|
|
753
767
|
type: "input",
|
|
754
768
|
name: "license",
|
|
@@ -1149,15 +1163,35 @@ async function applyKnownConfigFixes(mode: ICliMode): Promise<boolean> {
|
|
|
1149
1163
|
}
|
|
1150
1164
|
|
|
1151
1165
|
const result = migrateSmartconfigData(smartconfigData);
|
|
1152
|
-
|
|
1166
|
+
// The single tools never read @git.zone/tsrepo, so only a project that
|
|
1167
|
+
// declares tsrepo moves their sections there.
|
|
1168
|
+
const toolSectionMove = declaresPackage(
|
|
1169
|
+
await readPackageJson(),
|
|
1170
|
+
"@git.zone/tsrepo",
|
|
1171
|
+
)
|
|
1172
|
+
? moveLegacyToolSectionsIntoTsrepo(smartconfigData)
|
|
1173
|
+
: { moved: [], conflicts: [] };
|
|
1174
|
+
for (const { legacyKey, subsection } of toolSectionMove.conflicts)
|
|
1175
|
+
plugins.logger.log(
|
|
1176
|
+
"warn",
|
|
1177
|
+
`Left ${legacyKey} in place: ${tsrepoNamespace}.${subsection} exists too, and the two are never merged. Merge them by hand, then remove ${legacyKey}.`,
|
|
1178
|
+
);
|
|
1179
|
+
const movedToolSections = toolSectionMove.moved;
|
|
1180
|
+
if (!result.migrated && movedToolSections.length === 0) {
|
|
1153
1181
|
return false;
|
|
1154
1182
|
}
|
|
1155
1183
|
|
|
1156
1184
|
await writeSmartconfigFile(smartconfigData);
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1185
|
+
if (result.migrated)
|
|
1186
|
+
plugins.logger.log(
|
|
1187
|
+
"success",
|
|
1188
|
+
`Applied known .smartconfig.json migrations to schema v${result.toVersion}`,
|
|
1189
|
+
);
|
|
1190
|
+
if (movedToolSections.length > 0)
|
|
1191
|
+
plugins.logger.log(
|
|
1192
|
+
"success",
|
|
1193
|
+
`Moved ${movedToolSections.join(", ")} into ${tsrepoNamespace}`,
|
|
1194
|
+
);
|
|
1161
1195
|
await formatSmartconfigWithDiff(mode);
|
|
1162
1196
|
return true;
|
|
1163
1197
|
}
|
|
@@ -1229,7 +1263,7 @@ async function collectDoctorFindings(): Promise<IDoctorFinding[]> {
|
|
|
1229
1263
|
});
|
|
1230
1264
|
}
|
|
1231
1265
|
|
|
1232
|
-
if (
|
|
1266
|
+
if (validProjectTypes.includes(cliConfig.projectType)) {
|
|
1233
1267
|
findings.push({
|
|
1234
1268
|
level: "ok",
|
|
1235
1269
|
message: `Project type is ${cliConfig.projectType}`,
|
|
@@ -1244,9 +1278,21 @@ async function collectDoctorFindings(): Promise<IDoctorFinding[]> {
|
|
|
1244
1278
|
await validateDetectedProjectType(cliConfig, findings);
|
|
1245
1279
|
|
|
1246
1280
|
validateCommitConfig(cliConfig.commit || {}, findings);
|
|
1247
|
-
await validateReleaseConfig(
|
|
1281
|
+
await validateReleaseConfig(
|
|
1282
|
+
cliConfig.release,
|
|
1283
|
+
smartconfigData,
|
|
1284
|
+
findings,
|
|
1285
|
+
cliConfig.projectType,
|
|
1286
|
+
);
|
|
1248
1287
|
await validateAssetsConfig(cliConfig.assets, smartconfigData, findings);
|
|
1249
1288
|
await validatePackageFilesConfig(cliConfig, findings);
|
|
1289
|
+
let packageJson: Record<string, any> | undefined;
|
|
1290
|
+
try {
|
|
1291
|
+
packageJson = await readPackageJson();
|
|
1292
|
+
} catch {
|
|
1293
|
+
// validateDetectedProjectType reports an unreadable package.json.
|
|
1294
|
+
}
|
|
1295
|
+
findings.push(...collectToolConfigFindings(smartconfigData, packageJson));
|
|
1250
1296
|
|
|
1251
1297
|
return findings;
|
|
1252
1298
|
}
|
|
@@ -1640,7 +1686,7 @@ interface IDoctorFinding {
|
|
|
1640
1686
|
fix?: string;
|
|
1641
1687
|
}
|
|
1642
1688
|
|
|
1643
|
-
const validProjectTypes
|
|
1689
|
+
const validProjectTypes: readonly string[] = gitzoneProjectTypes;
|
|
1644
1690
|
const validConfirmationModes = ["prompt", "auto", "plan"];
|
|
1645
1691
|
const validCommitSteps = [
|
|
1646
1692
|
"format",
|
|
@@ -1979,6 +2025,7 @@ async function validateReleaseConfig(
|
|
|
1979
2025
|
rawReleaseConfig: unknown,
|
|
1980
2026
|
smartconfigData: Record<string, any>,
|
|
1981
2027
|
findings: IDoctorFinding[],
|
|
2028
|
+
projectType: unknown,
|
|
1982
2029
|
): Promise<void> {
|
|
1983
2030
|
const releaseConfig = rawReleaseConfig === undefined ? {} : rawReleaseConfig;
|
|
1984
2031
|
if (!isPlainObject(releaseConfig)) {
|
|
@@ -2078,6 +2125,19 @@ async function validateReleaseConfig(
|
|
|
2078
2125
|
}
|
|
2079
2126
|
|
|
2080
2127
|
const targets = releaseConfig.targets || {};
|
|
2128
|
+
const unknownTargets = isPlainObject(targets)
|
|
2129
|
+
? Object.keys(targets).filter(
|
|
2130
|
+
(keyArg) =>
|
|
2131
|
+
!(releaseTargetConfigKeys as readonly string[]).includes(keyArg),
|
|
2132
|
+
)
|
|
2133
|
+
: [];
|
|
2134
|
+
if (unknownTargets.length > 0) {
|
|
2135
|
+
findings.push({
|
|
2136
|
+
level: "error",
|
|
2137
|
+
message: `Unknown release targets: ${unknownTargets.join(", ")}; a release ignores them`,
|
|
2138
|
+
fix: `Use only ${releaseTargetConfigKeys.join(", ")}, or update gitzone if a newer release target is meant.`,
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2081
2141
|
await validateGitTarget(targets.git || {}, findings);
|
|
2082
2142
|
if (
|
|
2083
2143
|
targets.giteaAssets?.enabled !== undefined &&
|
|
@@ -2117,6 +2177,7 @@ async function validateReleaseConfig(
|
|
|
2117
2177
|
}
|
|
2118
2178
|
}
|
|
2119
2179
|
await validateNpmTarget(targets.npm || {}, findings);
|
|
2180
|
+
validateCargoTarget(targets, projectType, findings);
|
|
2120
2181
|
await validateDockerTarget(
|
|
2121
2182
|
targets.docker || {},
|
|
2122
2183
|
smartconfigData,
|
|
@@ -2408,6 +2469,76 @@ async function validateGitTarget(
|
|
|
2408
2469
|
});
|
|
2409
2470
|
}
|
|
2410
2471
|
|
|
2472
|
+
/**
|
|
2473
|
+
* The cargo target publishes the crates of a projectType "rust" workspace in
|
|
2474
|
+
* dependency order. Docker and Gitea assets cannot join it yet, and npm
|
|
2475
|
+
* versions package.json, which a Cargo-versioned project does not carry.
|
|
2476
|
+
*/
|
|
2477
|
+
function validateCargoTarget(
|
|
2478
|
+
targets: Record<string, unknown>,
|
|
2479
|
+
projectType: unknown,
|
|
2480
|
+
findings: IDoctorFinding[],
|
|
2481
|
+
): void {
|
|
2482
|
+
let enabled: boolean;
|
|
2483
|
+
try {
|
|
2484
|
+
enabled = isCargoTargetEnabled(targets.cargo);
|
|
2485
|
+
} catch (error) {
|
|
2486
|
+
findings.push({
|
|
2487
|
+
level: "error",
|
|
2488
|
+
message: error instanceof Error ? error.message : String(error),
|
|
2489
|
+
});
|
|
2490
|
+
return;
|
|
2491
|
+
}
|
|
2492
|
+
const targetEnabled = (keyArg: string): unknown => {
|
|
2493
|
+
const target = targets[keyArg];
|
|
2494
|
+
return typeof target === "object" && target !== null
|
|
2495
|
+
? (target as { enabled?: unknown }).enabled
|
|
2496
|
+
: undefined;
|
|
2497
|
+
};
|
|
2498
|
+
const npmTarget = targets.npm;
|
|
2499
|
+
const npmRegistries =
|
|
2500
|
+
typeof npmTarget === "object" &&
|
|
2501
|
+
npmTarget !== null &&
|
|
2502
|
+
Array.isArray((npmTarget as { registries?: unknown }).registries)
|
|
2503
|
+
? ((npmTarget as { registries: unknown[] }).registries)
|
|
2504
|
+
: [];
|
|
2505
|
+
const npmEnabled = targetEnabled("npm") ?? npmRegistries.length > 0;
|
|
2506
|
+
if (projectType === "rust" && npmEnabled === true) {
|
|
2507
|
+
findings.push({
|
|
2508
|
+
level: "error",
|
|
2509
|
+
message:
|
|
2510
|
+
'projectType "rust" versions its Cargo workspace, so the npm release target has no package.json version to publish',
|
|
2511
|
+
fix: "Disable release.targets.npm, or publish npm packages from a TypeScript project.",
|
|
2512
|
+
});
|
|
2513
|
+
}
|
|
2514
|
+
if (!enabled) {
|
|
2515
|
+
if (targets.cargo !== undefined)
|
|
2516
|
+
findings.push({ level: "ok", message: "cargo release target is disabled" });
|
|
2517
|
+
return;
|
|
2518
|
+
}
|
|
2519
|
+
try {
|
|
2520
|
+
const cargo = resolveCargoTargetConfiguration(targets.cargo);
|
|
2521
|
+
if (projectType !== "rust")
|
|
2522
|
+
throw new Error(
|
|
2523
|
+
'The cargo release target publishes a Cargo workspace versioned by gitzone, which needs projectType "rust".',
|
|
2524
|
+
);
|
|
2525
|
+
if (targetEnabled("docker") === true || targetEnabled("giteaAssets") === true)
|
|
2526
|
+
throw new Error(
|
|
2527
|
+
"The cargo release target cannot combine Docker or Gitea assets yet.",
|
|
2528
|
+
);
|
|
2529
|
+
findings.push({
|
|
2530
|
+
level: "ok",
|
|
2531
|
+
message: `cargo release target publishes ${cargo.members ? cargo.members.join(", ") : "every publishable member"} to ${cargo.registries.join(", ")}; an accepted crate may stay unindexed for ${cargo.verificationWindowMinutes} min`,
|
|
2532
|
+
});
|
|
2533
|
+
} catch (error) {
|
|
2534
|
+
findings.push({
|
|
2535
|
+
level: "error",
|
|
2536
|
+
message: error instanceof Error ? error.message : String(error),
|
|
2537
|
+
fix: 'Set release.targets.cargo to { "enabled": true, "registries": ["crates-io"] } on a projectType "rust" project, or remove it.',
|
|
2538
|
+
});
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2411
2542
|
async function validateNpmTarget(
|
|
2412
2543
|
npmTarget: Record<string, any>,
|
|
2413
2544
|
findings: IDoctorFinding[],
|
|
@@ -2873,6 +3004,25 @@ async function validateDetectedProjectType(
|
|
|
2873
3004
|
cliConfig: Record<string, any>,
|
|
2874
3005
|
findings: IDoctorFinding[],
|
|
2875
3006
|
): Promise<void> {
|
|
3007
|
+
if (cliConfig.projectType === "rust") {
|
|
3008
|
+
// A Rust project needs no package.json; Cargo carries its version.
|
|
3009
|
+
const hasCargoManifest = await plugins.smartfs
|
|
3010
|
+
.file(plugins.path.join(process.cwd(), "Cargo.toml"))
|
|
3011
|
+
.exists();
|
|
3012
|
+
findings.push(
|
|
3013
|
+
hasCargoManifest
|
|
3014
|
+
? {
|
|
3015
|
+
level: "ok",
|
|
3016
|
+
message: "Detected a root Cargo.toml for projectType rust",
|
|
3017
|
+
}
|
|
3018
|
+
: {
|
|
3019
|
+
level: "error",
|
|
3020
|
+
message: 'projectType "rust" needs a Cargo workspace at the project root, and there is no Cargo.toml',
|
|
3021
|
+
fix: "Run this command from the project root, or correct @git.zone/cli.projectType.",
|
|
3022
|
+
},
|
|
3023
|
+
);
|
|
3024
|
+
return;
|
|
3025
|
+
}
|
|
2876
3026
|
const packageJsonPath = plugins.path.join(process.cwd(), "package.json");
|
|
2877
3027
|
const hasPackageJson = await plugins.smartfs.file(packageJsonPath).exists();
|
|
2878
3028
|
|
|
@@ -6,6 +6,7 @@ import { ScafTemplate } from '../../mod_template/classes.scaftemplate.js';
|
|
|
6
6
|
import { logger, logVerbose } from '../../gitzone.logging.js';
|
|
7
7
|
import { getCliConfigValue, readSmartconfigFile } from '../../helpers.smartconfig.js';
|
|
8
8
|
import { getSealedReleaseConfigError } from '../../helpers.sealedrelease.js';
|
|
9
|
+
import { shellQuote } from '../../helpers.tstest.js';
|
|
9
10
|
import {
|
|
10
11
|
assertManagedAssetsCurrent,
|
|
11
12
|
managedAssetKinds,
|
|
@@ -60,12 +61,10 @@ const normalizeRepository = (assetsConfig: Record<string, any>, moduleConfig: Re
|
|
|
60
61
|
const repository = isPlainObject(assetsConfig.repository) ? assetsConfig.repository : {};
|
|
61
62
|
const host = repository.host || moduleConfig.githost || 'code.foss.global';
|
|
62
63
|
const path = repository.path || [moduleConfig.gitscope, moduleConfig.gitrepo].filter(Boolean).join('/');
|
|
63
|
-
const branch = repository.branch || 'main';
|
|
64
64
|
const baseUrl = `https://${host}/${path}`;
|
|
65
65
|
return {
|
|
66
66
|
host,
|
|
67
67
|
path,
|
|
68
|
-
branch,
|
|
69
68
|
baseUrl,
|
|
70
69
|
apiBaseUrl: `https://${host}/api/v1/repos/${path}`,
|
|
71
70
|
gitUrl: `${baseUrl}.git`,
|
|
@@ -217,16 +216,6 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
217
216
|
},
|
|
218
217
|
];
|
|
219
218
|
}
|
|
220
|
-
const installer = isPlainObject(assetsConfig.installer) ? assetsConfig.installer : {};
|
|
221
|
-
if (installer.distribution && !['rawBranch', 'releaseAsset'].includes(installer.distribution)) {
|
|
222
|
-
return [
|
|
223
|
-
{
|
|
224
|
-
level: 'error',
|
|
225
|
-
module: this.name,
|
|
226
|
-
message: `Unsupported installer distribution: ${installer.distribution}`,
|
|
227
|
-
},
|
|
228
|
-
];
|
|
229
|
-
}
|
|
230
219
|
return [];
|
|
231
220
|
}
|
|
232
221
|
|
|
@@ -291,6 +280,9 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
291
280
|
? await readBinaryBuild(paths.cwd, await readSmartconfigFile(paths.cwd))
|
|
292
281
|
: { outDir: '', targets: [] };
|
|
293
282
|
const binaryTargets = binaryBuild.targets;
|
|
283
|
+
// install.sh installs on Linux and macOS only; Windows users take the release's .exe asset.
|
|
284
|
+
const installerTargets = binaryTargets.filter((target) => target.os !== 'windows');
|
|
285
|
+
const windowsTargets = binaryTargets.filter((target) => target.os === 'windows');
|
|
294
286
|
const binaryConfig = isPlainObject(assetsConfig.binary) ? assetsConfig.binary : {};
|
|
295
287
|
const installFileName = binaryConfig.installFileName || cliName;
|
|
296
288
|
const installerAssetName = plugins.path.basename(
|
|
@@ -328,6 +320,10 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
328
320
|
targets: binaryTargets,
|
|
329
321
|
supportedPlatformText: binaryTargets.map((target) => target.label).join(', '),
|
|
330
322
|
hasTargets: binaryTargets.length > 0,
|
|
323
|
+
installerTargets,
|
|
324
|
+
installerPlatformText: installerTargets.map((target) => target.label).join(', '),
|
|
325
|
+
windowsTargets,
|
|
326
|
+
hasWindowsTargets: windowsTargets.length > 0,
|
|
331
327
|
},
|
|
332
328
|
installer: installerConfig,
|
|
333
329
|
npmWrapper: npmWrapperConfig,
|
|
@@ -347,17 +343,18 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
347
343
|
const service = isPlainObject(installer.service) ? installer.service : {};
|
|
348
344
|
const file = installer.file || 'install.sh';
|
|
349
345
|
const releaseAssetName = plugins.path.basename(file);
|
|
350
|
-
// Release assets are readable without an account on every Gitea; `rawBranch` is an explicit opt-in for hosts
|
|
351
|
-
// that serve raw files anonymously (code.foss.global serves raw/src to signed-in users only).
|
|
352
|
-
const distribution = installer.distribution || 'releaseAsset';
|
|
353
346
|
const versionSelection = uniqueStringArray(installer.versionSelection, ['latest', 'version']);
|
|
354
347
|
const detectNames = uniqueStringArray(service.detectNames, service.name ? [service.name] : [cliName]);
|
|
355
348
|
const removeLegacyUnits = uniqueStringArray(service.removeLegacyUnits || []);
|
|
356
349
|
const ensureDirs = uniqueStringArray(installer.ensureDirs);
|
|
357
350
|
const preservePaths = uniqueStringArray(installer.preservePaths);
|
|
358
351
|
const successHints = uniqueStringArray(installer.successHints, [`${cliName} --version`, `${cliName} --help`]);
|
|
359
|
-
const
|
|
360
|
-
|
|
352
|
+
const refreshCommand = typeof service.refreshCommand === 'string' ? service.refreshCommand.trim() : '';
|
|
353
|
+
const sourceCommands = uniqueStringArray(source.commands);
|
|
354
|
+
const sourceValidateCommand = source.validate || `node ${source.executable || 'cli.js'} --version`;
|
|
355
|
+
// The installer is a release asset, which every Gitea serves without an account; raw/ and src/ URLs are not
|
|
356
|
+
// (code.foss.global serves them to signed-in users only), so no generated URL points there. Gitea (like
|
|
357
|
+
// GitHub) resolves the `latest` download path to the newest published release.
|
|
361
358
|
const releaseAssetInstallUrl = `${repository.baseUrl}/releases/download/latest/${releaseAssetName}`;
|
|
362
359
|
const releaseNotesInstallUrl = `${repository.baseUrl}/releases/download/$VERSION/${releaseAssetName}`;
|
|
363
360
|
|
|
@@ -365,10 +362,9 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
365
362
|
...installer,
|
|
366
363
|
enabled: installer.enabled !== false,
|
|
367
364
|
file,
|
|
368
|
-
distribution,
|
|
369
365
|
releaseAssetName,
|
|
370
|
-
publicInstallUrl:
|
|
371
|
-
releaseNotesInstallUrl
|
|
366
|
+
publicInstallUrl: releaseAssetInstallUrl,
|
|
367
|
+
releaseNotesInstallUrl,
|
|
372
368
|
installDir: installer.installDir || `/opt/${cliName}`,
|
|
373
369
|
binDir: installer.binDir || '/usr/local/bin',
|
|
374
370
|
defaultMode: modes.default || 'binary',
|
|
@@ -377,10 +373,12 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
377
373
|
source: {
|
|
378
374
|
...source,
|
|
379
375
|
enabled: source.enabled === true,
|
|
380
|
-
commands:
|
|
376
|
+
commands: sourceCommands,
|
|
377
|
+
commandShellWords: sourceCommands.map((command) => shellQuote(command)),
|
|
381
378
|
executable: source.executable || 'cli.js',
|
|
382
379
|
executableFiles: uniqueStringArray(source.executableFiles, source.executable ? [source.executable] : ['cli.js']),
|
|
383
|
-
validateCommand:
|
|
380
|
+
validateCommand: sourceValidateCommand,
|
|
381
|
+
validateCommandShellWord: shellQuote(sourceValidateCommand),
|
|
384
382
|
},
|
|
385
383
|
service: {
|
|
386
384
|
...service,
|
|
@@ -388,13 +386,18 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
388
386
|
removeLegacyUnits,
|
|
389
387
|
hasLegacyUnitRemoval: removeLegacyUnits.length > 0,
|
|
390
388
|
restartName: service.restartName || detectNames[0] || cliName,
|
|
391
|
-
hasRefreshCommand:
|
|
389
|
+
hasRefreshCommand: refreshCommand.length > 0,
|
|
390
|
+
// Configured commands and hints reach install.sh only as single-quoted shell words, so quotes, `$`,
|
|
391
|
+
// `#` and newlines in them can neither break the script nor change the code around them.
|
|
392
|
+
refreshCommandShellWord: shellQuote(refreshCommand),
|
|
393
|
+
startHintShellWord: shellQuote(typeof service.startHint === 'string' ? service.startHint : ''),
|
|
392
394
|
},
|
|
393
395
|
ensureDirs,
|
|
394
396
|
preservePaths,
|
|
395
397
|
primaryPreservePath: preservePaths[0],
|
|
396
398
|
hasPreservePaths: preservePaths.length > 0,
|
|
397
399
|
successHints,
|
|
400
|
+
successHintShellWords: successHints.map((hint) => shellQuote(hint)),
|
|
398
401
|
extraFiles: extrasArg.installed,
|
|
399
402
|
};
|
|
400
403
|
}
|
|
@@ -417,10 +420,8 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
417
420
|
extrasArg: IBinaryExtras,
|
|
418
421
|
): Record<string, any> {
|
|
419
422
|
const releaseWorkflow = isPlainObject(assetsConfig.releaseWorkflow) ? assetsConfig.releaseWorkflow : {};
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
? releaseWorkflow.includeInstallerAsset
|
|
423
|
-
: installerConfig.enabled !== false && installerConfig.distribution === 'releaseAsset';
|
|
423
|
+
// The release uploads the installer exactly when it is enabled: its usage text names that release asset.
|
|
424
|
+
const includeInstallerAsset = installerConfig.enabled !== false;
|
|
424
425
|
// Exactly the files this release built: the output directory can still hold
|
|
425
426
|
// executables of removed targets or an interrupted build's work directory.
|
|
426
427
|
const releaseFileNames = binaryBuild.targets.flatMap((target) => [target.name, ...target.noticeFiles]);
|
|
@@ -433,7 +434,7 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
433
434
|
enabled: releaseWorkflow.enabled !== false,
|
|
434
435
|
file: releaseWorkflow.file || '.gitea/workflows/release.yml',
|
|
435
436
|
installCommand: releaseWorkflow.installCommand || 'pnpm install --frozen-lockfile --ignore-scripts',
|
|
436
|
-
compileCommand: releaseWorkflow.compileCommand || 'pnpm exec
|
|
437
|
+
compileCommand: releaseWorkflow.compileCommand || 'pnpm exec tsrepo bundle && pnpm exec tsrepo sea build',
|
|
437
438
|
packNpmArtifact: releaseWorkflow.packNpmArtifact === true,
|
|
438
439
|
includeInstallerAsset,
|
|
439
440
|
releaseFileNames,
|
|
@@ -10,22 +10,26 @@ export class GitignoreFormatter extends BaseFormatter {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* Read the standard gitignore template from the asset file,
|
|
14
|
-
*
|
|
13
|
+
* Read the standard gitignore template from the asset file, stripping the
|
|
14
|
+
* YAML frontmatter. A projectType "rust" repository uses the `gitignore_rust`
|
|
15
|
+
* template, which also ignores Cargo's root `/target/`; the `rust` scaffold
|
|
16
|
+
* merges the same template.
|
|
15
17
|
*/
|
|
16
18
|
private async getStandardTemplate(): Promise<string> {
|
|
17
|
-
const
|
|
19
|
+
const templateName =
|
|
20
|
+
this.project.gitzoneConfig?.data?.projectType === 'rust' ? 'gitignore_rust' : 'gitignore';
|
|
21
|
+
const templatePath = plugins.path.join(paths.templatesDir, templateName, '_gitignore');
|
|
18
22
|
const raw = (await plugins.smartfs
|
|
19
23
|
.file(templatePath)
|
|
20
24
|
.encoding('utf8')
|
|
21
25
|
.read()) as string;
|
|
22
26
|
|
|
23
|
-
// Strip YAML frontmatter (---\n...\n---)
|
|
27
|
+
// Strip YAML frontmatter (---\n...\n---); the callers add the final newline.
|
|
24
28
|
const frontmatterEnd = raw.indexOf('---', 3);
|
|
25
29
|
if (frontmatterEnd !== -1) {
|
|
26
|
-
return raw.slice(frontmatterEnd + 3).
|
|
30
|
+
return raw.slice(frontmatterEnd + 3).trim();
|
|
27
31
|
}
|
|
28
|
-
return raw;
|
|
32
|
+
return raw.trimEnd();
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
async analyze(): Promise<IPlannedChange[]> {
|
|
@@ -10,6 +10,10 @@ import { logger } from '../../gitzone.logging.js';
|
|
|
10
10
|
|
|
11
11
|
const INCOMPATIBLE_LICENSES: string[] = ['AGPL', 'GPL', 'SSPL'];
|
|
12
12
|
|
|
13
|
+
/** A root license text: `license`, `license.md`, `LICENSE-MIT`, `COPYING`, any case. */
|
|
14
|
+
export const isLicenseFileName = (nameArg: string): boolean =>
|
|
15
|
+
/^(licen[cs]e|copying)([.-][^/]*)?$/i.test(nameArg);
|
|
16
|
+
|
|
13
17
|
export class LicenseFormatter extends BaseFormatter {
|
|
14
18
|
get name(): string {
|
|
15
19
|
return 'license';
|
|
@@ -27,12 +31,14 @@ export class LicenseFormatter extends BaseFormatter {
|
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
async validate(): Promise<IFormatWarning[]> {
|
|
34
|
+
const warnings = await this.validateLicenseFile();
|
|
30
35
|
const result = await this.checkLicenses();
|
|
31
36
|
if (!result || result.failingModules.length === 0) {
|
|
32
|
-
return
|
|
37
|
+
return warnings;
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
return [
|
|
41
|
+
...warnings,
|
|
36
42
|
{
|
|
37
43
|
level: 'error',
|
|
38
44
|
module: this.name,
|
|
@@ -73,6 +79,25 @@ export class LicenseFormatter extends BaseFormatter {
|
|
|
73
79
|
// No file changes for license formatter
|
|
74
80
|
}
|
|
75
81
|
|
|
82
|
+
/**
|
|
83
|
+
* A Rust repository ships its crates' license text, so it must carry one at
|
|
84
|
+
* its root. Which license applies is the project's choice; format only
|
|
85
|
+
* checks that the text is there.
|
|
86
|
+
*/
|
|
87
|
+
private async validateLicenseFile(): Promise<IFormatWarning[]> {
|
|
88
|
+
if (this.project.gitzoneConfig?.data?.projectType !== 'rust') return [];
|
|
89
|
+
const entries = await plugins.fs.readdir(process.cwd(), { withFileTypes: true });
|
|
90
|
+
if (entries.some((entry) => entry.isFile() && isLicenseFileName(entry.name))) return [];
|
|
91
|
+
return [
|
|
92
|
+
{
|
|
93
|
+
level: 'error',
|
|
94
|
+
module: this.name,
|
|
95
|
+
message:
|
|
96
|
+
'No license file at the repository root: a Rust repository ships its license text with its crates. Add license.md (or LICENSE, LICENSE-MIT, ...).',
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
}
|
|
100
|
+
|
|
76
101
|
private async checkLicenses(): Promise<{
|
|
77
102
|
failingModules: IPnpmLicensedPackage[];
|
|
78
103
|
} | undefined> {
|
|
@@ -4,6 +4,8 @@ import * as plugins from '../mod.plugins.js';
|
|
|
4
4
|
import * as paths from '../../paths.js';
|
|
5
5
|
import { logger, logVerbose } from '../../gitzone.logging.js';
|
|
6
6
|
import { resolvePackageFiles } from '../../helpers.packagefiles.js';
|
|
7
|
+
import { getCliConfigValue } from '../../helpers.smartconfig.js';
|
|
8
|
+
import { isNpmReleaseTargetEnabled } from '../../helpers.releasetargets.js';
|
|
7
9
|
|
|
8
10
|
export class PackageJsonFormatter extends BaseFormatter {
|
|
9
11
|
get name(): string {
|
|
@@ -14,6 +16,13 @@ export class PackageJsonFormatter extends BaseFormatter {
|
|
|
14
16
|
const changes: IPlannedChange[] = [];
|
|
15
17
|
const packageJsonPath = 'package.json';
|
|
16
18
|
|
|
19
|
+
// A Rust repository needs no package.json; one that installs tools
|
|
20
|
+
// through it keeps it as its own.
|
|
21
|
+
if (this.project.gitzoneConfig?.data?.projectType === 'rust') {
|
|
22
|
+
logVerbose('projectType rust: package.json is not formatted');
|
|
23
|
+
return changes;
|
|
24
|
+
}
|
|
25
|
+
|
|
17
26
|
// Check if file exists
|
|
18
27
|
const exists = await plugins.smartfs.file(packageJsonPath).exists();
|
|
19
28
|
if (!exists) {
|
|
@@ -51,8 +60,11 @@ export class PackageJsonFormatter extends BaseFormatter {
|
|
|
51
60
|
packageJson.type = 'module';
|
|
52
61
|
}
|
|
53
62
|
|
|
54
|
-
//
|
|
55
|
-
|
|
63
|
+
// A project without an npm release target is private by default. With one, `private` decides whether the
|
|
64
|
+
// release publishes the root package, so it stays the project's own choice: setting it would make a
|
|
65
|
+
// project that publishes its root package unpublishable.
|
|
66
|
+
const npmReleaseTarget = await getCliConfigValue<unknown>('release.targets.npm', undefined, paths.cwd);
|
|
67
|
+
if (packageJson.private === undefined && !isNpmReleaseTargetEnabled(npmReleaseTarget)) {
|
|
56
68
|
packageJson.private = true;
|
|
57
69
|
}
|
|
58
70
|
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { BaseFormatter } from '../classes.baseformatter.js';
|
|
2
|
+
import type { IPlannedChange } from '../interfaces.format.js';
|
|
3
|
+
import * as plugins from '../mod.plugins.js';
|
|
4
|
+
import { logger } from '../../gitzone.logging.js';
|
|
5
|
+
import { resolveRsrepoEngineBinary } from '../../mod_release/helpers.rsrepoengine.js';
|
|
6
|
+
import { formatCommandFailure } from '../../mod_release/helpers.commandfailure.js';
|
|
7
|
+
|
|
8
|
+
const rsrepoFmtTimeoutMs = 10 * 60_000;
|
|
9
|
+
|
|
10
|
+
/** Every `Diff in <file>:<line>:` heading of `cargo fmt --check`, as absolute file paths. */
|
|
11
|
+
export const parseRustfmtDiffFiles = (outputArg: string): string[] => {
|
|
12
|
+
// rustfmt colours its diff even when it writes into a pipe.
|
|
13
|
+
const plain = outputArg.replace(/\u001b\[[0-9;]*[A-Za-z]|\u001b\(B/g, '');
|
|
14
|
+
const files: string[] = [];
|
|
15
|
+
for (const match of plain.matchAll(/^Diff in (.+?):\d+:\s*$/gm)) {
|
|
16
|
+
if (!files.includes(match[1])) files.push(match[1]);
|
|
17
|
+
}
|
|
18
|
+
return files;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Rust sources of a projectType "rust" workspace, formatted by rustfmt
|
|
23
|
+
* through the project's rsrepo (`rsrepo fmt --check` to plan, `rsrepo fmt`
|
|
24
|
+
* to write). The plan names each file rustfmt would change; rustfmt owns the
|
|
25
|
+
* content, so the write formats the workspace in one run.
|
|
26
|
+
*/
|
|
27
|
+
export class RustfmtFormatter extends BaseFormatter {
|
|
28
|
+
get name(): string {
|
|
29
|
+
return 'rustfmt';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private get isRustProject(): boolean {
|
|
33
|
+
return this.project.gitzoneConfig?.data?.projectType === 'rust';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private async runRsrepoFmt(checkArg: boolean): Promise<plugins.smartshell.IExecResult> {
|
|
37
|
+
let binary: string;
|
|
38
|
+
try {
|
|
39
|
+
binary = await resolveRsrepoEngineBinary(process.cwd());
|
|
40
|
+
} catch (error) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
`Rust formatting runs through rsrepo: ${error instanceof Error ? error.message : String(error)}`,
|
|
43
|
+
{ cause: error },
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
const smartshellInstance = new plugins.smartshell.Smartshell({ executor: 'bash', sourceFilePaths: [] });
|
|
47
|
+
return smartshellInstance.execSpawn(binary, checkArg ? ['fmt', '--check'] : ['fmt'], {
|
|
48
|
+
cwd: process.cwd(),
|
|
49
|
+
silent: true,
|
|
50
|
+
timeout: rsrepoFmtTimeoutMs,
|
|
51
|
+
timeoutKillGraceMs: 5_000,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async analyze(): Promise<IPlannedChange[]> {
|
|
56
|
+
if (!this.isRustProject) return [];
|
|
57
|
+
const result = await this.runRsrepoFmt(true);
|
|
58
|
+
if (result.exitCode === 0 && !result.timedOut) return [];
|
|
59
|
+
const files = parseRustfmtDiffFiles(result.combinedOutput);
|
|
60
|
+
// A failure without a diff is not a formatting difference: a missing
|
|
61
|
+
// rustfmt, a parse error or a broken workspace.
|
|
62
|
+
if (files.length === 0 || result.timedOut) {
|
|
63
|
+
throw new Error(
|
|
64
|
+
formatCommandFailure('`rsrepo fmt --check` failed without a formatting diff.', result, {
|
|
65
|
+
command: 'rsrepo fmt --check',
|
|
66
|
+
timeoutMs: rsrepoFmtTimeoutMs,
|
|
67
|
+
output: 'combined',
|
|
68
|
+
}),
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
return files.map((file) => ({
|
|
72
|
+
type: 'modify' as const,
|
|
73
|
+
path: plugins.path.relative(process.cwd(), file) || file,
|
|
74
|
+
module: this.name,
|
|
75
|
+
description: 'Format with rustfmt (rsrepo fmt)',
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** rustfmt formats the whole workspace in one run. */
|
|
80
|
+
async execute(changes: IPlannedChange[]): Promise<void> {
|
|
81
|
+
const startTime = this.stats.moduleStartTime(this.name);
|
|
82
|
+
this.stats.startModule(this.name);
|
|
83
|
+
try {
|
|
84
|
+
const result = await this.runRsrepoFmt(false);
|
|
85
|
+
const succeeded = result.exitCode === 0 && !result.timedOut;
|
|
86
|
+
for (const change of changes) {
|
|
87
|
+
this.stats.recordFileOperation(this.name, change.type, succeeded);
|
|
88
|
+
}
|
|
89
|
+
if (!succeeded) {
|
|
90
|
+
throw new Error(
|
|
91
|
+
formatCommandFailure('`rsrepo fmt` failed.', result, {
|
|
92
|
+
command: 'rsrepo fmt',
|
|
93
|
+
timeoutMs: rsrepoFmtTimeoutMs,
|
|
94
|
+
output: 'combined',
|
|
95
|
+
}),
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
logger.log('info', `Formatted ${changes.length} Rust file(s) with rsrepo fmt`);
|
|
99
|
+
} finally {
|
|
100
|
+
this.stats.endModule(this.name, startTime);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async applyChange(_change: IPlannedChange): Promise<void> {
|
|
105
|
+
// execute() runs rustfmt once for every planned file.
|
|
106
|
+
}
|
|
107
|
+
}
|