@git.zone/cli 8.6.0 → 8.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/templates/asset_tspack_release_gitea/scripts/gitzone-release-api.mjs +9 -3
- package/assets/templates/asset_tspack_release_gitea/scripts/gitzone-sealed-release.mjs +10 -3
- package/assets/templates/vscode/.vscode/settings.json +57 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.gitzoneconfig.d.ts +3 -0
- package/dist_ts/classes.gitzoneconfig.js +1 -1
- package/dist_ts/helpers.objects.d.ts +2 -0
- package/dist_ts/helpers.objects.js +3 -0
- package/dist_ts/helpers.packagefiles.d.ts +74 -0
- package/dist_ts/helpers.packagefiles.js +177 -0
- package/dist_ts/helpers.workflow.d.ts +18 -0
- package/dist_ts/helpers.workflow.js +45 -2
- package/dist_ts/mod_config/index.js +69 -2
- package/dist_ts/mod_format/formatters/packagejson.formatter.js +8 -27
- package/dist_ts/mod_release/helpers.npmartifactcheck.d.ts +93 -0
- package/dist_ts/mod_release/helpers.npmartifactcheck.js +279 -0
- package/dist_ts/mod_release/index.d.ts +15 -0
- package/dist_ts/mod_release/index.js +82 -17
- package/dist_ts/plugins.d.ts +2 -1
- package/dist_ts/plugins.js +3 -2
- package/package.json +4 -3
- package/readme.md +107 -15
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.gitzoneconfig.ts +3 -0
- package/ts/helpers.objects.ts +5 -0
- package/ts/helpers.packagefiles.ts +273 -0
- package/ts/helpers.workflow.ts +70 -1
- package/ts/mod_config/index.ts +78 -0
- package/ts/mod_format/formatters/packagejson.formatter.ts +7 -27
- package/ts/mod_release/helpers.npmartifactcheck.ts +397 -0
- package/ts/mod_release/index.ts +115 -26
- package/ts/plugins.ts +2 -0
package/ts/mod_release/index.ts
CHANGED
|
@@ -84,6 +84,11 @@ import {
|
|
|
84
84
|
type IReleaseLine,
|
|
85
85
|
} from "./helpers.releaseline.js";
|
|
86
86
|
import { executeReleasePublication } from "./helpers.releasepublication.js";
|
|
87
|
+
import {
|
|
88
|
+
findNpmArtifactCheckError,
|
|
89
|
+
verifyPackedNpmArtifacts,
|
|
90
|
+
} from "./helpers.npmartifactcheck.js";
|
|
91
|
+
import { assertPackageJsonFilesCurrent } from "../helpers.packagefiles.js";
|
|
87
92
|
import { formatCommandFailure } from "./helpers.commandfailure.js";
|
|
88
93
|
import {
|
|
89
94
|
formatReleaseDuration,
|
|
@@ -249,6 +254,9 @@ const runInternal = async (argvArg: any): Promise<void> => {
|
|
|
249
254
|
return;
|
|
250
255
|
}
|
|
251
256
|
|
|
257
|
+
if (workflow.packageFilesConfigured) {
|
|
258
|
+
await assertPackageJsonFilesCurrent(branchContext.sourceCwd);
|
|
259
|
+
}
|
|
252
260
|
const preflightTsdocker = workflow.targets.includes("docker")
|
|
253
261
|
? new TsdockerReleaseClient(smartshellInstance, branchContext.sourceCwd)
|
|
254
262
|
: undefined;
|
|
@@ -427,7 +435,14 @@ const runInternal = async (argvArg: any): Promise<void> => {
|
|
|
427
435
|
});
|
|
428
436
|
} catch (error) {
|
|
429
437
|
throw new Error(
|
|
430
|
-
|
|
438
|
+
describeTaggedReleaseFailure(error, {
|
|
439
|
+
version: newVersion,
|
|
440
|
+
releaseBranch: branchContext.releaseBranch,
|
|
441
|
+
releaseCwd,
|
|
442
|
+
intentPath: new ReleaseJournalStore(
|
|
443
|
+
await resolveGitCommonDirectory(smartshellInstance, releaseCwd),
|
|
444
|
+
).getIntentPath(newVersion),
|
|
445
|
+
}),
|
|
431
446
|
{ cause: error },
|
|
432
447
|
);
|
|
433
448
|
}
|
|
@@ -454,6 +469,45 @@ const runInternal = async (argvArg: any): Promise<void> => {
|
|
|
454
469
|
printReleaseJournalSummary(finalJournal);
|
|
455
470
|
};
|
|
456
471
|
|
|
472
|
+
/**
|
|
473
|
+
* What an operator does after the release failed between its tag and its
|
|
474
|
+
* journal. Most such failures are environmental, and resuming the recorded
|
|
475
|
+
* release prepares it again. A failed packed-artifact check comes from the
|
|
476
|
+
* release commit itself and would fail again, so its way out is to abandon the
|
|
477
|
+
* local release, fix the package and release again; gitzone has no command
|
|
478
|
+
* for that, so the steps are spelled out.
|
|
479
|
+
*/
|
|
480
|
+
export const describeTaggedReleaseFailure = (
|
|
481
|
+
errorArg: unknown,
|
|
482
|
+
optionsArg: {
|
|
483
|
+
version: string;
|
|
484
|
+
releaseBranch: string;
|
|
485
|
+
/** The checkout that holds the release commit and tag. */
|
|
486
|
+
releaseCwd: string;
|
|
487
|
+
intentPath: string;
|
|
488
|
+
},
|
|
489
|
+
): string => {
|
|
490
|
+
const message = errorArg instanceof Error ? errorArg.message : String(errorArg);
|
|
491
|
+
const { version, releaseBranch, releaseCwd, intentPath } = optionsArg;
|
|
492
|
+
const artifactCheck = findNpmArtifactCheckError(errorArg);
|
|
493
|
+
if (!artifactCheck) {
|
|
494
|
+
return `${message} The release commit and tag v${version} are recorded locally; \`gitzone release resume ${version} -y\` prepares and publishes them.`;
|
|
495
|
+
}
|
|
496
|
+
const what = {
|
|
497
|
+
contents: "a packed tarball is larger than the release reads to check it",
|
|
498
|
+
entryPoints: "a packed tarball lacks entry points its package.json names",
|
|
499
|
+
publishSize: "a publish body exceeds its registry's maxPublishBytes limit",
|
|
500
|
+
}[artifactCheck.check];
|
|
501
|
+
const git = `git -C ${shellQuote(releaseCwd)}`;
|
|
502
|
+
return (
|
|
503
|
+
`${artifactCheck.message} The release v${version} stopped because ${what}. This comes from the release commit itself, ` +
|
|
504
|
+
`so preparing that commit again fails the same way; nothing was pushed. Abandon the local release: ` +
|
|
505
|
+
`confirm \`${git} log -1 --format=%s\` prints v${version} and \`${git} branch --show-current\` prints ${releaseBranch}, ` +
|
|
506
|
+
`then run \`${git} tag -d v${version}\` and \`${git} reset --hard HEAD^\`, and delete ${shellQuote(intentPath)}. ` +
|
|
507
|
+
`Fix the package, commit, and release again.`
|
|
508
|
+
);
|
|
509
|
+
};
|
|
510
|
+
|
|
457
511
|
/**
|
|
458
512
|
* Test logs are release diagnostics, so only a journal that reached completion
|
|
459
513
|
* may drop them. A failure keeps them for the investigation, and a journal left
|
|
@@ -857,32 +911,49 @@ const prepareRecordedRelease = async (
|
|
|
857
911
|
printReleasePhase(
|
|
858
912
|
`Preparing the journal of recorded release v${version} from ${refs.mainOid}`,
|
|
859
913
|
);
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
914
|
+
try {
|
|
915
|
+
await prepareTaggedRelease({
|
|
916
|
+
pnpmCapability,
|
|
917
|
+
smartshell: smartshellArg,
|
|
918
|
+
workflow,
|
|
919
|
+
releaseCwd: paths.cwd,
|
|
920
|
+
releasePushUrl: branch.pushUrl,
|
|
921
|
+
expectedRemoteMainOid,
|
|
922
|
+
version,
|
|
923
|
+
versionFloor: intentArg.release.versionFloor,
|
|
924
|
+
refs,
|
|
925
|
+
ensurePublicationState: async () => {
|
|
926
|
+
await verifyReleaseRefs(
|
|
927
|
+
smartshellArg,
|
|
928
|
+
paths.cwd,
|
|
929
|
+
branch.releaseBranch,
|
|
930
|
+
version,
|
|
931
|
+
refs,
|
|
932
|
+
);
|
|
933
|
+
await revalidateReleasePublicationState(
|
|
934
|
+
smartshellArg,
|
|
935
|
+
branch,
|
|
936
|
+
refs.mainOid,
|
|
937
|
+
expectedRemoteMainOid,
|
|
938
|
+
);
|
|
939
|
+
},
|
|
940
|
+
});
|
|
941
|
+
} catch (error) {
|
|
942
|
+
// An environmental failure keeps its own message: a later resume can
|
|
943
|
+
// still succeed. A failed artifact check cannot.
|
|
944
|
+
if (!findNpmArtifactCheckError(error)) throw error;
|
|
945
|
+
throw new Error(
|
|
946
|
+
describeTaggedReleaseFailure(error, {
|
|
875
947
|
version,
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
});
|
|
948
|
+
releaseBranch: branch.releaseBranch,
|
|
949
|
+
releaseCwd: paths.cwd,
|
|
950
|
+
intentPath: new ReleaseJournalStore(
|
|
951
|
+
await resolveGitCommonDirectory(smartshellArg, paths.cwd),
|
|
952
|
+
).getIntentPath(version),
|
|
953
|
+
}),
|
|
954
|
+
{ cause: error },
|
|
955
|
+
);
|
|
956
|
+
}
|
|
886
957
|
};
|
|
887
958
|
|
|
888
959
|
/**
|
|
@@ -1005,6 +1076,15 @@ export const createReleaseJournal = async (
|
|
|
1005
1076
|
optionsArg.pnpmCapability,
|
|
1006
1077
|
);
|
|
1007
1078
|
}
|
|
1079
|
+
printReleasePhase("Checking the packed npm artifacts");
|
|
1080
|
+
await verifyPackedNpmArtifacts({
|
|
1081
|
+
workflow: optionsArg.workflow,
|
|
1082
|
+
artifactDirectory: temporaryDirectory,
|
|
1083
|
+
artifacts: [
|
|
1084
|
+
...packages.map((entryArg) => entryArg.artifact),
|
|
1085
|
+
...(artifact ? [artifact] : []),
|
|
1086
|
+
],
|
|
1087
|
+
});
|
|
1008
1088
|
await verifyCleanTree(
|
|
1009
1089
|
optionsArg.smartshell,
|
|
1010
1090
|
npmSourceCwd,
|
|
@@ -2329,6 +2409,11 @@ async function printReleasePlan(
|
|
|
2329
2409
|
console.log(
|
|
2330
2410
|
`changelog: ${workflow.changelogFile}#${workflow.changelogPendingSection}`,
|
|
2331
2411
|
);
|
|
2412
|
+
if (workflow.packageFilesConfigured) {
|
|
2413
|
+
console.log(
|
|
2414
|
+
"package files: package.json files must equal what @git.zone/cli.packageFiles generates",
|
|
2415
|
+
);
|
|
2416
|
+
}
|
|
2332
2417
|
for (const line of describeReleaseVersion(versionResolutionArg)) {
|
|
2333
2418
|
console.log(line);
|
|
2334
2419
|
}
|
|
@@ -2337,6 +2422,10 @@ async function printReleasePlan(
|
|
|
2337
2422
|
`npm registries: ${workflow.npmRegistries.length > 0 ? workflow.npmRegistries.join(", ") : "none"}`,
|
|
2338
2423
|
);
|
|
2339
2424
|
console.log(`npm dist-tag: ${workflow.npmDistTag}`);
|
|
2425
|
+
const limits = Object.entries(workflow.npmMaxPublishBytes);
|
|
2426
|
+
console.log(
|
|
2427
|
+
`npm publish body limits: ${limits.length > 0 ? limits.map(([registry, limit]) => `${registry} ${limit} bytes`).join(", ") : "none configured"}`,
|
|
2428
|
+
);
|
|
2340
2429
|
for (const line of await describeReleaseLineDistTags(
|
|
2341
2430
|
workflow,
|
|
2342
2431
|
versionResolutionArg.version,
|
package/ts/plugins.ts
CHANGED
|
@@ -17,6 +17,7 @@ import * as smartupdate from '@push.rocks/smartupdate';
|
|
|
17
17
|
import * as smartshell from '@push.rocks/smartshell';
|
|
18
18
|
import * as smartnetwork from '@push.rocks/smartnetwork';
|
|
19
19
|
import * as smartfile from '@push.rocks/smartfile';
|
|
20
|
+
import * as smartarchive from '@push.rocks/smartarchive';
|
|
20
21
|
import { SmartFs, SmartFsProviderNode } from '@push.rocks/smartfs';
|
|
21
22
|
|
|
22
23
|
// @lossless.org scope
|
|
@@ -67,6 +68,7 @@ export {
|
|
|
67
68
|
smartshell,
|
|
68
69
|
smartnetwork,
|
|
69
70
|
smartfile,
|
|
71
|
+
smartarchive,
|
|
70
72
|
objectstorage,
|
|
71
73
|
s3,
|
|
72
74
|
tsdockerReleaseProtocol,
|