@arc-e-tect/api-only-publisher 0.12.1 → 0.13.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/README.adoc CHANGED
@@ -6,7 +6,7 @@
6
6
  :source-highlighter: rouge
7
7
  // The released version of this component: its snippets use it. The release
8
8
  // workflow updates it; do not change it by hand.
9
- :api-only-publisher-version: 0.12.1
9
+ :api-only-publisher-version: 0.13.0
10
10
 
11
11
  image:https://github.com/Arc-E-Tect/SoftwareEngineeringDoneRight-API/actions/workflows/nvd-cache-refresh.yml/badge.svg[Vulnerability Scan,link=https://github.com/Arc-E-Tect/SoftwareEngineeringDoneRight-API/actions/workflows/nvd-cache-refresh.yml]
12
12
  image:https://img.shields.io/npm/v/@arc-e-tect/api-only-publisher[npm,link=https://www.npmjs.com/package/@arc-e-tect/api-only-publisher]
@@ -839,7 +839,7 @@ lint:
839
839
  openapi: warn # a request body or response with no example: error, warn (the default) or off
840
840
 
841
841
  toolchain:
842
- redocly: "@redocly/cli@2.55.0"
842
+ redocly: "@redocly/cli@2.57.0"
843
843
  asyncapi: "@asyncapi/cli@6.2.0"
844
844
 
845
845
  channels:
@@ -923,6 +923,56 @@ A bundler installed there at exactly the pinned version runs from there, without
923
923
 
924
924
  The Docker image sets both, with `never`, <<docker-toolchain>>.
925
925
 
926
+ [#toolchain-update]
927
+ === Moving the Publisher's own pins
928
+
929
+ This section is for the Publisher's maintainers; a library moves its own pins in its `apionly.yaml`.
930
+
931
+ The Publisher pins one version of each bundler, `TOOLCHAIN_PIN` in link:src/init-config.js[`src/init-config.js` →], and those pins are part of the Publisher, not dependencies of it.
932
+ `init` writes them into every new `apionly.yaml`, the Publisher fetches exactly those versions with `npx`, and the Docker image installs them and runs no other, <<docker-toolchain,the toolchain rule §>>.
933
+ A library that pins the old version fails with a new image, so moving a pin is a feature release of its own.
934
+ Each version is quoted in `TOOLCHAIN_PIN`, in link:docker/toolchain/package.json[`docker/toolchain/package.json` →] and its lockfile, which the image installs, in the image's labels in link:Dockerfile[`Dockerfile` →], in this README and in the tests, and link:scripts/toolchain-update.js[`scripts/toolchain-update.js` →] changes them all, run through its wrapper:
935
+
936
+ [source,console]
937
+ ----
938
+ api-only-publisher/scripts/toolchain-update.sh --redocly <version> [--asyncapi <version>]
939
+ api-only-publisher/scripts/toolchain-update.sh --asyncapi <version> --breaking "<what a library must change>"
940
+ api-only-publisher/scripts/toolchain-update.sh --audit-fix
941
+ ----
942
+
943
+ link:scripts/toolchain-update.sh[`scripts/toolchain-update.sh` →] runs the script from any directory.
944
+ From `api-only-publisher/`, `npm run toolchain:update -- <options>` does the same; npm needs the `--`, or it takes the options for itself.
945
+ `--help`, or no arguments at all, explains every option.
946
+
947
+ From a clean working tree, it:
948
+
949
+ . creates a branch from `origin/main`, named for what it changes, such as `toolchain/redocly-<version>` or `toolchain/audit-fix-<date>`;
950
+ . changes the manifest and regenerates its lockfile, applying `npm audit fix` to it given `--audit-fix`;
951
+ . compares the packages that have an install script with the manifest's `allowScripts`, and when they differ, names them and stops, changing nothing, until it is run again with `--approve-scripts`, which records the new list;
952
+ . replaces the old pin in every tracked file except the changelog, the lockfiles and link:.trivyignore.yaml[`.trivyignore.yaml` →];
953
+ . runs `npm test`, then builds the image and smoke-tests it as the build workflow does;
954
+ . commits the change as `feat(api-only-publisher): ship ...`, or, given `--breaking`, as `feat(api-only-publisher)!: ship ...` with the given text as its `BREAKING CHANGE` footer, or, for `npm audit fix` alone, as `fix(api-only-publisher): apply npm audit fixes to the image's toolchain`, since what the image installs changes;
955
+ . pushes the branch and opens a pull request titled as the commit, so a squash merge releases what the commit says.
956
+
957
+ The commit and the pull request list what a library must change, what `npm audit fix` changed in the lockfile, `npm audit`'s findings before and after, the install scripts approved, and every review in `.trivyignore.yaml` to redo.
958
+
959
+ The image never runs an install script (`npm ci --ignore-scripts`), and the smoke test proves the toolchain works without them.
960
+ Approving them still records that each one was reviewed, wherever the toolchain is installed.
961
+
962
+ A failure after the approval stops before the commit and leaves the branch to inspect.
963
+ `--skip-smoke` leaves the image to the build workflow, on a machine without Docker, and `--no-push` stops after the commit.
964
+ A new major version of a tool is a feature unless `--breaking` says otherwise, and the script warns about it.
965
+
966
+ `.trivyignore.yaml` records the version each accepted finding was reviewed against.
967
+ When that version changes, the review is redone rather than rewritten, and the commit names it.
968
+
969
+ [#toolchain-dependency-updates]
970
+ ==== What a dependency updater changes
971
+
972
+ `"x-updater": "report-only"` in `docker/toolchain/package.json` asks a dependency updater to report a newer version of a tool, and what `npm audit` finds, rather than install anything there: installing one is the change above.
973
+ Everything in the Publisher's own link:package.json[`package.json` →] is an ordinary dependency, left to a dependency updater: `yaml`, and semantic-release and its plugins, with which the Publisher is released.
974
+ link:../README.adoc#dependency-updates[The repository's dependency updates →] list every project, and which of the two changes it.
975
+
926
976
  [#behaviour]
927
977
  == Behaviour worth knowing about
928
978
 
@@ -1217,7 +1267,7 @@ Besides the OCI annotations -- `source`, `revision`, `version`, `created`, `lice
1217
1267
  [cols="2,1", options="header"]
1218
1268
  |===
1219
1269
  | Label | Example
1220
- | `com.arc-e-tect.api-only-publisher.toolchain.redocly` | `@redocly/cli@2.55.0`
1270
+ | `com.arc-e-tect.api-only-publisher.toolchain.redocly` | `@redocly/cli@2.57.0`
1221
1271
  | `com.arc-e-tect.api-only-publisher.toolchain.asyncapi` | `@asyncapi/cli@6.2.0`
1222
1272
  |===
1223
1273
 
@@ -1349,8 +1399,8 @@ A library pinning another version fails at once, before anything is built and wi
1349
1399
 
1350
1400
  ----
1351
1401
  Error: apionly.yaml's toolchain.redocly pins @redocly/cli@2.51.0, and API_ONLY_PUBLISHER_TOOLCHAIN_DOWNLOAD=never forbids downloading it.
1352
- This installation carries @asyncapi/cli@6.2.0 and @redocly/cli@2.55.0.
1353
- Set toolchain.redocly to "@redocly/cli@2.55.0" in apionly.yaml, or use the api-only-publisher image whose com.arc-e-tect.api-only-publisher.toolchain.redocly label is @redocly/cli@2.51.0.
1402
+ This installation carries @asyncapi/cli@6.2.0 and @redocly/cli@2.57.0.
1403
+ Set toolchain.redocly to "@redocly/cli@2.57.0" in apionly.yaml, or use the api-only-publisher image whose com.arc-e-tect.api-only-publisher.toolchain.redocly label is @redocly/cli@2.51.0.
1354
1404
  To allow the download instead, run with API_ONLY_PUBLISHER_TOOLCHAIN_DOWNLOAD=allow.
1355
1405
  ----
1356
1406
 
@@ -1469,6 +1519,8 @@ The release workflow calls link:../.github/workflows/api-only-publisher-image.ym
1469
1519
  A failure in any of these never undoes the npm release; the workflow summary shows it.
1470
1520
  A branch that changes what the image is built from builds it for `linux/amd64` and smoke-tests it, without pushing.
1471
1521
 
1522
+ The image's toolchain moves with the Publisher's own pins, <<toolchain-update,Moving the Publisher's own pins §>>.
1523
+
1472
1524
  [#docker-secrets]
1473
1525
  ==== Secrets and variables
1474
1526
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arc-e-tect/api-only-publisher",
3
- "version": "0.12.1",
3
+ "version": "0.13.0",
4
4
  "description": "Builds, packs and publishes API description documents from a library of reusable fragments.",
5
5
  "license": "MIT",
6
6
  "author": "Arc-E-Tect",
@@ -36,7 +36,8 @@
36
36
  },
37
37
  "scripts": {
38
38
  "test": "node --test --experimental-test-coverage --test-coverage-lines=90 --test-coverage-functions=90 --test-coverage-branches=80 test/*.test.js",
39
- "test:quick": "node --test test/*.test.js"
39
+ "test:quick": "node --test test/*.test.js",
40
+ "toolchain:update": "node scripts/toolchain-update.js"
40
41
  },
41
42
  "dependencies": {
42
43
  "yaml": "2.9.1"
@@ -17,7 +17,7 @@ const YAML = require("yaml");
17
17
 
18
18
  /** Where a kind's tool is pinned in `toolchain`; the two kinds do not share a key name. */
19
19
  const TOOLCHAIN_KEY = { openapi: "redocly", asyncapi: "asyncapi" };
20
- const TOOLCHAIN_PIN = { openapi: "@redocly/cli@2.55.0", asyncapi: "@asyncapi/cli@6.2.0" };
20
+ const TOOLCHAIN_PIN = { openapi: "@redocly/cli@2.57.0", asyncapi: "@asyncapi/cli@6.2.0" };
21
21
 
22
22
  /**
23
23
  * The slots scaffold(v) would fill for one kind, in the order config(v) declares them,