@git.zone/cli 8.11.0 → 9.0.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_deno_binary_installer → asset_binary_installer}/install.sh +134 -40
- package/assets/templates/{asset_deno_binary_postinstall → asset_binary_postinstall}/bin/wrapper.js +13 -4
- package/assets/templates/asset_binary_postinstall/scripts/install-binary.js +211 -0
- package/assets/templates/asset_binary_release_gitea/.gitea/workflows/release.yml +194 -0
- package/assets/templates/asset_binary_release_gitea/scripts/gitzone-binary-release.d.mts +29 -0
- package/assets/templates/asset_binary_release_gitea/scripts/gitzone-binary-release.mjs +168 -0
- package/assets/templates/asset_tspack_release_gitea/.gitea/workflows/release.yml +7 -4
- package/dist_ts/00_commitinfo_data.js +2 -2
- package/dist_ts/helpers.managedassets.d.ts +44 -0
- package/dist_ts/helpers.managedassets.js +166 -0
- package/dist_ts/helpers.ownerscopes.d.ts +3 -15
- package/dist_ts/helpers.ownerscopes.js +4 -16
- package/dist_ts/helpers.packagefiles.d.ts +2 -1
- package/dist_ts/helpers.packagefiles.js +7 -4
- package/dist_ts/helpers.sealedrelease.js +3 -3
- package/dist_ts/helpers.tssea.d.ts +11 -0
- package/dist_ts/helpers.tssea.js +81 -0
- package/dist_ts/helpers.workflow.d.ts +0 -3
- package/dist_ts/helpers.workflow.js +7 -19
- package/dist_ts/index.d.ts +1 -1
- package/dist_ts/index.js +2 -2
- package/dist_ts/mod_commit/mod.helpers.d.ts +8 -21
- package/dist_ts/mod_commit/mod.helpers.js +32 -83
- package/dist_ts/mod_commit/mod.ui.js +1 -5
- package/dist_ts/mod_config/index.js +41 -33
- package/dist_ts/mod_format/formatters/assets.formatter.js +57 -93
- package/dist_ts/mod_format/formatters/packagejson.formatter.js +3 -3
- package/dist_ts/mod_format/index.js +30 -11
- package/dist_ts/mod_format/interfaces.format.js +1 -2
- package/dist_ts/mod_release/helpers.releasepreparation.d.ts +6 -14
- package/dist_ts/mod_release/helpers.releasepreparation.js +27 -53
- package/dist_ts/mod_release/index.js +9 -10
- package/dist_ts/mod_services/classes.serviceconfiguration.d.ts +2 -2
- package/dist_ts/mod_services/classes.serviceoptions.d.ts +2 -2
- package/dist_ts/plugins.d.ts +3 -1
- package/dist_ts/plugins.js +4 -2
- package/package.json +3 -2
- package/readme.md +69 -63
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/helpers.managedassets.ts +215 -0
- package/ts/helpers.ownerscopes.ts +3 -15
- package/ts/helpers.packagefiles.ts +6 -3
- package/ts/helpers.sealedrelease.ts +2 -2
- package/ts/helpers.tssea.ts +102 -0
- package/ts/helpers.workflow.ts +6 -28
- package/ts/index.ts +1 -1
- package/ts/mod_commit/mod.helpers.ts +33 -94
- package/ts/mod_commit/mod.ui.ts +0 -4
- package/ts/mod_config/index.ts +47 -35
- package/ts/mod_format/formatters/assets.formatter.ts +62 -109
- package/ts/mod_format/formatters/packagejson.formatter.ts +2 -2
- package/ts/mod_format/index.ts +36 -10
- package/ts/mod_format/interfaces.format.ts +0 -1
- package/ts/mod_release/helpers.releasepreparation.ts +36 -69
- package/ts/mod_release/index.ts +6 -16
- package/ts/mod_services/classes.serviceconfiguration.ts +2 -2
- package/ts/mod_services/classes.serviceoptions.ts +2 -2
- package/ts/plugins.ts +4 -0
- package/assets/templates/asset_deno_binary_postinstall/scripts/install-binary.js +0 -123
- package/assets/templates/asset_deno_binary_release_gitea/.gitea/workflows/release.yml +0 -154
- package/assets/templates/multienv/deno.json +0 -8
- package/dist_ts/mod_format/formatters/deno.formatter.d.ts +0 -18
- package/dist_ts/mod_format/formatters/deno.formatter.js +0 -175
- package/ts/mod_format/formatters/deno.formatter.ts +0 -219
package/readme.md
CHANGED
|
@@ -232,8 +232,7 @@ Consequences worth knowing before upgrading:
|
|
|
232
232
|
pushed. Commit the lockfile, or run `pnpm install` and commit it, then release
|
|
233
233
|
again. The version bump only changes `version`, which never changes a
|
|
234
234
|
dependency specifier, so a lockfile accepted in preflight is still accepted in
|
|
235
|
-
the release commit.
|
|
236
|
-
an npm project here and owes the same proof.
|
|
235
|
+
the release commit.
|
|
237
236
|
- Pnpm commands use the scope carried by the release commit. A repository that
|
|
238
237
|
tracks its own root `pnpm-workspace.yaml` retains that workspace's settings
|
|
239
238
|
and member validation. Otherwise, lockfile verification and checkout
|
|
@@ -246,15 +245,9 @@ Consequences worth knowing before upgrading:
|
|
|
246
245
|
independent fixture installs are not supported in that mode. Both modes
|
|
247
246
|
exclude an unrelated enclosing workspace from release lockfile validation
|
|
248
247
|
and installation.
|
|
249
|
-
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
dependencies stays the project's `deno.lock` or import map. The plan of such a
|
|
253
|
-
release has no `preflight.lockfile` step. Preflight and the checkout both read
|
|
254
|
-
the release commit rather than the working folder, so an ignored
|
|
255
|
-
`package.json` never makes a release demand a lockfile its checkout would not
|
|
256
|
-
install; in that one case the plan, which reads the working folder, still
|
|
257
|
-
lists the step, and the step then does nothing.
|
|
248
|
+
- The release commit must carry a `package.json`: it holds the version
|
|
249
|
+
gitzone releases. A commit without one is refused before anything is
|
|
250
|
+
created.
|
|
258
251
|
- The checkout holds only committed files, so a gitignored project-level
|
|
259
252
|
`.npmrc` is not in it. A project that authenticates private dependencies
|
|
260
253
|
through such a file now fails its checkout install after the local commit and
|
|
@@ -354,7 +347,7 @@ Release flags:
|
|
|
354
347
|
}
|
|
355
348
|
```
|
|
356
349
|
|
|
357
|
-
GitZone first infers the version as usual. It starts from the current `package.json`
|
|
350
|
+
GitZone first infers the version as usual. It starts from the current `package.json` version and applies the level from the Pending changelog or from `--major`, `--minor` or `--patch`. The release version is then the higher of that inferred version and the floor. The floor is committed configuration, so the plain `gitzone release -y` honours it without a flag, and nobody has to hand-edit `package.json` to a version that was never published.
|
|
358
351
|
|
|
359
352
|
`gitzone release --plan` states the outcome:
|
|
360
353
|
|
|
@@ -381,15 +374,15 @@ When the floor decides the version, the release journal records that decision wi
|
|
|
381
374
|
|
|
382
375
|
`gitzone release inspect` and `gitzone release resume` print the same `version floor: ... applied` line. The record is part of the journal's immutable identity. `resume` always publishes the journaled version and never resolves a new one. This matters because after the release commit the floor is inert, and a fresh resolution would infer `32.0.1`. `recover` takes its version from the existing tag and writes no floor record, because the failed run did not record its level override.
|
|
383
376
|
|
|
384
|
-
The floor must be a canonical `x.y.z` string whose components do not exceed `9007199254740991`, except for a matching [prerelease channel](#prerelease-channels-on-main). Every rejection throws `ReleaseVersionError`, and its `code` names the rule that failed. `malformed-version-floor` and `unsupported-prerelease-floor` are configuration errors that `--plan` and `gitzone config doctor` report. `--plan` and the release raise `noncanonical-version` when the current `package.json`
|
|
377
|
+
The floor must be a canonical `x.y.z` string whose components do not exceed `9007199254740991`, except for a matching [prerelease channel](#prerelease-channels-on-main). Every rejection throws `ReleaseVersionError`, and its `code` names the rule that failed. `malformed-version-floor` and `unsupported-prerelease-floor` are configuration errors that `--plan` and `gitzone config doctor` report. `--plan` and the release raise `noncanonical-version` when the current `package.json` version is not canonical. `current-version-changed` is raised only while the release runs:
|
|
385
378
|
|
|
386
379
|
| Code | Cause |
|
|
387
380
|
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
388
381
|
| `malformed-version-floor` | Anything else, such as `"32"`, `"v32.0.0"`, `null`, a number, or a component above `9007199254740991` |
|
|
389
382
|
| `unsupported-prerelease-floor` | A prerelease or build suffix without a matching configured prerelease channel |
|
|
390
383
|
| `invalid-prerelease-config` | A malformed channel, mismatched or missing prerelease floor, forbidden dist-tag or version-level override |
|
|
391
|
-
| `noncanonical-version` | A floor is configured but the current `package.json`
|
|
392
|
-
| `current-version-changed` | The release checkout's `package.json`
|
|
384
|
+
| `noncanonical-version` | A floor is configured but the current `package.json` version is not a canonical `x.y.z` version to compare against |
|
|
385
|
+
| `current-version-changed` | The release checkout's `package.json` version differs from the version the release was resolved from |
|
|
393
386
|
|
|
394
387
|
`gitzone config show` lists the configured floor.
|
|
395
388
|
|
|
@@ -1611,7 +1604,7 @@ project that needs different contents describes them in `.smartconfig.json`:
|
|
|
1611
1604
|
| `cli` | `cli.js` |
|
|
1612
1605
|
| `config` | `.smartconfig.json` |
|
|
1613
1606
|
| `docs` | `readme.md` |
|
|
1614
|
-
| `binary` | With managed `
|
|
1607
|
+
| `binary` | With managed `binaryCli` assets: the installer (`install.sh` or `assets.installer.file`) and, with the npm wrapper, `bin/` and its postinstall script; empty otherwise |
|
|
1615
1608
|
|
|
1616
1609
|
The list carries the entries of the selected sets in this order, then
|
|
1617
1610
|
`include`, then every exclusion: those of the sets first, then `exclude`, each
|
|
@@ -1653,7 +1646,7 @@ Then fix the package and release again. `gitzone config doctor` validates
|
|
|
1653
1646
|
|
|
1654
1647
|
### Managed Assets
|
|
1655
1648
|
|
|
1656
|
-
Projects can opt into generated, updateable repository assets through `@git.zone/cli.assets`. The
|
|
1649
|
+
Projects can opt into generated, updateable repository assets through `@git.zone/cli.assets`. The kind `binaryCli` manages installer scripts, npm binary wrappers, postinstall downloaders, and Gitea release workflows for CLI executables that [`@git.zone/tssea`](https://code.foss.global/git.zone/tssea) builds as Node.js single executable applications.
|
|
1657
1650
|
|
|
1658
1651
|
```json
|
|
1659
1652
|
{
|
|
@@ -1661,7 +1654,7 @@ Projects can opt into generated, updateable repository assets through `@git.zone
|
|
|
1661
1654
|
"schemaVersion": 2,
|
|
1662
1655
|
"assets": {
|
|
1663
1656
|
"schemaVersion": 1,
|
|
1664
|
-
"kind": "
|
|
1657
|
+
"kind": "binaryCli",
|
|
1665
1658
|
"cliName": "onebox",
|
|
1666
1659
|
"displayName": "Onebox",
|
|
1667
1660
|
"repository": {
|
|
@@ -1696,36 +1689,30 @@ Projects can opt into generated, updateable repository assets through `@git.zone
|
|
|
1696
1689
|
},
|
|
1697
1690
|
"releaseWorkflow": {
|
|
1698
1691
|
"compileCommand": "pnpm run build:binary",
|
|
1699
|
-
"packNpmArtifact": true
|
|
1700
|
-
"assetGlobs": ["dist/binaries/*", "dist/package/*"]
|
|
1692
|
+
"packNpmArtifact": true
|
|
1701
1693
|
}
|
|
1702
1694
|
}
|
|
1703
1695
|
},
|
|
1704
|
-
"@git.zone/
|
|
1705
|
-
"
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
"permissions": ["--allow-all"],
|
|
1712
|
-
"noCheck": true,
|
|
1713
|
-
"selfExtracting": true
|
|
1714
|
-
},
|
|
1715
|
-
{
|
|
1716
|
-
"name": "onebox-linux-arm64",
|
|
1717
|
-
"entryPoint": "binary/onebox.ts",
|
|
1718
|
-
"outDir": "dist/binaries",
|
|
1719
|
-
"target": "aarch64-unknown-linux-gnu",
|
|
1720
|
-
"permissions": ["--allow-all"],
|
|
1721
|
-
"noCheck": true,
|
|
1722
|
-
"selfExtracting": true
|
|
1723
|
-
}
|
|
1696
|
+
"@git.zone/tssea": {
|
|
1697
|
+
"nodeVersion": "26.11.1",
|
|
1698
|
+
"bundle": "./dist_node/main.mjs",
|
|
1699
|
+
"outDir": "./dist/binaries",
|
|
1700
|
+
"targets": [
|
|
1701
|
+
{ "target": "linux-x64", "name": "onebox-linux-x64" },
|
|
1702
|
+
{ "target": "linux-arm64", "name": "onebox-linux-arm64" }
|
|
1724
1703
|
]
|
|
1725
1704
|
}
|
|
1726
1705
|
}
|
|
1727
1706
|
```
|
|
1728
1707
|
|
|
1708
|
+
The executables come from the project's `@git.zone/tssea` configuration; GitZone keeps no target list of its own. It reads that configuration through `@git.zone/tssea/config` from the project's own install, so the project's tssea version interprets its own configuration and GitZone has no runtime dependency on tssea. The project must declare `@git.zone/tssea` ^1.1.0 in `dependencies` or `devDependencies` and have it installed (`pnpm install --save-dev @git.zone/tssea`, then `pnpm install`); `gitzone format` and `gitzone config doctor` say which step is missing, and they refuse an installed tssea outside ^1.1.0 and an `outDir` outside the project.
|
|
1709
|
+
|
|
1710
|
+
- **Asset names:** each target's `name` is the executable's file name and its release asset name, used exactly as given. A Windows name carries its `.exe`. The installer maps `uname` to `linux`, `macos` or `windows` and `x64` or `arm64`; the npm wrapper maps `process.platform:process.arch`; both download `releases/download/<version>/<name>`.
|
|
1711
|
+
- **Release workflow:** `releaseWorkflow.installCommand` (default `pnpm install --ignore-scripts`) installs the dependencies and `releaseWorkflow.compileCommand` (default `pnpm exec tsbundle && pnpm exec tssea build`, tssea's documented build) builds; set either when the project needs another command. The workflow sets up Node.js, installs dependencies, checks that the `package.json` version equals the tag, builds, and then checksums and uploads exactly the configured executables, the notice files tssea writes next to each, the staged installer (with `installer.distribution: "releaseAsset"`) and `SHA256SUMS.txt`. A missing file or a Gitea API error fails the job, and nothing else in the output directory is uploaded. A published asset is never replaced: when the release already has an asset of the same name, the job fails before uploading anything and names each such asset; delete them in Gitea before rerunning. With `packNpmArtifact` it also packs and uploads the npm tarball.
|
|
1712
|
+
- **Release notes:** the release description is the tag's section of `changelog.md`, the `## <date> - <version>` heading `gitzone release` writes, up to the next `## ` heading. Generic notes with the install command are used only when the changelog has no section for the version. The workflow extracts it with the managed `scripts/gitzone-binary-release.mjs`, which the release workflow template also writes.
|
|
1713
|
+
- **Old releases:** `releaseWorkflow.keepReleases` (default 0) is how many published releases stay. With N above 0, the workflow deletes, after this release's assets are uploaded, every published Gitea release older than the newest N (by creation time) together with its assets. Tags are never deleted, drafts are neither counted nor deleted, and the release of the running tag always stays. 0 keeps every release; a value that is not a non-negative integer fails `gitzone format`. A Gitea API error fails the job.
|
|
1714
|
+
- **npm postinstall:** with `npmWrapper.enabled`, the postinstall downloads `releases/download/v<version>/<name>` for the running platform, where `<version>` is the `version` in the package's own `package.json`. It runs only when the package is installed as a dependency, that is when its directory lies inside a `node_modules` directory (npm, pnpm, Yarn and Bun install every package, local or global, there). In the project's own checkout, for development or a release build, it skips the download, because that version is not released yet and the project builds its binaries itself. The release asset is the only source, and it is verified like the installer does: the postinstall reads the release's `SHA256SUMS.txt`, downloads next to the target, and moves the binary into place only when its SHA-256 matches; a mismatch, a missing entry or missing checksums fail. It follows 301, 302, 303, 307 and 308 redirects (relative locations included) up to 10 hops and only to HTTPS, and gives up after 30 s without data or 15 minutes per file. Every failure stops the install with the URL, the version and the cause. The wrapper in `bin/` passes on the binary's exit status, and when a signal ended the binary it ends with the same signal (or 128 + its number if Node ignores it).
|
|
1715
|
+
|
|
1729
1716
|
`@git.zone/cli.schemaVersion` remains the CLI config schema. `@git.zone/cli.assets.schemaVersion` is scoped to the managed asset model.
|
|
1730
1717
|
|
|
1731
1718
|
Managed assets are applied through the existing formatter workflow:
|
|
@@ -1742,6 +1729,37 @@ Set `installer.distribution` to `"releaseAsset"` when the installer itself shoul
|
|
|
1742
1729
|
|
|
1743
1730
|
Set `installer.service.removeLegacyUnits` to a list of systemd unit names when an installer must disable and remove older service units during upgrades.
|
|
1744
1731
|
|
|
1732
|
+
`installer.versionSelection` lists the ways a user picks the version (default `["latest", "version"]`): with neither flag the installer takes the newest Gitea release, `--version vX.Y.Z` a given tag, and adding `"major"` enables `--major N`, the newest release of that major.
|
|
1733
|
+
|
|
1734
|
+
The installer installs and updates in this order, and an update that fails leaves the previous installation running:
|
|
1735
|
+
|
|
1736
|
+
1. **Verify before touching anything.** In binary mode it downloads the platform's asset and `SHA256SUMS.txt` of the same release, refuses a digest that differs or is missing (with `sha256sum` or `shasum`; neither present is an error), and runs the new binary with `--version`. In source mode (`installer.modes.source`) it clones the tag and runs `commands` and `validate`. Any failure here exits non-zero with the running installation and service untouched.
|
|
1737
|
+
2. **Stop and move aside.** It stops the running `installer.service.detectNames` units and moves `installDir` to `installDir.previous.<pid>`; it never overwrites the old installation in place. Data under `installer.preservePaths` lives outside `installDir` and is not touched.
|
|
1738
|
+
3. **Install and check.** It installs the binary (or the source build, where every `executableFiles` entry must exist) into `installDir`, links it into `binDir`, creates `ensureDirs`, and runs the installed CLI with `--version`.
|
|
1739
|
+
4. **Restart.** If a service was running, it runs `installer.service.refreshCommand` (when set) and restarts `installer.service.restartName`.
|
|
1740
|
+
5. **Clean up.** Only after the restart succeeded it deletes the moved-aside installation.
|
|
1741
|
+
|
|
1742
|
+
If any step from 2 on fails, the installer removes the new files, moves the previous installation back, relinks it, restarts the service it stopped, and exits non-zero with the failed step and whether the previous state was fully restored. A failed first installation leaves nothing behind.
|
|
1743
|
+
|
|
1744
|
+
#### Migrating from `denoBinaryCli`
|
|
1745
|
+
|
|
1746
|
+
GitZone 9 refuses the removed keys with an error that names the replacement:
|
|
1747
|
+
|
|
1748
|
+
| Removed | Replacement |
|
|
1749
|
+
| --- | --- |
|
|
1750
|
+
| `kind: "denoBinaryCli"` | `kind: "binaryCli"` |
|
|
1751
|
+
| `@git.zone/tsdeno.compileTargets` | `@git.zone/tssea.targets` (see "Migrating from tsdeno" in the tssea readme); keep each `name`, and write the `.exe` of a Windows name |
|
|
1752
|
+
| `binary.targets`, `binary.outDir` | `@git.zone/tssea.targets`, `@git.zone/tssea.outDir` |
|
|
1753
|
+
| `releaseWorkflow.assetGlobs`, `releaseWorkflow.include` | none: the workflow uploads exactly the tssea executables, their notice files and `SHA256SUMS.txt` |
|
|
1754
|
+
| `releaseAssets` | `releaseWorkflow` |
|
|
1755
|
+
| `rawBranch`, `repository.rawBranch` | `repository.branch` |
|
|
1756
|
+
| `installer.delivery` | `installer.distribution` |
|
|
1757
|
+
| `installer.defaultMode` | `installer.modes.default` |
|
|
1758
|
+
| `installer.source` | `installer.modes.source` |
|
|
1759
|
+
| `installer.modes.source.validateCommand` | `installer.modes.source.validate` |
|
|
1760
|
+
| `installer.service.legacyUnitNames` | `installer.service.removeLegacyUnits` |
|
|
1761
|
+
| managed templates `asset_deno_binary_installer`, `asset_deno_binary_postinstall`, `asset_deno_binary_release_gitea` | `asset_binary_installer`, `asset_binary_postinstall`, `asset_binary_release_gitea` |
|
|
1762
|
+
|
|
1745
1763
|
### Sealed TsPack releases on Gitea
|
|
1746
1764
|
|
|
1747
1765
|
For a component that already builds and packages with `@git.zone/tspack`, select
|
|
@@ -1753,9 +1771,11 @@ Pin pnpm 11 or later in `package.json` using `packageManager`. The workflow inst
|
|
|
1753
1771
|
that version directly with the pinned official `pnpm/setup` action before the
|
|
1754
1772
|
explicit frozen dependency install. This avoids an older container-provided pnpm
|
|
1755
1773
|
launcher rewriting the lockfile while selecting the project's package manager.
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1774
|
+
`sealedRelease.nodeVersion` is the exact Node.js release (`x.y.z`) that installs the
|
|
1775
|
+
dependencies and runs the prepare and verify commands. The workflow installs it with the
|
|
1776
|
+
SHA-pinned official `actions/setup-node` v4.4.0 and checks `node --version` before
|
|
1777
|
+
anything else runs. It is independent of the Node.js release a SEA build tool embeds.
|
|
1778
|
+
GitZone 9 refuses the former `sealedRelease.denoVersion` with a migration error.
|
|
1759
1779
|
|
|
1760
1780
|
```json
|
|
1761
1781
|
{
|
|
@@ -1764,7 +1784,7 @@ this setup does not require a separate Deno action.
|
|
|
1764
1784
|
"schemaVersion": 1,
|
|
1765
1785
|
"kind": "tspackRelease",
|
|
1766
1786
|
"sealedRelease": {
|
|
1767
|
-
"
|
|
1787
|
+
"nodeVersion": "24.13.0",
|
|
1768
1788
|
"outputDirectory": "dist_control_release",
|
|
1769
1789
|
"prepareCommand": ["node", "scripts/release-control.mjs"],
|
|
1770
1790
|
"verifyCommand": ["node", "scripts/package-control.mjs", "--release", "--reuse"]
|
|
@@ -1875,32 +1895,18 @@ gitzone format --write --yes
|
|
|
1875
1895
|
gitzone format fix
|
|
1876
1896
|
```
|
|
1877
1897
|
|
|
1878
|
-
Formatters include cleanup, smartconfig normalization, dependency license checks, package metadata normalization, template updates, `.gitignore`, TypeScript config,
|
|
1898
|
+
Formatters include cleanup, smartconfig normalization, dependency license checks, package metadata normalization, template updates, `.gitignore`, TypeScript config, Prettier, README existence checks, and configured copy operations.
|
|
1879
1899
|
|
|
1880
1900
|
The `packagejson` formatter writes the `files` list of `package.json`. It ships the `ts/` and `ts_web/` sources without their `tsconfig.json`: `@git.zone/tsbuild` reads a folder's compiler options from `<folder>/tsconfig.json`, which extends the root `tsconfig.json`, and the package does not ship the root file. The list therefore ends with `!ts/tsconfig.json` and `!ts_web/tsconfig.json`; pnpm 10 and 12 apply an exclusion only after the entries that include the file.
|
|
1881
1901
|
|
|
1882
|
-
The
|
|
1883
|
-
|
|
1884
|
-
```json
|
|
1885
|
-
{
|
|
1886
|
-
"minimumDependencyAge": {
|
|
1887
|
-
"age": "P7D",
|
|
1888
|
-
"exclude": ["npm:@api.global/*", "npm:@git.zone/*", "npm:@push.rocks/*", "npm:zod"]
|
|
1889
|
-
}
|
|
1890
|
-
}
|
|
1891
|
-
```
|
|
1892
|
-
|
|
1893
|
-
The owner scopes and the owner's age are exported constants, so no repository keeps a hand-copied list:
|
|
1902
|
+
The owner npm scopes are an exported constant, so no repository keeps a hand-copied list:
|
|
1894
1903
|
|
|
1895
1904
|
```typescript
|
|
1896
|
-
import {
|
|
1905
|
+
import { ownerNpmScopes } from '@git.zone/cli';
|
|
1897
1906
|
// ownerNpmScopes: ['@api.global', '@apiclient.xyz', ..., '@push.rocks', '@serve.zone', ...]
|
|
1898
|
-
// ownerMinimumDependencyAge: 'P7D'
|
|
1899
1907
|
```
|
|
1900
1908
|
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
Tools must never pass `--min-dep-age` or `--minimum-dependency-age` to Deno: the flag replaces the whole setting and discards the exclusions in `deno.json`. `.npmrc` (`min-release-age`) and `NPM_CONFIG_MIN_RELEASE_AGE` set only the age; the exclusions stay in effect.
|
|
1909
|
+
`--only`, `--skip` and `@git.zone/cli.format.modules.only`/`skip` accept the module names `cleanup`, `smartconfig`, `license`, `packagejson`, `templates`, `assets`, `gitignore`, `tsconfig`, `prettier`, `readme` and `copy`; any other name is refused with that list. `gitzone format --write` writes nothing while the plan carries an error.
|
|
1904
1910
|
|
|
1905
1911
|
The template formatter owns `.vscode/settings.json` and `.vscode/launch.json` in every project, and the Gitea workflows, CLI entry points and HTML entry files of the project types that declare them. Workflow and entry files are written from the template as a whole. The formatter never creates or changes a `Dockerfile` or `.dockerignore`: they describe the project's own image. `gitzone template service` and `gitzone template website` scaffold a first pnpm-based Dockerfile.
|
|
1906
1912
|
|
|
@@ -2300,7 +2306,7 @@ machine-wide prune leaves them untouched.
|
|
|
2300
2306
|
NoSQLDB runs with SCRAM-SHA-256 authentication enabled; the root user is
|
|
2301
2307
|
`MONGODB_USER`/`MONGODB_PASS` in the `admin` database. Authentication can be
|
|
2302
2308
|
disabled per project for
|
|
2303
|
-
|
|
2309
|
+
clients that cannot complete a SCRAM handshake:
|
|
2304
2310
|
|
|
2305
2311
|
```bash
|
|
2306
2312
|
gitzone services auth mongodb off
|
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: '
|
|
6
|
+
version: '9.0.1',
|
|
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
|
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
import { isPlainObject } from './helpers.objects.js';
|
|
3
|
+
import { resolveProjectTsseaOutputs, type ITsseaOutput } from './helpers.tssea.js';
|
|
4
|
+
|
|
5
|
+
/** The managed asset kinds `@git.zone/cli.assets.kind` accepts. */
|
|
6
|
+
export const managedAssetKinds = ['binaryCli', 'tspackRelease'] as const;
|
|
7
|
+
export type TManagedAssetKind = (typeof managedAssetKinds)[number];
|
|
8
|
+
|
|
9
|
+
/** The operating system names the installer uses. */
|
|
10
|
+
export type TBinaryTargetOs = 'linux' | 'macos' | 'windows';
|
|
11
|
+
|
|
12
|
+
/** One executable `@git.zone/tssea` builds, as the managed installer, npm wrapper and release workflow address it. */
|
|
13
|
+
export interface IBinaryTarget {
|
|
14
|
+
/** The tssea target, e.g. `linux-x64`. */
|
|
15
|
+
target: ITsseaOutput['target'];
|
|
16
|
+
/** The exact executable file name, which is also its release asset name. */
|
|
17
|
+
name: string;
|
|
18
|
+
/** The installer's operating system label (`uname -s` mapped). */
|
|
19
|
+
os: TBinaryTargetOs;
|
|
20
|
+
arch: ITsseaOutput['arch'];
|
|
21
|
+
/** `<process.platform>:<process.arch>`, the npm wrapper's lookup key. */
|
|
22
|
+
nodeKey: string;
|
|
23
|
+
/** Human-readable platform, e.g. `macOS ARM64`. */
|
|
24
|
+
label: string;
|
|
25
|
+
/** The notice files tssea writes next to the executable. */
|
|
26
|
+
noticeFiles: string[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The executables of a `binaryCli` project. */
|
|
30
|
+
export interface IBinaryBuild {
|
|
31
|
+
/** tssea's output directory, relative to the project, `/`-separated. */
|
|
32
|
+
outDir: string;
|
|
33
|
+
targets: IBinaryTarget[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const osOfPlatform = (platformArg: ITsseaOutput['platform']): TBinaryTargetOs => {
|
|
37
|
+
switch (platformArg) {
|
|
38
|
+
case 'linux':
|
|
39
|
+
return 'linux';
|
|
40
|
+
case 'darwin':
|
|
41
|
+
return 'macos';
|
|
42
|
+
case 'win32':
|
|
43
|
+
return 'windows';
|
|
44
|
+
default: {
|
|
45
|
+
const unknownPlatform: never = platformArg;
|
|
46
|
+
throw new Error(`Unknown tssea platform: ${String(unknownPlatform)}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const osLabel = (osArg: TBinaryTargetOs): string => {
|
|
52
|
+
switch (osArg) {
|
|
53
|
+
case 'linux':
|
|
54
|
+
return 'Linux';
|
|
55
|
+
case 'macos':
|
|
56
|
+
return 'macOS';
|
|
57
|
+
case 'windows':
|
|
58
|
+
return 'Windows';
|
|
59
|
+
default: {
|
|
60
|
+
const unknownOs: never = osArg;
|
|
61
|
+
throw new Error(`Unknown operating system: ${String(unknownOs)}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const archLabel = (archArg: ITsseaOutput['arch']): string => {
|
|
67
|
+
switch (archArg) {
|
|
68
|
+
case 'x64':
|
|
69
|
+
return 'x64';
|
|
70
|
+
case 'arm64':
|
|
71
|
+
return 'ARM64';
|
|
72
|
+
default: {
|
|
73
|
+
const unknownArch: never = archArg;
|
|
74
|
+
throw new Error(`Unknown tssea architecture: ${String(unknownArch)}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The executables of the project's `@git.zone/tssea` configuration, resolved by the tssea
|
|
81
|
+
* the project installs. The output directory must lie inside the project, because the
|
|
82
|
+
* release workflow addresses it from the checkout.
|
|
83
|
+
*/
|
|
84
|
+
export const readBinaryBuild = async (
|
|
85
|
+
projectDirArg: string,
|
|
86
|
+
smartconfigDataArg: Record<string, unknown>,
|
|
87
|
+
): Promise<IBinaryBuild> => {
|
|
88
|
+
const resolved = await resolveProjectTsseaOutputs(projectDirArg, smartconfigDataArg);
|
|
89
|
+
const relativeOutDir = plugins.path.relative(plugins.path.resolve(projectDirArg), resolved.outDir);
|
|
90
|
+
if (!relativeOutDir || relativeOutDir.startsWith('..') || plugins.path.isAbsolute(relativeOutDir)) {
|
|
91
|
+
throw new Error(
|
|
92
|
+
`@git.zone/tssea.outDir resolves to ${resolved.outDir}, which is not a directory inside the project: binaryCli releases its executables from the project checkout.`,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
outDir: relativeOutDir.split(plugins.path.sep).join('/'),
|
|
97
|
+
targets: resolved.outputs.map((outputArg) => {
|
|
98
|
+
const os = osOfPlatform(outputArg.platform);
|
|
99
|
+
return {
|
|
100
|
+
target: outputArg.target,
|
|
101
|
+
name: outputArg.name,
|
|
102
|
+
os,
|
|
103
|
+
arch: outputArg.arch,
|
|
104
|
+
nodeKey: `${outputArg.platform}:${outputArg.arch}`,
|
|
105
|
+
label: `${osLabel(os)} ${archLabel(outputArg.arch)}`,
|
|
106
|
+
noticeFiles: [...outputArg.noticeFiles],
|
|
107
|
+
};
|
|
108
|
+
}),
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const removedIn = 'was removed in @git.zone/cli 9';
|
|
113
|
+
|
|
114
|
+
/** The value at a key path inside `@git.zone/cli.assets`; undefined when any segment is missing. */
|
|
115
|
+
const valueAt = (rootArg: Record<string, unknown>, pathArg: string[]): unknown => {
|
|
116
|
+
let value: unknown = rootArg;
|
|
117
|
+
for (const segment of pathArg) {
|
|
118
|
+
if (!isPlainObject(value)) {
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
value = value[segment];
|
|
122
|
+
}
|
|
123
|
+
return value;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/** Keys of the binary asset model that @git.zone/cli 9 removed, with the key that replaces each. */
|
|
127
|
+
const removedBinaryCliKeys: ReadonlyArray<{ path: string[]; replacement: string }> = [
|
|
128
|
+
{
|
|
129
|
+
path: ['binary', 'targets'],
|
|
130
|
+
replacement: 'binaryCli builds the targets of @git.zone/tssea.targets',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
path: ['binary', 'outDir'],
|
|
134
|
+
replacement: 'binaryCli reads the output directory from @git.zone/tssea.outDir',
|
|
135
|
+
},
|
|
136
|
+
{ path: ['releaseAssets'], replacement: 'use @git.zone/cli.assets.releaseWorkflow' },
|
|
137
|
+
{ path: ['rawBranch'], replacement: 'use @git.zone/cli.assets.repository.branch' },
|
|
138
|
+
{ path: ['repository', 'rawBranch'], replacement: 'use @git.zone/cli.assets.repository.branch' },
|
|
139
|
+
{ path: ['installer', 'delivery'], replacement: 'use @git.zone/cli.assets.installer.distribution' },
|
|
140
|
+
{ path: ['installer', 'defaultMode'], replacement: 'use @git.zone/cli.assets.installer.modes.default' },
|
|
141
|
+
{ path: ['installer', 'source'], replacement: 'use @git.zone/cli.assets.installer.modes.source' },
|
|
142
|
+
{
|
|
143
|
+
path: ['installer', 'modes', 'source', 'validateCommand'],
|
|
144
|
+
replacement: 'use @git.zone/cli.assets.installer.modes.source.validate',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
path: ['installer', 'service', 'legacyUnitNames'],
|
|
148
|
+
replacement: 'use @git.zone/cli.assets.installer.service.removeLegacyUnits',
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
path: ['releaseWorkflow', 'assetGlobs'],
|
|
152
|
+
replacement: 'the release workflow uploads exactly the @git.zone/tssea executables, their notice files and SHA256SUMS.txt',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
path: ['releaseWorkflow', 'include'],
|
|
156
|
+
replacement: 'the release workflow uploads exactly the @git.zone/tssea executables, their notice files and SHA256SUMS.txt',
|
|
157
|
+
},
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
/** The binary asset templates @git.zone/cli 9 renamed. */
|
|
161
|
+
const renamedTemplates: Readonly<Record<string, string>> = {
|
|
162
|
+
asset_deno_binary_installer: 'asset_binary_installer',
|
|
163
|
+
asset_deno_binary_postinstall: 'asset_binary_postinstall',
|
|
164
|
+
asset_deno_binary_release_gitea: 'asset_binary_release_gitea',
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The configuration errors of an enabled `@git.zone/cli.assets` object that come from
|
|
169
|
+
* keys @git.zone/cli 9 removed or renamed. Each message names the migration.
|
|
170
|
+
*/
|
|
171
|
+
export const getManagedAssetsMigrationErrors = (assetsArg: Record<string, unknown>): string[] => {
|
|
172
|
+
const errors: string[] = [];
|
|
173
|
+
if (assetsArg.kind === 'denoBinaryCli') {
|
|
174
|
+
errors.push(
|
|
175
|
+
`Managed asset kind "denoBinaryCli" ${removedIn}: set @git.zone/cli.assets.kind to "binaryCli" and move @git.zone/tsdeno.compileTargets to @git.zone/tssea.targets (see "Migrating from tsdeno" in the @git.zone/tssea readme).`,
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
if (assetsArg.kind === 'binaryCli' || assetsArg.kind === 'denoBinaryCli') {
|
|
179
|
+
for (const removed of removedBinaryCliKeys) {
|
|
180
|
+
if (valueAt(assetsArg, removed.path) !== undefined) {
|
|
181
|
+
errors.push(`@git.zone/cli.assets.${removed.path.join('.')} ${removedIn}: ${removed.replacement}.`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (isPlainObject(assetsArg.sealedRelease) && assetsArg.sealedRelease.denoVersion !== undefined) {
|
|
186
|
+
errors.push(
|
|
187
|
+
`@git.zone/cli.assets.sealedRelease.denoVersion ${removedIn}: set sealedRelease.nodeVersion to the exact Node.js release (x.y.z) that runs the prepare and verify commands.`,
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
if (Array.isArray(assetsArg.managed)) {
|
|
191
|
+
for (const entry of assetsArg.managed) {
|
|
192
|
+
const template = isPlainObject(entry) ? entry.template : undefined;
|
|
193
|
+
if (typeof template === 'string' && renamedTemplates[template]) {
|
|
194
|
+
errors.push(
|
|
195
|
+
`Managed asset template "${template}" was renamed in @git.zone/cli 9: use "${renamedTemplates[template]}".`,
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return errors;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Throws the migration errors of an enabled `@git.zone/cli.assets` object, so every
|
|
205
|
+
* reader of the asset model refuses a removed key the same way.
|
|
206
|
+
*/
|
|
207
|
+
export const assertManagedAssetsCurrent = (assetsArg: unknown): void => {
|
|
208
|
+
if (!isPlainObject(assetsArg) || assetsArg.enabled === false) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const errors = getManagedAssetsMigrationErrors(assetsArg);
|
|
212
|
+
if (errors.length > 0) {
|
|
213
|
+
throw new Error(errors.join('\n'));
|
|
214
|
+
}
|
|
215
|
+
};
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The npm scopes the owner publishes under. A release-age rule (pnpm
|
|
3
|
-
* `minimumReleaseAge
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* This list is the single source for those exemptions. `gitzone format`
|
|
8
|
-
* writes it into the root `deno.json` as `minimumDependencyAge.exclude`
|
|
9
|
-
* (`npm:<scope>/*` per scope), so no repository keeps a hand-copied list.
|
|
3
|
+
* `minimumReleaseAge`) holds back freshly published third-party versions; it
|
|
4
|
+
* must never hold back our own packages, which are consumed right after their
|
|
5
|
+
* release. This list is the single source for those exemptions.
|
|
10
6
|
*/
|
|
11
7
|
export const ownerNpmScopes = [
|
|
12
8
|
'@api.global',
|
|
@@ -74,11 +70,3 @@ export const ownerNpmScopes = [
|
|
|
74
70
|
'@workspace.global_private',
|
|
75
71
|
] as const;
|
|
76
72
|
|
|
77
|
-
/**
|
|
78
|
-
* The minimum dependency age `gitzone format` writes into a root `deno.json`
|
|
79
|
-
* that sets none (a missing or `null` age): 7 days, as an ISO 8601 duration.
|
|
80
|
-
* It mirrors the owner's pnpm `minimumReleaseAge` of 10080 minutes, so
|
|
81
|
-
* third-party packages wait as long under Deno as under pnpm. An age a project
|
|
82
|
-
* already sets is never changed.
|
|
83
|
-
*/
|
|
84
|
-
export const ownerMinimumDependencyAge = 'P7D';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as plugins from "./plugins.js";
|
|
2
2
|
import { getCliNamespaceConfig, readSmartconfigFile } from "./helpers.smartconfig.js";
|
|
3
3
|
import { isPlainObject } from "./helpers.objects.js";
|
|
4
|
+
import { assertManagedAssetsCurrent } from "./helpers.managedassets.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* The named groups of package.json `files` entries, in the order the generated
|
|
@@ -62,17 +63,19 @@ const configPath = "@git.zone/cli.packageFiles";
|
|
|
62
63
|
|
|
63
64
|
/**
|
|
64
65
|
* The sets as they stand for one project. `binary` carries the installer and
|
|
65
|
-
* npm wrapper of managed `
|
|
66
|
+
* npm wrapper of managed `binaryCli` assets and is empty otherwise. Assets that
|
|
67
|
+
* use a key @git.zone/cli 9 removed are refused with the migration.
|
|
66
68
|
*/
|
|
67
69
|
export const getPackageFileSets = (
|
|
68
70
|
assetsArg: IPackageFilesAssetsConfig | undefined,
|
|
69
71
|
): Record<TPackageFileSetName, IPackageFileSet> => {
|
|
72
|
+
assertManagedAssetsCurrent(assetsArg);
|
|
70
73
|
const assets = assetsArg?.enabled === false ? undefined : assetsArg;
|
|
71
74
|
const binary: string[] = [];
|
|
72
|
-
if (assets?.kind === "
|
|
75
|
+
if (assets?.kind === "binaryCli" && assets.installer?.enabled !== false) {
|
|
73
76
|
binary.push(assets.installer?.file || "install.sh");
|
|
74
77
|
}
|
|
75
|
-
if (assets?.kind === "
|
|
78
|
+
if (assets?.kind === "binaryCli" && assets.npmWrapper?.enabled) {
|
|
76
79
|
binary.push("bin/");
|
|
77
80
|
binary.push(assets.npmWrapper.postinstallFile || "scripts/install-binary.js");
|
|
78
81
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
export const getSealedReleaseConfigError = (value: unknown): string | undefined => {
|
|
3
3
|
const config = value as Record<string, unknown> | null;
|
|
4
4
|
if (!config || typeof config !== 'object' || Array.isArray(config) ||
|
|
5
|
-
typeof config.
|
|
5
|
+
typeof config.nodeVersion !== 'string' || !/^\d+\.\d+\.\d+$/.test(config.nodeVersion) ||
|
|
6
6
|
typeof config.outputDirectory !== 'string' || !/^dist_[a-zA-Z0-9_-]+$/.test(config.outputDirectory) ||
|
|
7
7
|
config.outputDirectory === 'dist_gitzone_retained' ||
|
|
8
8
|
!['prepareCommand', 'verifyCommand'].every((key) => Array.isArray(config[key]) && config[key].length > 0 &&
|
|
9
9
|
config[key].every((item: unknown) => typeof item === 'string' && item.length > 0 && !item.includes('\0')))) {
|
|
10
|
-
return 'tspackRelease requires
|
|
10
|
+
return 'tspackRelease requires an exact Node.js version (sealedRelease.nodeVersion, x.y.z), a dist_ output directory and explicit prepare/verify command arrays.';
|
|
11
11
|
}
|
|
12
12
|
return undefined;
|
|
13
13
|
};
|