@git.zone/cli 6.6.2 → 6.7.2
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 +2 -1
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/gitzone.cli.js +2 -2
- package/dist_ts/helpers.workflow.d.ts +3 -0
- package/dist_ts/helpers.workflow.js +14 -1
- package/dist_ts/mod_config/index.js +4 -1
- package/dist_ts/mod_deprecate/helpers.deprecation.d.ts +12 -0
- package/dist_ts/mod_deprecate/helpers.deprecation.js +87 -0
- package/dist_ts/mod_deprecate/index.d.ts +1 -1
- package/dist_ts/mod_deprecate/index.js +77 -40
- package/dist_ts/mod_format/classes.baseformatter.d.ts +6 -0
- package/dist_ts/mod_format/classes.baseformatter.js +61 -1
- package/dist_ts/mod_format/classes.formatplanner.js +14 -3
- package/dist_ts/mod_format/classes.formatstats.d.ts +4 -1
- package/dist_ts/mod_format/classes.formatstats.js +11 -1
- package/dist_ts/mod_format/formatters/readme.formatter.d.ts +2 -1
- package/dist_ts/mod_format/formatters/readme.formatter.js +80 -14
- package/dist_ts/mod_format/index.js +2 -1
- package/dist_ts/mod_format/interfaces.format.d.ts +6 -2
- package/dist_ts/mod_format/interfaces.format.js +1 -1
- package/dist_ts/mod_release/classes.releasejournal.d.ts +17 -3
- package/dist_ts/mod_release/classes.releasejournal.js +144 -12
- package/dist_ts/mod_release/helpers.npmartifact.d.ts +3 -1
- package/dist_ts/mod_release/helpers.npmartifact.js +64 -5
- package/dist_ts/mod_release/helpers.releasepublication.js +72 -20
- package/dist_ts/mod_release/index.d.ts +24 -0
- package/dist_ts/mod_release/index.js +82 -22
- package/dist_ts/plugins.d.ts +2 -1
- package/dist_ts/plugins.js +3 -2
- package/package.json +2 -2
- package/readme.md +86 -3
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/gitzone.cli.ts +1 -1
- package/ts/helpers.workflow.ts +17 -0
- package/ts/mod_config/index.ts +3 -0
- package/ts/mod_deprecate/helpers.deprecation.ts +151 -0
- package/ts/mod_deprecate/index.ts +92 -41
- package/ts/mod_format/classes.baseformatter.ts +71 -0
- package/ts/mod_format/classes.formatplanner.ts +16 -3
- package/ts/mod_format/classes.formatstats.ts +14 -1
- package/ts/mod_format/formatters/readme.formatter.ts +89 -14
- package/ts/mod_format/index.ts +1 -0
- package/ts/mod_format/interfaces.format.ts +7 -2
- package/ts/mod_release/classes.releasejournal.ts +219 -20
- package/ts/mod_release/helpers.npmartifact.ts +120 -23
- package/ts/mod_release/helpers.releasepublication.ts +131 -16
- package/ts/mod_release/index.ts +127 -30
- package/ts/plugins.ts +2 -0
- package/readme.hints.md +0 -596
- package/readme.plan.md +0 -176
package/ts/mod_release/index.ts
CHANGED
|
@@ -34,6 +34,9 @@ import {
|
|
|
34
34
|
normalizeReleaseGitRemoteName,
|
|
35
35
|
normalizeReleaseVersion,
|
|
36
36
|
resolveGitCommonDirectory,
|
|
37
|
+
getReleaseArtifacts,
|
|
38
|
+
releasePackageArtifactFile,
|
|
39
|
+
type IReleasePackage,
|
|
37
40
|
type IReleaseArtifact,
|
|
38
41
|
type TReleaseJournal,
|
|
39
42
|
type IReleaseJournalV1,
|
|
@@ -115,6 +118,15 @@ const runInternal = async (argvArg: any): Promise<void> => {
|
|
|
115
118
|
planMode: workflow.confirmation === "plan",
|
|
116
119
|
});
|
|
117
120
|
printReleasePlan(workflow, branchContext);
|
|
121
|
+
if (
|
|
122
|
+
workflow.targets.includes("npm") &&
|
|
123
|
+
workflow.npmPackageSource === "tspublish"
|
|
124
|
+
) {
|
|
125
|
+
const packagePlan = await planReleasePackages(branchContext.sourceCwd);
|
|
126
|
+
console.log("npm packages (dependency order):");
|
|
127
|
+
for (const module of packagePlan.modules)
|
|
128
|
+
console.log(` ${module.name} (${module.folder})`);
|
|
129
|
+
}
|
|
118
130
|
if (workflow.confirmation === "plan") {
|
|
119
131
|
return;
|
|
120
132
|
}
|
|
@@ -346,6 +358,14 @@ const assertReleaseConfiguration = (
|
|
|
346
358
|
if (!workflowArg.targets.includes("npm")) {
|
|
347
359
|
return;
|
|
348
360
|
}
|
|
361
|
+
if (
|
|
362
|
+
workflowArg.npmPackageSource === "tspublish" &&
|
|
363
|
+
workflowArg.targets.includes("docker")
|
|
364
|
+
) {
|
|
365
|
+
throw new Error(
|
|
366
|
+
"tspublish package releases support Git and npm targets; use a separate Docker release repository.",
|
|
367
|
+
);
|
|
368
|
+
}
|
|
349
369
|
if (workflowArg.npmRegistries.length === 0) {
|
|
350
370
|
throw new Error("The npm release target requires at least one registry.");
|
|
351
371
|
}
|
|
@@ -410,7 +430,21 @@ const createDockerQualificationRequest = (
|
|
|
410
430
|
version: versionArg,
|
|
411
431
|
});
|
|
412
432
|
|
|
413
|
-
const
|
|
433
|
+
export const planReleasePackages = async (
|
|
434
|
+
cwdArg: string,
|
|
435
|
+
): Promise<plugins.tspublish.ITsPublishPlan> => {
|
|
436
|
+
const plan = await new plugins.tspublish.TsPublish().plan(cwdArg);
|
|
437
|
+
for (const module of plan.modules) {
|
|
438
|
+
if (module.registries.length !== 1 || module.registries[0] !== "useBase") {
|
|
439
|
+
throw new Error(
|
|
440
|
+
`${module.name}: GitZone-managed packages must declare registries: ["useBase"]. Configure destinations in release.targets.npm.`,
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
return plan;
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
export const createReleaseJournal = async (
|
|
414
448
|
optionsArg: ICreateReleaseJournalOptions,
|
|
415
449
|
): Promise<{ store: ReleaseJournalStore; journal: TReleaseJournal }> => {
|
|
416
450
|
const gitCommonDirectory = await resolveGitCommonDirectory(
|
|
@@ -437,13 +471,49 @@ const createReleaseJournal = async (
|
|
|
437
471
|
);
|
|
438
472
|
try {
|
|
439
473
|
let artifact: IReleaseArtifact | null = null;
|
|
474
|
+
const packages: IReleasePackage[] = [];
|
|
440
475
|
if (optionsArg.workflow.targets.includes("npm")) {
|
|
441
|
-
|
|
442
|
-
optionsArg.
|
|
443
|
-
optionsArg.
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
476
|
+
if (optionsArg.workflow.npmPackageSource === "tspublish") {
|
|
477
|
+
const plan = await planReleasePackages(optionsArg.releaseCwd);
|
|
478
|
+
if (plan.version !== optionsArg.version)
|
|
479
|
+
throw new Error("tspublish plan version differs from the release.");
|
|
480
|
+
const outputDirectory = plugins.path.join(
|
|
481
|
+
temporaryDirectory,
|
|
482
|
+
"prepared",
|
|
483
|
+
);
|
|
484
|
+
const prepared = await new plugins.tspublish.TsPublish().prepare(
|
|
485
|
+
optionsArg.releaseCwd,
|
|
486
|
+
outputDirectory,
|
|
487
|
+
);
|
|
488
|
+
if (
|
|
489
|
+
JSON.stringify(prepared.map(({ directory, ...module }) => module)) !==
|
|
490
|
+
JSON.stringify(plan.modules)
|
|
491
|
+
) {
|
|
492
|
+
throw new Error("tspublish package plan changed during preparation.");
|
|
493
|
+
}
|
|
494
|
+
for (const module of prepared) {
|
|
495
|
+
const packed = await packNpmArtifact(
|
|
496
|
+
optionsArg.smartshell,
|
|
497
|
+
module.directory,
|
|
498
|
+
temporaryDirectory,
|
|
499
|
+
optionsArg.version,
|
|
500
|
+
releasePackageArtifactFile(module.name),
|
|
501
|
+
);
|
|
502
|
+
if (packed.packageName !== module.name)
|
|
503
|
+
throw new Error(
|
|
504
|
+
"Prepared package identity changed during packing.",
|
|
505
|
+
);
|
|
506
|
+
packages.push({ folder: module.folder, artifact: packed });
|
|
507
|
+
}
|
|
508
|
+
await plugins.fs.rm(outputDirectory, { recursive: true, force: true });
|
|
509
|
+
} else {
|
|
510
|
+
artifact = await packNpmArtifact(
|
|
511
|
+
optionsArg.smartshell,
|
|
512
|
+
optionsArg.releaseCwd,
|
|
513
|
+
temporaryDirectory,
|
|
514
|
+
optionsArg.version,
|
|
515
|
+
);
|
|
516
|
+
}
|
|
447
517
|
await verifyCleanTree(
|
|
448
518
|
optionsArg.smartshell,
|
|
449
519
|
optionsArg.releaseCwd,
|
|
@@ -464,7 +534,7 @@ const createReleaseJournal = async (
|
|
|
464
534
|
const journal = finalizeJournalCompletion(
|
|
465
535
|
{
|
|
466
536
|
kind: "gitzone-release-journal",
|
|
467
|
-
schemaVersion: optionsArg.dockerRequest ? 2 : 1,
|
|
537
|
+
schemaVersion: packages.length ? 3 : optionsArg.dockerRequest ? 2 : 1,
|
|
468
538
|
revision: 1,
|
|
469
539
|
release: {
|
|
470
540
|
version: optionsArg.version,
|
|
@@ -473,6 +543,7 @@ const createReleaseJournal = async (
|
|
|
473
543
|
tagOid: optionsArg.refs.tagOid,
|
|
474
544
|
},
|
|
475
545
|
artifact,
|
|
546
|
+
...(packages.length ? { packages } : {}),
|
|
476
547
|
git: {
|
|
477
548
|
state: gitStatus.state,
|
|
478
549
|
attempts: gitStatus.attempts,
|
|
@@ -492,18 +563,26 @@ const createReleaseJournal = async (
|
|
|
492
563
|
alreadyPublished: optionsArg.workflow.targets.includes("npm")
|
|
493
564
|
? optionsArg.workflow.npmAlreadyPublished
|
|
494
565
|
: "success",
|
|
495
|
-
registries:
|
|
496
|
-
?
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
566
|
+
registries: packages.length
|
|
567
|
+
? packages.flatMap((entry) =>
|
|
568
|
+
optionsArg.workflow.npmRegistries.map((registry) => ({
|
|
569
|
+
...createInitialTargetStatus(true),
|
|
570
|
+
registry,
|
|
571
|
+
packageName: entry.artifact.packageName,
|
|
572
|
+
})),
|
|
573
|
+
)
|
|
574
|
+
: optionsArg.workflow.targets.includes("npm")
|
|
575
|
+
? optionsArg.workflow.npmRegistries.map((registryArg) => {
|
|
576
|
+
const status = createInitialTargetStatus(true);
|
|
577
|
+
return {
|
|
578
|
+
state: status.state,
|
|
579
|
+
attempts: status.attempts,
|
|
580
|
+
attempt: status.attempt,
|
|
581
|
+
error: status.error,
|
|
582
|
+
registry: registryArg,
|
|
583
|
+
};
|
|
584
|
+
})
|
|
585
|
+
: [],
|
|
507
586
|
},
|
|
508
587
|
...(optionsArg.dockerRequest
|
|
509
588
|
? {
|
|
@@ -675,13 +754,15 @@ const runReleaseResume = async (
|
|
|
675
754
|
await tsdocker.assertCapabilities();
|
|
676
755
|
await tsdocker.validate(journal.docker.request);
|
|
677
756
|
}
|
|
678
|
-
if (journal.
|
|
757
|
+
if (getReleaseArtifacts(journal).length) {
|
|
679
758
|
await assertPnpmReleaseCapability(smartshellInstance, paths.cwd);
|
|
680
759
|
await assertNoLegacyNpmPublisher(paths.cwd);
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
760
|
+
for (const artifact of getReleaseArtifacts(journal)) {
|
|
761
|
+
await verifyStoredNpmArtifact(
|
|
762
|
+
store.getArtifactPath(version, artifact.file),
|
|
763
|
+
artifact,
|
|
764
|
+
);
|
|
765
|
+
}
|
|
685
766
|
}
|
|
686
767
|
|
|
687
768
|
const branchContext = await inspectReleaseBranch({
|
|
@@ -773,17 +854,24 @@ const assertResumeConfiguration = async (
|
|
|
773
854
|
if (
|
|
774
855
|
journalArg.npm.registries.length > 0 &&
|
|
775
856
|
(JSON.stringify(currentRegistries) !==
|
|
776
|
-
JSON.stringify(
|
|
777
|
-
|
|
778
|
-
|
|
857
|
+
JSON.stringify([
|
|
858
|
+
...new Set(
|
|
859
|
+
journalArg.npm.registries.map((registryArg) => registryArg.registry),
|
|
860
|
+
),
|
|
861
|
+
]) ||
|
|
779
862
|
workflowArg.npmAccessLevel !== journalArg.npm.access ||
|
|
863
|
+
workflowArg.npmPackageSource !==
|
|
864
|
+
(journalArg.schemaVersion === 3 ? "tspublish" : "root") ||
|
|
780
865
|
workflowArg.npmAlreadyPublished !== journalArg.npm.alreadyPublished)
|
|
781
866
|
) {
|
|
782
867
|
throw new Error(
|
|
783
868
|
"Current npm release configuration does not match the journal.",
|
|
784
869
|
);
|
|
785
870
|
}
|
|
786
|
-
if (
|
|
871
|
+
if (
|
|
872
|
+
journalArg.git.state !== "skipped" ||
|
|
873
|
+
getReleaseArtifacts(journalArg).length
|
|
874
|
+
) {
|
|
787
875
|
await assertNoLegacyNpmPublisher(cwdArg);
|
|
788
876
|
}
|
|
789
877
|
};
|
|
@@ -797,7 +885,15 @@ const printReleaseJournalSummary = (journalArg: TReleaseJournal): void => {
|
|
|
797
885
|
);
|
|
798
886
|
console.log(`git: ${journalArg.git.state}`);
|
|
799
887
|
for (const registry of journalArg.npm.registries) {
|
|
800
|
-
console.log(
|
|
888
|
+
console.log(
|
|
889
|
+
`npm ${registry.packageName ? `${registry.packageName} ` : ""}${registry.registry}: ${registry.state}`,
|
|
890
|
+
);
|
|
891
|
+
}
|
|
892
|
+
if (journalArg.schemaVersion === 3) {
|
|
893
|
+
for (const { artifact } of journalArg.packages)
|
|
894
|
+
console.log(
|
|
895
|
+
`artifact ${artifact.packageName}: ${artifact.integrity} (${artifact.sha256})`,
|
|
896
|
+
);
|
|
801
897
|
}
|
|
802
898
|
if (journalArg.schemaVersion === 2) {
|
|
803
899
|
console.log(
|
|
@@ -1143,6 +1239,7 @@ function printReleasePlan(
|
|
|
1143
1239
|
`changelog: ${workflow.changelogFile}#${workflow.changelogPendingSection}`,
|
|
1144
1240
|
);
|
|
1145
1241
|
if (workflow.targets.includes("npm")) {
|
|
1242
|
+
console.log(`npm package source: ${workflow.npmPackageSource}`);
|
|
1146
1243
|
console.log(
|
|
1147
1244
|
`npm registries: ${workflow.npmRegistries.length > 0 ? workflow.npmRegistries.join(", ") : "none"}`,
|
|
1148
1245
|
);
|
package/ts/plugins.ts
CHANGED
|
@@ -20,6 +20,7 @@ import * as smartdelay from '@push.rocks/smartdelay';
|
|
|
20
20
|
import * as smartbucket from '@push.rocks/smartbucket';
|
|
21
21
|
import * as s3 from '@aws-sdk/client-s3';
|
|
22
22
|
import * as tsdockerReleaseProtocol from '@git.zone/tsdocker/dist_ts/classes.releaseprotocol.js';
|
|
23
|
+
import * as tspublish from '@git.zone/tspublish';
|
|
23
24
|
|
|
24
25
|
export type {
|
|
25
26
|
IReleaseCapabilitiesResult,
|
|
@@ -60,4 +61,5 @@ export {
|
|
|
60
61
|
smartbucket,
|
|
61
62
|
s3,
|
|
62
63
|
tsdockerReleaseProtocol,
|
|
64
|
+
tspublish,
|
|
63
65
|
};
|