@git.zone/cli 7.3.0 → 7.4.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.
@@ -43,6 +43,7 @@ import {
43
43
  type IReleasePackage,
44
44
  type IReleaseArtifact,
45
45
  type TReleaseJournal,
46
+ type TReleaseNpmAccess,
46
47
  type IReleaseJournalV1,
47
48
  type IReleaseJournalV2,
48
49
  releaseIntentKind,
@@ -56,6 +57,7 @@ import {
56
57
  import {
57
58
  assertNoLegacyNpmPublisher,
58
59
  assertNoStandaloneTspublishPublisher,
60
+ assertNpmRegistryAuthentication,
59
61
  assertPnpmReleaseCapability,
60
62
  hashReleaseDestination,
61
63
  normalizeNpmRegistryUrl,
@@ -431,6 +433,7 @@ const assertFreshReleaseCapabilities = async (
431
433
  cwdArg: string,
432
434
  pushUrlArg?: string,
433
435
  tsdockerArg?: ITsdockerReleaseClient,
436
+ authenticationNextStepArg = "release again",
434
437
  ): Promise<IPnpmReleaseCapability | undefined> => {
435
438
  if (workflowArg.targets.includes("docker")) {
436
439
  if (!tsdockerArg) {
@@ -451,7 +454,39 @@ const assertFreshReleaseCapabilities = async (
451
454
  }
452
455
  if (workflowArg.targets.includes("npm")) {
453
456
  await assertNoStandaloneTspublishPublisher(cwdArg);
454
- return assertPnpmReleaseCapability(smartshellArg, cwdArg);
457
+ const capability = await assertPnpmReleaseCapability(smartshellArg, cwdArg);
458
+ await assertPrivateNpmAuthentication(
459
+ smartshellArg,
460
+ cwdArg,
461
+ capability,
462
+ workflowArg.npmAccessLevel,
463
+ workflowArg.npmRegistries,
464
+ authenticationNextStepArg,
465
+ );
466
+ return capability;
467
+ }
468
+ };
469
+
470
+ /**
471
+ * A private package is verified with the registry's configured
472
+ * authentication, so every destination must confirm that authentication
473
+ * before anything is committed, tagged or published.
474
+ */
475
+ const assertPrivateNpmAuthentication = async (
476
+ smartshellArg: plugins.smartshell.Smartshell,
477
+ cwdArg: string,
478
+ capabilityArg: IPnpmReleaseCapability,
479
+ accessArg: TReleaseNpmAccess,
480
+ registriesArg: readonly string[],
481
+ nextStepArg: string,
482
+ ): Promise<void> => {
483
+ if (accessArg !== "private") return;
484
+ for (const registry of registriesArg) {
485
+ await assertNpmRegistryAuthentication(
486
+ { smartshell: smartshellArg, cwd: cwdArg, capability: capabilityArg },
487
+ registry,
488
+ nextStepArg,
489
+ );
455
490
  }
456
491
  };
457
492
 
@@ -492,11 +527,6 @@ const assertReleaseConfiguration = (
492
527
  if (workflowArg.npmRegistries.length === 0) {
493
528
  throw new Error("The npm release target requires at least one registry.");
494
529
  }
495
- if (workflowArg.npmAccessLevel !== "public") {
496
- throw new Error(
497
- "Journaled npm publication currently requires public access so every destination can be verified anonymously.",
498
- );
499
- }
500
530
  if (
501
531
  workflowArg.npmAlreadyPublished !== "success" &&
502
532
  workflowArg.npmAlreadyPublished !== "error"
@@ -767,6 +797,7 @@ const prepareRecordedRelease = async (
767
797
  workflow.targets.includes("docker")
768
798
  ? new TsdockerReleaseClient(smartshellArg, paths.cwd)
769
799
  : undefined,
800
+ `run \`gitzone release resume ${version} -y\``,
770
801
  );
771
802
  console.log(
772
803
  `\nPreparing the journal of recorded release v${version} from ${refs.mainOid}`,
@@ -997,7 +1028,9 @@ export const createReleaseJournal = async (
997
1028
  : null,
998
1029
  },
999
1030
  npm: {
1000
- access: "public",
1031
+ access: optionsArg.workflow.targets.includes("npm")
1032
+ ? optionsArg.workflow.npmAccessLevel
1033
+ : "public",
1001
1034
  tag: "latest",
1002
1035
  alreadyPublished: optionsArg.workflow.targets.includes("npm")
1003
1036
  ? optionsArg.workflow.npmAlreadyPublished
@@ -1263,6 +1296,7 @@ const runReleaseRecover = async (
1263
1296
  paths.cwd,
1264
1297
  branch.pushUrl,
1265
1298
  tsdocker,
1299
+ `run \`gitzone release recover ${version} -y\``,
1266
1300
  );
1267
1301
  if (tsdocker && dockerRequest) await tsdocker.validate(dockerRequest);
1268
1302
  if (!mode.yes) {
@@ -1291,7 +1325,7 @@ const runReleaseRecover = async (
1291
1325
  };
1292
1326
  const ensureUnpublished = async () => {
1293
1327
  await ensureState();
1294
- await assertRecoveryUnpublished(options);
1328
+ await assertRecoveryUnpublished(options, pnpmCapability);
1295
1329
  };
1296
1330
  const context = await withReleasePreparationRecovery(
1297
1331
  options,
@@ -1483,6 +1517,18 @@ const runReleaseResume = async (
1483
1517
  );
1484
1518
  await assertNoLegacyNpmPublisher(paths.cwd);
1485
1519
  await assertNoStandaloneTspublishPublisher(paths.cwd);
1520
+ await assertPrivateNpmAuthentication(
1521
+ smartshellInstance,
1522
+ paths.cwd,
1523
+ pnpmCapability,
1524
+ journal.npm.access,
1525
+ [
1526
+ ...new Set(
1527
+ journal.npm.registries.map((registryArg) => registryArg.registry),
1528
+ ),
1529
+ ],
1530
+ `run \`gitzone release resume ${version} -y\``,
1531
+ );
1486
1532
  for (const artifact of getReleaseArtifacts(journal)) {
1487
1533
  await verifyStoredNpmArtifact(
1488
1534
  store.getArtifactPath(version, artifact.file),