@bensandee/tooling 0.75.0 → 0.77.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.md +54 -6
- package/dist/bin.mjs +4490 -1737
- package/package.json +17 -16
- package/tooling.schema.json +50 -3
package/README.md
CHANGED
|
@@ -67,6 +67,12 @@ Explicit flags always win, regardless of branch:
|
|
|
67
67
|
|
|
68
68
|
If both are passed, `--no-coverage` wins.
|
|
69
69
|
|
|
70
|
+
Set `.tooling.json#coverage.gateOnPullRequests: true` to turn coverage collection on for every
|
|
71
|
+
branch, including refs that resolve to no branch at all (a detached HEAD, a tag, a
|
|
72
|
+
`refs/pull/N/merge` build) -- `auto` mode then always runs `pnpm run test:coverage`, regardless of
|
|
73
|
+
branch. An explicit `--no-coverage` still wins. This changes collection only: coverage **recording**
|
|
74
|
+
and history stay default-branch-only either way.
|
|
75
|
+
|
|
70
76
|
Because the decision is branch-aware, the generated CI workflow runs plain `pnpm ci:check` (no coverage flag) and lets `checks:run` decide -- except when coverage is disabled in `.tooling.json`, where it passes `--no-coverage` to force it off everywhere.
|
|
71
77
|
|
|
72
78
|
**Extend the `check` script with `--add`, never a shell chain.** `repo:sync` generates `check` as a single rooted command (`bst checks:run`) and `ci:check` as `pnpm check --skip 'docker:*'`. When CI runs `pnpm ci:check`, pnpm appends the resolved `--skip 'docker:*'` (and any flags you add, e.g. `--no-coverage`) to the _end_ of the resolved script -- so they reach `bst checks:run` only if that is the last command. Adding extra checks via an `&&` chain silently drops `--skip 'docker:*'` and any forwarded flag:
|
|
@@ -258,6 +264,37 @@ Convention and overrides coexist -- a repo can use both.
|
|
|
258
264
|
|
|
259
265
|
Works for both `changesets` and `simple` release strategies, on Forgejo (via API upload) and GitHub (via `gh release upload --clobber`). The asset step in the workflow is gated on the release itself having published/pushed, so failed releases never upload stale artifacts.
|
|
260
266
|
|
|
267
|
+
#### Version stamping
|
|
268
|
+
|
|
269
|
+
For a repo whose released artifact carries its version somewhere other than `package.json` -- a WordPress theme's `style.css` header, a plugin banner, a template file -- declare where the version goes and let `release:assets` write it in:
|
|
270
|
+
|
|
271
|
+
```json
|
|
272
|
+
{
|
|
273
|
+
"versionStamp": [{ "file": "style.css", "prefix": "Version: " }]
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
| Field | Description |
|
|
278
|
+
| -------- | ------------------------------------------------------------------------------------- |
|
|
279
|
+
| `file` | Path to the file whose version line gets stamped, relative to the project root (required). |
|
|
280
|
+
| `prefix` | Literal string (never a pattern) the target line must start with (required). |
|
|
281
|
+
| `suffix` | Literal string (never a pattern) the target line must end with (optional; default: none). |
|
|
282
|
+
|
|
283
|
+
`prefix` and `suffix` are literal strings, not regexes -- the target line is read straight off `prefix + version + suffix`:
|
|
284
|
+
|
|
285
|
+
| Target | `prefix` | `suffix` |
|
|
286
|
+
| ------------------------------------ | ---------------------------- | -------------- |
|
|
287
|
+
| `Version: 1.2.3` (WordPress theme) | `"Version: "` | -- |
|
|
288
|
+
| ` * Version: 1.2.3` (plugin header) | `" * Version: "` | -- |
|
|
289
|
+
| `Version: v1.2.3` | `"Version: v"` | -- |
|
|
290
|
+
| `__version__ = "1.2.3"` | `"__version__ = \""` | `"\""` |
|
|
291
|
+
| `<version>1.2.3</version>` | `"<version>"` | `"</version>"` |
|
|
292
|
+
| `define('FOO_VERSION', '1.2.3');` | `"define('FOO_VERSION', '"` | `"');"` |
|
|
293
|
+
|
|
294
|
+
`release:assets` stamps every configured file before building assets, then verifies the stamp survived the build. Exactly one line in the file must match `prefix`/`suffix` or the release fails loudly -- zero matches means the config is broken, and more than one is an ambiguous config that needs a more specific `prefix` or a second entry. The stamp is never committed: the tracked copy of the file keeps its placeholder version on purpose, so there is only ever one source of truth (`package.json#version`) and nothing to drift. Run `bst release:assets --dry-run` to rehearse a `versionStamp` config locally, with no forge access and no release -- the rehearsal does still write the stamp, so it leaves the tracked file modified in your working tree. Discard it with `git checkout -- <file>`; committing it is exactly the drift this design exists to prevent.
|
|
295
|
+
|
|
296
|
+
`repo:sync --check` validates that every `versionStamp[].file` exists and still has exactly one matching line -- it never compares the stamped value to `package.json#version`, since the tracked value is deliberately stale.
|
|
297
|
+
|
|
261
298
|
### Coverage tracking
|
|
262
299
|
|
|
263
300
|
| Command | Description |
|
|
@@ -321,12 +358,12 @@ Or keep the local ratchet but skip the CI history append:
|
|
|
321
358
|
{ "coverage": { "history": "none" } }
|
|
322
359
|
```
|
|
323
360
|
|
|
324
|
-
| Override field | Default | Description
|
|
325
|
-
| -------------------- | ------------------------ |
|
|
326
|
-
| `history` | `"orphan-branch"` | `"none"` disables CI history; the local ratchet still works
|
|
327
|
-
| `historyBranch` | `"bst/coverage-metrics"` | Override the orphan branch name
|
|
328
|
-
| `tolerancePp` | `0.1` | Tolerance in percentage points before `coverage:check` flags a drop
|
|
329
|
-
| `gateOnPullRequests` | `false` |
|
|
361
|
+
| Override field | Default | Description |
|
|
362
|
+
| -------------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------- |
|
|
363
|
+
| `history` | `"orphan-branch"` | `"none"` disables CI history; the local ratchet still works |
|
|
364
|
+
| `historyBranch` | `"bst/coverage-metrics"` | Override the orphan branch name |
|
|
365
|
+
| `tolerancePp` | `0.1` | Tolerance in percentage points before `coverage:check` flags a drop |
|
|
366
|
+
| `gateOnPullRequests` | `false` | `true` makes `checks:run`'s `auto` mode collect coverage on every branch, not only the default one; recording is unaffected |
|
|
330
367
|
|
|
331
368
|
#### Per-package re-sum
|
|
332
369
|
|
|
@@ -464,6 +501,17 @@ Available override fields:
|
|
|
464
501
|
| `detectPackageTypes` | boolean | `true` |
|
|
465
502
|
| `pnpmWorkspace` | `false` | Set to `false` to opt out of `pnpm-workspace.yaml` management |
|
|
466
503
|
|
|
504
|
+
## Environment file
|
|
505
|
+
|
|
506
|
+
Set `BST_ENV_FILE` to the path of an env file and every `bst` command loads it before anything else runs -- a way to feed tokens to the tools from one annotated file without exporting them into your shell:
|
|
507
|
+
|
|
508
|
+
```bash
|
|
509
|
+
# in your shell profile
|
|
510
|
+
export BST_ENV_FILE=/home/you/.secrets.env
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
The file takes `KEY=value` lines, `#` comments, blank lines, and an optional `export ` prefix. A variable already set in the environment always wins over the file, so a container's `-e` or a shell export is never overridden. Unset, no file is touched; set to a file that cannot be read, the command fails before it starts (under `--json`, as the usual `{ok: false}` document). Name the file so it ends in `.env`: the bst-hook then keeps an agent session from reading or writing it while the tools still load it. This is a development convenience -- a production container should receive every variable through `docker run -e` and leave `BST_ENV_FILE` unset.
|
|
514
|
+
|
|
467
515
|
## Debug logging
|
|
468
516
|
|
|
469
517
|
All CLI commands support a `--verbose` flag for detailed debug output. Alternatively, set `TOOLING_DEBUG=true` as an environment variable -- useful in CI workflows:
|