@taraxvoid/voidflow 0.13.0-next → 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.md CHANGED
@@ -14,6 +14,19 @@ It is semi-opinionated: the defaults match how my own sites are built (bun, Astr
14
14
  - [Queer Omaha](https://queeromaha.net), [Synth Omaha](https://synthomaha.net) and [Soundry](https://soundryomaha.net), free community sites for Omaha's queer and music scenes
15
15
  - [ravenflight.io](https://ravenflight.io), RavenFlight's marketing site
16
16
 
17
+ ### Show you use it
18
+
19
+ Optional. Paste this into your site's README. It follows light and dark mode.
20
+
21
+ ```html
22
+ <a href="https://github.com/taraxvoid/voidflow">
23
+ <picture>
24
+ <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/badge/CI-voidflow-8b8fd9?labelColor=2b2d3a&style=flat">
25
+ <img alt="CI: voidflow" src="https://img.shields.io/badge/CI-voidflow-5a5fb8?labelColor=3a3d4d&style=flat">
26
+ </picture>
27
+ </a>
28
+ ```
29
+
17
30
  ## Usage
18
31
 
19
32
  Point `uses` in your configuration at a workflow, e.g. in your `.github/workflows/ci.yml`. Pin to a release commit SHA with the version in a comment, the same way you would any third-party action (see [Versioning](#versioning)).
@@ -87,6 +100,40 @@ or `engines` in `package.json`. The lockfile (`bun.lock` or `pnpm-lock.yaml`)
87
100
  follows the package manager. `build-env` is a JSON object, visible in logs, so
88
101
  no secrets.
89
102
 
103
+ ### Install-time security scanner (Socket)
104
+
105
+ A bun site can set a security scanner in `bunfig.toml`, which checks every
106
+ package on install:
107
+
108
+ ```toml
109
+ [install.security]
110
+ scanner = "@socketsecurity/bun-security-scanner"
111
+ ```
112
+
113
+ CI skips it by default. The scanner calls a third-party API on every install,
114
+ so a network blip or an API change could fail a build that otherwise passes,
115
+ and rerunning the same commit could give a different result. `site-ci.yml`
116
+ installs with a copy of `bunfig.toml` minus the scanner line (every other
117
+ setting, e.g. `minimumReleaseAge`, still applies) and leaves a notice in the
118
+ run. Local `bun install` reads `bunfig.toml` as is, so the scanner still runs
119
+ on your machine.
120
+
121
+ To run it in CI too, pass `socket-scanner: true` to `site-ci.yml`. A workflow
122
+ that installs on its own (outside `site-ci.yml`) gets the same default from
123
+ the composite action:
124
+
125
+ ```yaml
126
+ - uses: oven-sh/setup-bun@<sha> # <version>
127
+ - uses: taraxvoid/voidflow/actions/bun-install@<sha> # <version>
128
+ # with: { socket-scanner: 'true' }
129
+ ```
130
+
131
+ The copy is checked by parsing both files: it must equal your `bunfig.toml`
132
+ with only `install.security.scanner` removed. Set the scanner as a plain
133
+ `scanner = "..."` line (or the dotted `security.scanner` form); if it can't be
134
+ removed cleanly, e.g. an inline table, the install fails rather than run or
135
+ skip the scanner silently. pnpm sites are unaffected.
136
+
90
137
  ## Workflow Types
91
138
 
92
139
  ### Validation / Checks
@@ -124,8 +171,11 @@ and add `.unlighthouse/` to the site's `.gitignore`.
124
171
 
125
172
  `site-ci.yml` runs `bun run check:licenses` when the lockfile or `scripts/`
126
173
  change. Sites implement that script with the shared check, which runs
127
- `license-checker` in the site's repo root and fails on GPL, AGPL, SSPL and
128
- similar copyleft licenses (LGPL is allowed).
174
+ `license-checker-rseidelsohn` in the site's repo root and fails on GPL, AGPL,
175
+ SSPL and similar copyleft licenses (LGPL is allowed). Voidflow pins the
176
+ checker to an exact version as its own dependency, so sites don't need to
177
+ install it and every site runs the same version (sites that added
178
+ `license-checker-rseidelsohn` as a devDependency for 0.12.2 can drop it).
129
179
 
130
180
  With `@taraxvoid/voidflow` as a devDependency, call the bin from the site's
131
181
  `package.json`:
@@ -220,10 +270,35 @@ site's own `lefthook.yml` can add commands (for example image compression) but
220
270
  cannot override ones defined here. Differences go through `package.json`
221
271
  scripts: define `test:unit:precommit` (for example excluding tests that need a
222
272
  built `dist/`) and the pre-commit unit step runs it instead of `test:unit`.
273
+ Likewise, define `check:precommit` and the typecheck step runs it instead of
274
+ `check`. CI keeps calling the full scripts, so these only narrow what runs
275
+ locally. Common uses:
276
+
277
+ - bun: `"test:unit:precommit": "bun test --changed"` runs only the test files
278
+ whose imports reach an uncommitted change.
279
+ - pnpm workspace: `pnpm -r --filter '...[HEAD]' run <script>` runs only the
280
+ changed packages and their dependents. Fall back to the full run when a
281
+ root-level file (lockfile, shared tsconfig) changed, since those don't
282
+ belong to any package. If the root `package.json` defines the same script
283
+ as a recursive run, add `--filter '!{.}'` so it doesn't recurse.
284
+
285
+ Hook-level options merge too. Don't set `parallel: true` under `pre-commit:` in
286
+ the site's `lefthook.yml`: it applies to the merged hook, so every step,
287
+ including the shared ones, starts at once and their `priority` order is ignored
288
+ (tests that share a database or build output can then time out).
223
289
 
224
290
  Install the binary through mise (`lefthook = "<version>"` in `mise.toml`) and
225
- set `"prepare": "lefthook install"` so `bun install` wires the hooks. `ref`
226
- cannot be a commit SHA; pin a release tag.
291
+ set the `prepare` script so `bun install` wires the hooks, but make it tolerate a
292
+ missing binary:
293
+
294
+ ```json
295
+ "prepare": "lefthook install || echo 'lefthook not installed (run mise install); git hooks skipped'"
296
+ ```
297
+
298
+ A bare `lefthook install` fails the whole install step (exit 127) on any runner
299
+ without the `lefthook` binary, which includes GitHub-hosted and self-hosted CI
300
+ images, and CI never runs git hooks anyway. `ref` cannot be a commit SHA; pin a
301
+ release tag.
227
302
 
228
303
  ## Branch rulesets as code
229
304
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taraxvoid/voidflow",
3
- "version": "0.13.0-next",
3
+ "version": "0.13.0",
4
4
  "description": "Shared workflows, actions and tooling for @taraxvoid sites",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -49,8 +49,16 @@
49
49
  "peerDependencies": {
50
50
  "@playwright/test": ">=1.40"
51
51
  },
52
+ "peerDependenciesMeta": {
53
+ "@playwright/test": {
54
+ "optional": true
55
+ }
56
+ },
52
57
  "devDependencies": {
53
- "@playwright/test": "^1.40.0",
54
- "@socketsecurity/bun-security-scanner": "^1.1.3"
58
+ "@playwright/test": "1.64.0",
59
+ "@socketsecurity/bun-security-scanner": "1.1.3"
60
+ },
61
+ "dependencies": {
62
+ "license-checker-rseidelsohn": "5.0.1"
55
63
  }
56
64
  }
@@ -2,14 +2,18 @@
2
2
  /**
3
3
  * Shared license policy check for the Astro/bun site stack: fail on GPL kudzu.
4
4
  *
5
- * Runs `license-checker` against the current working directory (the caller's
5
+ * Runs `license-checker-rseidelsohn` against the current working directory (the caller's
6
6
  * repo root) and exits non-zero if any installed package carries a blocked
7
- * license.
7
+ * license. The checker is voidflow's own exact-pinned dependency, resolved from
8
+ * voidflow's install rather than `bunx`, so every site runs the same version
9
+ * and nothing is fetched at check time.
8
10
  *
9
11
  * Usage: bun check-licenses.ts
10
12
  */
11
13
 
12
14
  import { spawnSync } from 'node:child_process'
15
+ import { readFileSync } from 'node:fs'
16
+ import { dirname, join } from 'node:path'
13
17
 
14
18
  export const FAIL_ON = [
15
19
  'GPL-1.0',
@@ -41,15 +45,26 @@ export const FAIL_ON = [
41
45
  // modifying/statically linking the library, not on depending on it as-is.
42
46
  ].join(';')
43
47
 
48
+ const checkerPkg = Bun.resolveSync(
49
+ 'license-checker-rseidelsohn/package.json',
50
+ import.meta.dir,
51
+ )
52
+ const checkerBin = join(
53
+ dirname(checkerPkg),
54
+ JSON.parse(readFileSync(checkerPkg, 'utf8')).bin[
55
+ 'license-checker-rseidelsohn'
56
+ ],
57
+ )
58
+
44
59
  const result = spawnSync(
45
- 'bunx',
46
- ['license-checker', '--summary', '--failOn', FAIL_ON],
60
+ process.execPath,
61
+ [checkerBin, '--summary', '--failOn', FAIL_ON],
47
62
  { cwd: process.cwd(), stdio: 'inherit' },
48
63
  )
49
64
 
50
65
  if (result.error) {
51
66
  console.error(
52
- `\ncheck:licenses failed - could not run license-checker: ${result.error.message}`,
67
+ `\ncheck:licenses failed - could not run license-checker-rseidelsohn: ${result.error.message}`,
53
68
  )
54
69
  process.exit(1)
55
70
  }