@git.zone/cli 8.3.2 → 8.4.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/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/helpers.workflow.d.ts +14 -0
- package/dist_ts/helpers.workflow.js +29 -1
- package/dist_ts/mod_config/index.js +42 -1
- package/dist_ts/mod_release/classes.releasejournal.d.ts +19 -3
- package/dist_ts/mod_release/classes.releasejournal.js +95 -9
- package/dist_ts/mod_release/helpers.npmartifact.d.ts +68 -7
- package/dist_ts/mod_release/helpers.npmartifact.js +192 -26
- package/dist_ts/mod_release/helpers.releasebranch.d.ts +11 -0
- package/dist_ts/mod_release/helpers.releasebranch.js +88 -61
- package/dist_ts/mod_release/helpers.releaseline.d.ts +60 -0
- package/dist_ts/mod_release/helpers.releaseline.js +129 -0
- package/dist_ts/mod_release/helpers.releasepublication.d.ts +2 -0
- package/dist_ts/mod_release/helpers.releasepublication.js +86 -19
- package/dist_ts/mod_release/helpers.releaseversion.d.ts +2 -0
- package/dist_ts/mod_release/helpers.releaseversion.js +4 -2
- package/dist_ts/mod_release/index.js +130 -40
- package/package.json +3 -3
- package/readme.md +123 -7
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/helpers.workflow.ts +54 -0
- package/ts/mod_config/index.ts +47 -0
- package/ts/mod_release/classes.releasejournal.ts +149 -10
- package/ts/mod_release/helpers.npmartifact.ts +302 -22
- package/ts/mod_release/helpers.releasebranch.ts +120 -45
- package/ts/mod_release/helpers.releaseline.ts +214 -0
- package/ts/mod_release/helpers.releasepublication.ts +168 -16
- package/ts/mod_release/helpers.releaseversion.ts +5 -1
- package/ts/mod_release/index.ts +177 -26
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@git.zone/cli",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.4.0",
|
|
5
5
|
"description": "A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.",
|
|
6
6
|
"main": "dist_ts/index.js",
|
|
7
7
|
"typings": "dist_ts/index.d.ts",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"homepage": "https://code.foss.global/git.zone/cli#README",
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@api.global/typedrequest": "^8.2.0",
|
|
43
|
-
"@git.zone/tsbuild": "^5.1.
|
|
43
|
+
"@git.zone/tsbuild": "^5.1.2",
|
|
44
44
|
"@git.zone/tspack": "^1.4.1",
|
|
45
45
|
"@git.zone/tsrun": "^3.0.2",
|
|
46
|
-
"@git.zone/tstest": "^6.3.
|
|
46
|
+
"@git.zone/tstest": "^6.3.5",
|
|
47
47
|
"@types/node": "^26.6.2"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
package/readme.md
CHANGED
|
@@ -176,7 +176,7 @@ be included by the existing stage-all workflow.
|
|
|
176
176
|
|
|
177
177
|
## Release Workflow
|
|
178
178
|
|
|
179
|
-
`gitzone release` releases from `main`. Running it on another branch fails before release metadata or ref mutation unless the bare `--merge` flag is explicitly supplied.
|
|
179
|
+
`gitzone release` releases from `main`. Running it on another branch fails before release metadata or ref mutation unless the bare `--merge` flag is explicitly supplied, or the branch carries a `release.line` configuration that names it (see [Maintenance lines](#maintenance-lines)).
|
|
180
180
|
|
|
181
181
|
`--merge` is intentionally strict: the source and existing `main` worktree must be clean, the source must be linearly rebased onto current remote `main`, and the Git target must push both the branch and tag. GitZone pins the single configured push URL, compare-and-swap fast-forwards local `main`, updates its verified worktree, and lease-pushes that exact source commit before creating release metadata. It rejects diverged or merged history, local replacement refs or grafts, stale worktrees, incomplete shallow history, changed destinations, and remote races. If the pre-release push fails, GitZone restores local `main` only when doing so cannot overwrite concurrent work. This plumbing-level integration intentionally does not run merge hooks or write `ORIG_HEAD`.
|
|
182
182
|
|
|
@@ -186,7 +186,7 @@ Before interactive confirmation or source mutation, a Docker release verifies th
|
|
|
186
186
|
|
|
187
187
|
The release core is not configurable plumbing. It always follows the same professional release transaction:
|
|
188
188
|
|
|
189
|
-
1. Verify the release branch, clean state, and `main`
|
|
189
|
+
1. Verify the release branch, clean state, and worktree ownership of `main` (or of the maintenance branch a release line names). A release that builds or packs a commit with a `package.json` also proves here that the source commit carries a `pnpm-lock.yaml` its checkout can install with `--frozen-lockfile`. An npm release then reads every registry's dist-tags for every package it publishes: `latest` never moves downwards, and a line never takes `latest` (step `preflight.npmDistTags`).
|
|
190
190
|
2. Read `changelog.md` `## Pending` entries and infer or accept a semver bump, raised to `release.versionFloor` when that is higher.
|
|
191
191
|
3. Run configured tests.
|
|
192
192
|
4. With `--merge`, fast-forward and lease-push `main` before release metadata is created.
|
|
@@ -278,7 +278,7 @@ Targets decide what happens after that:
|
|
|
278
278
|
|
|
279
279
|
| Target | What it does |
|
|
280
280
|
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
281
|
-
| `git` | Atomically pushes the exact `main` release
|
|
281
|
+
| `git` | Atomically pushes the exact release commit to `main` (or to the maintenance branch of a release line) and the new tag, often triggering remote CI release builds |
|
|
282
282
|
| `npm` | Publishes the same journaled tarball to every configured registry; verifies its bytes anonymously, or its integrity record with the registry's configured authentication for private packages |
|
|
283
283
|
| `docker` | Qualifies immutable OCI digest graphs with project-local tSDocker, promotes each journaled destination under single-writer alias fencing, verifies exact digests, then cleans the candidate; a terminal qualification conflict permits cleanup only |
|
|
284
284
|
|
|
@@ -378,6 +378,122 @@ The floor must be a canonical `x.y.z` string whose components do not exceed `900
|
|
|
378
378
|
|
|
379
379
|
`gitzone config show` lists the configured floor.
|
|
380
380
|
|
|
381
|
+
### Maintenance lines
|
|
382
|
+
|
|
383
|
+
A maintenance line releases an older major from its own branch under its own
|
|
384
|
+
npm dist-tag, so that `latest` never moves. It is opted into per branch: the
|
|
385
|
+
maintenance branch commits a `release.line` block in its `.smartconfig.json`,
|
|
386
|
+
and that block makes that branch, and only that branch, a release source.
|
|
387
|
+
`main` never carries the block.
|
|
388
|
+
|
|
389
|
+
Worked example: `@push.rocks/smartserve` publishes 8.x as `latest`, and its 4.x
|
|
390
|
+
line lives on the branch `v4-maintenance` under the dist-tag `v4-lts`
|
|
391
|
+
(4.4.0). A security fix is released as 4.4.1 like this. On `v4-maintenance`,
|
|
392
|
+
`.smartconfig.json` carries:
|
|
393
|
+
|
|
394
|
+
```json
|
|
395
|
+
{
|
|
396
|
+
"@git.zone/cli": {
|
|
397
|
+
"release": {
|
|
398
|
+
"line": { "branch": "v4-maintenance", "distTag": "v4-lts" },
|
|
399
|
+
"targets": {
|
|
400
|
+
"git": { "enabled": true, "remote": "origin", "pushBranch": true, "pushTags": true },
|
|
401
|
+
"npm": {
|
|
402
|
+
"enabled": true,
|
|
403
|
+
"registries": ["https://verdaccio.lossless.digital", "https://registry.npmjs.org"],
|
|
404
|
+
"accessLevel": "public"
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
Commit the fix with `gitzone commit` on `v4-maintenance`; the branch keeps its
|
|
413
|
+
own `changelog.md`, whose `## Pending` section feeds the release exactly as on
|
|
414
|
+
`main`. Then, still on `v4-maintenance`:
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
gitzone release --plan
|
|
418
|
+
# source branch: v4-maintenance
|
|
419
|
+
# release line: v4-maintenance -> npm dist-tag v4-lts (major 4; latest is never moved)
|
|
420
|
+
# npm dist-tag: v4-lts
|
|
421
|
+
# npm dist-tags of @push.rocks/smartserve at https://registry.npmjs.org: v4-lts 4.4.0 -> 4.4.1, latest 8.2.0 unchanged
|
|
422
|
+
gitzone release -y
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
The release commits `v4.4.1` on `v4-maintenance`, tags it, pushes exactly
|
|
426
|
+
`refs/heads/v4-maintenance` and `refs/tags/v4.4.1` with a lease on
|
|
427
|
+
`v4-maintenance`, and publishes each package with `pnpm publish <tarball>
|
|
428
|
+
--tag=v4-lts`. `main` is neither read nor written.
|
|
429
|
+
|
|
430
|
+
The rules:
|
|
431
|
+
|
|
432
|
+
- `release.line` takes exactly `branch` and `distTag`. The branch is a
|
|
433
|
+
canonical branch name other than `main`. The dist-tag is lowercase letters
|
|
434
|
+
and digits joined by hyphens and starts with a letter; it is never `latest`
|
|
435
|
+
and never a semver range such as `v4` or `x`, which npm refuses as a tag.
|
|
436
|
+
- The release must run on the branch the line names. On any other branch,
|
|
437
|
+
`main` included, the release stops before anything is created. A branch
|
|
438
|
+
without `release.line` still releases only `main`.
|
|
439
|
+
- A line publishes only to Git and npm. Docker targets promote aliases such as
|
|
440
|
+
`latest`, and Gitea marks its newest release as the latest one, so a line
|
|
441
|
+
with an enabled `docker` or `giteaAssets` target is refused, and so are
|
|
442
|
+
`--merge` and `gitzone release recover`. A line release records its intent,
|
|
443
|
+
so `gitzone release resume <version> -y` continues it.
|
|
444
|
+
- A line keeps its major. A Pending `### Breaking Changes` section, `--major`
|
|
445
|
+
or a `release.versionFloor` that changes the major stops the release.
|
|
446
|
+
- Before anything is created, and again right before each upload, every
|
|
447
|
+
package must, at every registry, already have a canonical `latest` with a
|
|
448
|
+
higher major than the release, and the line's own tag must be absent or
|
|
449
|
+
below the release version. Otherwise the release stops; a refusal right
|
|
450
|
+
before an upload is recorded as the terminal `dist-tag-conflict` and nothing
|
|
451
|
+
is published.
|
|
452
|
+
- After the upload the line's tag must name the version, or a later version
|
|
453
|
+
of the same major, and `latest` must still carry a higher major. A line whose
|
|
454
|
+
version took `latest` is a terminal `dist-tag-conflict`. gitzone never
|
|
455
|
+
writes dist-tags: the error names the exact command that restores `latest`,
|
|
456
|
+
`pnpm dist-tag add <package>@<previous latest> latest --registry=<registry>`,
|
|
457
|
+
where the previous `latest` is the version the release recorded when it
|
|
458
|
+
claimed the upload.
|
|
459
|
+
- `release.targets.npm.alreadyPublished` applies unchanged: identical bytes
|
|
460
|
+
already published, with the line's tag on them and `latest` still a higher
|
|
461
|
+
major, verify without an upload under `success` and stop under `error`.
|
|
462
|
+
Identical bytes without the line's tag stay unverified; gitzone does not add
|
|
463
|
+
the tag.
|
|
464
|
+
- Private packages follow the same rules. Their dist-tags are read with the
|
|
465
|
+
registry's authentication through `pnpm view <package> dist-tags --json`,
|
|
466
|
+
which every release path (fresh, `resume` and `recover`) qualifies from
|
|
467
|
+
`pnpm view --help` in both pnpm command dialects before it authenticates,
|
|
468
|
+
reads or publishes anything.
|
|
469
|
+
|
|
470
|
+
#### `latest` only moves upwards
|
|
471
|
+
|
|
472
|
+
The same check guards every `main` release: when a registry's `latest` is a
|
|
473
|
+
canonical version above the release version, the release stops before
|
|
474
|
+
anything is committed, tagged or published, and names `release.line` as the
|
|
475
|
+
way to release an older major. A release that finds `latest` moved above it
|
|
476
|
+
right before an upload records a terminal `dist-tag-conflict` and publishes
|
|
477
|
+
nothing. A prerelease or non-semver `latest` and a package the registry does
|
|
478
|
+
not know yet do not stop a `main` release.
|
|
479
|
+
|
|
480
|
+
A registry whose dist-tags cannot be read (an outage, a timeout, an
|
|
481
|
+
unexpected answer) now stops a `main` release in preflight as well, before
|
|
482
|
+
the release commit. This is intended: an unknown `latest` could be above the
|
|
483
|
+
release, so publishing would risk a downgrade. Release again once the
|
|
484
|
+
registry answers.
|
|
485
|
+
|
|
486
|
+
#### Journal compatibility
|
|
487
|
+
|
|
488
|
+
A line release journals `release.line` (`branch` and `distTag`) in the
|
|
489
|
+
release identity and its intent, and its dist-tag as `npm.tag`. Each npm
|
|
490
|
+
destination it claims records `previousLatest`, the `latest` version found
|
|
491
|
+
when the upload was claimed. `git.expectedRemoteMainOid` keeps its name and
|
|
492
|
+
holds the leased commit of the release branch, `main` or the line's branch.
|
|
493
|
+
Journals of `main` releases are byte-identical to before. GitZone 8.3.x and
|
|
494
|
+
earlier refuse to read a line journal or intent, so they can neither resume a
|
|
495
|
+
line release onto `main` nor publish it under `latest`.
|
|
496
|
+
|
|
381
497
|
### Exact artifacts and release journals
|
|
382
498
|
|
|
383
499
|
Journal schema 1 supports Git and public or private npm publication. Schema 2 adds Docker qualification, promotion, and cleanup evidence without changing the storage path or schema-1 parsing and resume behavior. Fresh and resumed npm publication dynamically qualifies the active stable `pnpm` version; there is no version allowlist. GitZone reads `minimum-release-age` and `minimum-release-age-exclude` through that exact pnpm invocation in the release directory, so project configuration and global policy retain pnpm's normal precedence. It verifies the selected version's publication time through the configured registry unless the effective policy disables the age delay or excludes that version. Missing timestamps follow `minimum-release-age-ignore-missing-time`, including pnpm's default of `true`; malformed policy, metadata failures, immature versions, and prerelease versions stop qualification. GitZone also verifies the required pack/publish command contract and keeps every subsequent command bound to the qualified exact version. A new pnpm version with the same capabilities needs no GitZone update once it satisfies the policy. Registries must be unique canonical credential-free HTTP(S) URLs. `release.targets.npm.accessLevel` is `public` (the default) or `private`; see [Private npm packages](#private-npm-packages).
|
|
@@ -415,13 +531,13 @@ Every release that reaches final publication stores `journal.json` under the rep
|
|
|
415
531
|
|
|
416
532
|
The canonical journal binds the release commit, annotated tag object, hashed Git destination, npm registries, per-target attempt states, and, when npm is selected, the package identity, tarball size, SHA-1, SHA-256, and SHA-512 integrity. Schema 2 also binds the exact tSDocker request, candidate identity, qualification result, ordered destination promotions, probe or promotion evidence, and terminal cleanup result. Journal updates use revision compare-and-swap under an interprocess lock. Release identity and destinations cannot change after journal creation. Qualification and promotion evidence is append-only, destination conflicts are terminal, and completed Docker state cannot regress. Inspect and resume reject malformed, future, noncanonical, duplicate-key, or merely reformatted journal JSON rather than repairing or normalizing it.
|
|
417
533
|
|
|
418
|
-
Packing must leave the release tree clean. Each registry receives that exact stored tarball through `pnpm publish <tarball> --ignore-scripts`, so publish lifecycle scripts do not run. For a public package, success is recorded only after anonymous no-redirect probes verify version metadata, SHA-1 and integrity fields, the downloaded tarball bytes, and the `latest
|
|
534
|
+
Packing must leave the release tree clean. Each registry receives that exact stored tarball through `pnpm publish <tarball> --tag=<dist-tag> --ignore-scripts`, so publish lifecycle scripts do not run. For a public package, success is recorded only after anonymous no-redirect probes verify version metadata, SHA-1 and integrity fields, the downloaded tarball bytes, and the release's dist-tag: `latest`, or the tag of a [maintenance line](#maintenance-lines). Each metadata request is bounded at 10 s; the tarball download, sized by the packed artifact, runs as long as bytes keep arriving, aborting after 30 s without data or once 10 s plus the time its size needs at 256 KiB/s have passed, so large tarballs with native binaries verify while a stalled registry still ends the probe as retryable. The dist-tag is satisfied by the released version itself and by any later release that has since carried the tag on (for a line tag, a later version of the same major), so superseded releases stay verifiable; an older version, a prerelease, a non-semver value or an absent tag does not. A matching pre-existing version follows `release.targets.npm.alreadyPublished`; conflicting bytes always stop the release, while transient responses and dist-tag propagation remain retryable.
|
|
419
535
|
|
|
420
536
|
#### Private npm packages
|
|
421
537
|
|
|
422
538
|
With `release.targets.npm.accessLevel: "private"` the journal records
|
|
423
539
|
`npm.access: "private"`, each registry receives the stored tarball through
|
|
424
|
-
`pnpm publish <tarball> --access=restricted --ignore-scripts`, and verification
|
|
540
|
+
`pnpm publish <tarball> --access=restricted --tag=<dist-tag> --ignore-scripts`, and verification
|
|
425
541
|
runs through the same qualified pnpm with the registry's configured
|
|
426
542
|
authentication instead of anonymously. GitZone never reads, parses, logs or
|
|
427
543
|
journals a credential: pnpm reads its own `.npmrc` for the destination, exactly
|
|
@@ -436,7 +552,7 @@ as it does when it publishes, so authenticate at user level with `pnpm login
|
|
|
436
552
|
- A destination is `verified` when `pnpm view <name>@<version> --json` reports
|
|
437
553
|
the packed artifact's `dist.integrity` and `dist.shasum`, a `dist.tarball` on
|
|
438
554
|
the registry's own origin without credentials, query or fragment, and the
|
|
439
|
-
same
|
|
555
|
+
same dist-tag rules as public releases. pnpm has no command that
|
|
440
556
|
downloads a tarball with the registry's authentication, so the bytes are
|
|
441
557
|
proven by the registry's integrity record rather than downloaded.
|
|
442
558
|
- A not-found answer counts as absence only when `pnpm whoami` confirms
|
|
@@ -576,7 +692,7 @@ npm can hold accepted uploads for publish-time scanning before they become
|
|
|
576
692
|
installable. A release with modules submits every package in publication order,
|
|
577
693
|
then waits for availability across the submitted set so scans can overlap.
|
|
578
694
|
Command failures and artifact conflicts still stop submission immediately.
|
|
579
|
-
Every package, tarball and
|
|
695
|
+
Every package, tarball and dist-tag must verify before the release is
|
|
580
696
|
complete, and Docker promotion waits until every package verified.
|
|
581
697
|
|
|
582
698
|
See [npm's publish-time scanning announcement](https://github.blog/changelog/2026-07-28-npm-publish-time-malware-scanning-and-dual-use-metadata/)
|
package/ts/00_commitinfo_data.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@git.zone/cli',
|
|
6
|
-
version: '8.
|
|
6
|
+
version: '8.4.0',
|
|
7
7
|
description: 'A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.'
|
|
8
8
|
}
|
package/ts/helpers.workflow.ts
CHANGED
|
@@ -6,6 +6,11 @@ import {
|
|
|
6
6
|
type ProjectType,
|
|
7
7
|
} from "./mod_commit/mod.helpers.js";
|
|
8
8
|
import { parseReleaseVersionFloor } from "./mod_release/helpers.releaseversion.js";
|
|
9
|
+
import {
|
|
10
|
+
getReleaseDistTag,
|
|
11
|
+
parseReleaseLine,
|
|
12
|
+
type IReleaseLine,
|
|
13
|
+
} from "./mod_release/helpers.releaseline.js";
|
|
9
14
|
import { defaultNpmVerificationWindowMinutes } from "./mod_release/helpers.npmartifact.js";
|
|
10
15
|
import {
|
|
11
16
|
defaultGiteaAssetTransferLimits,
|
|
@@ -235,6 +240,14 @@ export interface IReleaseWorkflowConfig {
|
|
|
235
240
|
};
|
|
236
241
|
/** Canonical x.y.z minimum for the next release version. */
|
|
237
242
|
versionFloor?: string;
|
|
243
|
+
/**
|
|
244
|
+
* A maintenance line, committed on its branch: that branch becomes the
|
|
245
|
+
* release source, and npm publishes under `distTag` instead of `latest`.
|
|
246
|
+
*/
|
|
247
|
+
line?: {
|
|
248
|
+
branch?: string;
|
|
249
|
+
distTag?: string;
|
|
250
|
+
};
|
|
238
251
|
preflight?: {
|
|
239
252
|
test?: boolean;
|
|
240
253
|
build?: boolean;
|
|
@@ -279,6 +292,10 @@ export interface IResolvedReleaseWorkflow {
|
|
|
279
292
|
changelogPendingSection: "Pending";
|
|
280
293
|
changelogVersionHeading: "## {{date}} - {{version}}";
|
|
281
294
|
versionFloor?: string;
|
|
295
|
+
/** The maintenance line this branch releases; absent releases `main`. */
|
|
296
|
+
line?: IReleaseLine;
|
|
297
|
+
/** `latest`, or the dist-tag of the release line. */
|
|
298
|
+
npmDistTag: string;
|
|
282
299
|
gitEnabled: boolean;
|
|
283
300
|
gitRemote: string;
|
|
284
301
|
/** Bound of one attempt of every Git remote inspection. */
|
|
@@ -317,6 +334,7 @@ export type TReleaseRecordedPlan = Pick<
|
|
|
317
334
|
>;
|
|
318
335
|
|
|
319
336
|
export interface IResolvedReleaseResumeConfiguration {
|
|
337
|
+
line?: IReleaseLine;
|
|
320
338
|
gitRemote: string;
|
|
321
339
|
gitRemoteTimeoutSeconds: number;
|
|
322
340
|
npmRegistries: string[];
|
|
@@ -752,6 +770,9 @@ const buildReleasePlan = (options: {
|
|
|
752
770
|
projectTypeHasPackageJson(options.projectType)
|
|
753
771
|
)
|
|
754
772
|
plan.push("preflight.lockfile");
|
|
773
|
+
// Every npm release reads the registries' dist-tags before it creates
|
|
774
|
+
// anything: `latest` never moves downwards, and a line never takes it.
|
|
775
|
+
if (options.targets.includes("npm")) plan.push("preflight.npmDistTags");
|
|
755
776
|
if (options.runTests) plan.push("preflight.test");
|
|
756
777
|
if (options.mergeRequested) {
|
|
757
778
|
plan.push("integration.main", "integration.pushMain");
|
|
@@ -919,6 +940,33 @@ const assertNoRemovedNpmTargetSettings = (
|
|
|
919
940
|
}
|
|
920
941
|
};
|
|
921
942
|
|
|
943
|
+
/**
|
|
944
|
+
* A maintenance line publishes only to Git and npm. A Docker target promotes
|
|
945
|
+
* aliases such as `latest`, and Gitea marks its newest release as the latest
|
|
946
|
+
* one; neither may follow an older major. A line releases its branch in
|
|
947
|
+
* place, so it never integrates another branch.
|
|
948
|
+
*/
|
|
949
|
+
const assertReleaseLineTargets = (
|
|
950
|
+
lineArg: IReleaseLine | undefined,
|
|
951
|
+
targetsArg: TReleaseTarget[],
|
|
952
|
+
mergeRequestedArg: boolean,
|
|
953
|
+
): void => {
|
|
954
|
+
if (!lineArg) return;
|
|
955
|
+
const refused = targetsArg.filter(
|
|
956
|
+
(targetArg) => targetArg === "docker" || targetArg === "giteaAssets",
|
|
957
|
+
);
|
|
958
|
+
if (refused.length > 0) {
|
|
959
|
+
throw new Error(
|
|
960
|
+
`Release line ${lineArg.distTag} publishes only to Git and npm; disable ${refused.join(" and ")} on ${lineArg.branch}.`,
|
|
961
|
+
);
|
|
962
|
+
}
|
|
963
|
+
if (mergeRequestedArg) {
|
|
964
|
+
throw new Error(
|
|
965
|
+
`\`gitzone release --merge\` cannot release the ${lineArg.distTag} line: a maintenance line releases its branch ${lineArg.branch} in place.`,
|
|
966
|
+
);
|
|
967
|
+
}
|
|
968
|
+
};
|
|
969
|
+
|
|
922
970
|
/**
|
|
923
971
|
* Resolves the release from its configuration and command line. A resume of
|
|
924
972
|
* a recorded release passes `recordedPlanArg`, which replaces every command
|
|
@@ -931,6 +979,7 @@ export const resolveReleaseWorkflow = async (
|
|
|
931
979
|
const cliConfig = await readCliWorkflowConfig();
|
|
932
980
|
const releaseConfig = cliConfig.release || {};
|
|
933
981
|
const versionFloor = parseReleaseVersionFloor(releaseConfig.versionFloor);
|
|
982
|
+
const line = parseReleaseLine(releaseConfig.line);
|
|
934
983
|
const targetConfig = releaseConfig.targets || {};
|
|
935
984
|
const gitConfig = targetConfig.git || {};
|
|
936
985
|
const npmConfig = targetConfig.npm || {};
|
|
@@ -1020,6 +1069,7 @@ export const resolveReleaseWorkflow = async (
|
|
|
1020
1069
|
"Gitea asset releases cannot combine Docker or --merge; integrate main before release.",
|
|
1021
1070
|
);
|
|
1022
1071
|
}
|
|
1072
|
+
assertReleaseLineTargets(line, targets, argvArg.merge === true);
|
|
1023
1073
|
let npmRegistries: string[] = [];
|
|
1024
1074
|
if (targets.includes("npm")) {
|
|
1025
1075
|
if (
|
|
@@ -1092,6 +1142,8 @@ export const resolveReleaseWorkflow = async (
|
|
|
1092
1142
|
changelogPendingSection: "Pending",
|
|
1093
1143
|
changelogVersionHeading: "## {{date}} - {{version}}",
|
|
1094
1144
|
...(versionFloor ? { versionFloor } : {}),
|
|
1145
|
+
...(line ? { line } : {}),
|
|
1146
|
+
npmDistTag: getReleaseDistTag(line),
|
|
1095
1147
|
gitEnabled,
|
|
1096
1148
|
gitRemote: gitConfig.remote || "origin",
|
|
1097
1149
|
// Dormant settings of an inactive target are not validated.
|
|
@@ -1129,6 +1181,7 @@ export const resolveReleaseResumeConfiguration = async (optionsArg: {
|
|
|
1129
1181
|
}): Promise<IResolvedReleaseResumeConfiguration> => {
|
|
1130
1182
|
const cliConfig = await readCliWorkflowConfig();
|
|
1131
1183
|
const releaseConfig = cliConfig.release || {};
|
|
1184
|
+
const line = parseReleaseLine(releaseConfig.line);
|
|
1132
1185
|
const targetConfig = releaseConfig.targets || {};
|
|
1133
1186
|
const gitConfig = targetConfig.git || {};
|
|
1134
1187
|
const npmConfig = targetConfig.npm || {};
|
|
@@ -1192,6 +1245,7 @@ export const resolveReleaseResumeConfiguration = async (optionsArg: {
|
|
|
1192
1245
|
}
|
|
1193
1246
|
|
|
1194
1247
|
return {
|
|
1248
|
+
...(line ? { line } : {}),
|
|
1195
1249
|
gitRemote,
|
|
1196
1250
|
gitRemoteTimeoutSeconds: optionsArg.git
|
|
1197
1251
|
? resolveGitRemoteTimeoutSeconds(gitConfig.remoteTimeoutSeconds)
|
package/ts/mod_config/index.ts
CHANGED
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
parseReleaseVersionFloor,
|
|
36
36
|
} from "../mod_release/helpers.releaseversion.js";
|
|
37
37
|
import { getSealedReleaseConfigError } from "../helpers.sealedrelease.js";
|
|
38
|
+
import { parseReleaseLine } from "../mod_release/helpers.releaseline.js";
|
|
38
39
|
|
|
39
40
|
export { ReleaseConfig, CommitConfig };
|
|
40
41
|
|
|
@@ -305,6 +306,12 @@ async function handleShow(mode: ICliMode): Promise<void> {
|
|
|
305
306
|
printConfigSection("Release Workflow", [
|
|
306
307
|
["confirmation", formatValue(release.confirmation)],
|
|
307
308
|
["version floor", formatValue(release.versionFloor)],
|
|
309
|
+
[
|
|
310
|
+
"release line",
|
|
311
|
+
release.line
|
|
312
|
+
? `${formatValue(release.line.branch)} -> npm dist-tag ${formatValue(release.line.distTag)}`
|
|
313
|
+
: "main (npm dist-tag latest)",
|
|
314
|
+
],
|
|
308
315
|
["clean tree", "required"],
|
|
309
316
|
["run tests", formatValue(release.preflight?.test)],
|
|
310
317
|
["run build", formatValue(release.preflight?.build)],
|
|
@@ -1913,6 +1920,7 @@ async function validateReleaseConfig(
|
|
|
1913
1920
|
}
|
|
1914
1921
|
|
|
1915
1922
|
findings.push(validateReleaseVersionFloor(releaseConfig.versionFloor));
|
|
1923
|
+
findings.push(validateReleaseLine(releaseConfig.line, releaseConfig.targets));
|
|
1916
1924
|
|
|
1917
1925
|
if (
|
|
1918
1926
|
releaseConfig.registries ||
|
|
@@ -2004,6 +2012,45 @@ function validateReleaseVersionFloor(valueArg: unknown): IDoctorFinding {
|
|
|
2004
2012
|
}
|
|
2005
2013
|
}
|
|
2006
2014
|
|
|
2015
|
+
function validateReleaseLine(
|
|
2016
|
+
valueArg: unknown,
|
|
2017
|
+
targetsArg: unknown,
|
|
2018
|
+
): IDoctorFinding {
|
|
2019
|
+
let line: ReturnType<typeof parseReleaseLine>;
|
|
2020
|
+
try {
|
|
2021
|
+
line = parseReleaseLine(valueArg);
|
|
2022
|
+
} catch (error) {
|
|
2023
|
+
return {
|
|
2024
|
+
level: "error",
|
|
2025
|
+
message: error instanceof Error ? error.message : String(error),
|
|
2026
|
+
fix: 'Set release.line to { "branch": "<maintenance branch>", "distTag": "<dist-tag>" } on the maintenance branch, or remove it.',
|
|
2027
|
+
};
|
|
2028
|
+
}
|
|
2029
|
+
if (!line) {
|
|
2030
|
+
return {
|
|
2031
|
+
level: "ok",
|
|
2032
|
+
message: "Release line is not configured; releases run from main under latest",
|
|
2033
|
+
};
|
|
2034
|
+
}
|
|
2035
|
+
const targets = isPlainObject(targetsArg) ? targetsArg : {};
|
|
2036
|
+
const enabled = (["docker", "giteaAssets"] as const).filter(
|
|
2037
|
+
(targetArg) =>
|
|
2038
|
+
isPlainObject(targets[targetArg]) &&
|
|
2039
|
+
(targets[targetArg] as Record<string, unknown>).enabled === true,
|
|
2040
|
+
);
|
|
2041
|
+
if (enabled.length > 0) {
|
|
2042
|
+
return {
|
|
2043
|
+
level: "error",
|
|
2044
|
+
message: `Release line ${line.distTag} publishes only to Git and npm, but ${enabled.join(" and ")} ${enabled.length > 1 ? "are" : "is"} enabled`,
|
|
2045
|
+
fix: `Disable ${enabled.join(" and ")} in release.targets on ${line.branch}.`,
|
|
2046
|
+
};
|
|
2047
|
+
}
|
|
2048
|
+
return {
|
|
2049
|
+
level: "ok",
|
|
2050
|
+
message: `Release line ${line.branch} publishes under npm dist-tag ${line.distTag}`,
|
|
2051
|
+
};
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2007
2054
|
async function validateAssetsConfig(
|
|
2008
2055
|
rawAssetsConfig: unknown,
|
|
2009
2056
|
smartconfigData: Record<string, any>,
|