Commit 4b17b40
committed
ci: actually rebuild better-sqlite3 by bypassing .npmrc ignore-scripts
Commit 7f8e646 didn't actually fix CI. I missed two things, both of
which made the previous fix silently no-op while appearing green
locally:
1. The repo's [.npmrc:2](.npmrc#L2) has `ignore-scripts=true` set
globally. That config gate overrides every form of `pnpm install`,
`pnpm rebuild`, `pnpm --filter <pkg> rebuild <dep>`, and even
`pnpm.onlyBuiltDependencies` allow-lists. The CI's `pnpm rebuild
better-sqlite3` step ran in 700ms with zero output and produced
no binding — verified by reading the previous CI log. The
`--ignore-scripts` CLI flag I had been preserving was always
redundant with the .npmrc setting.
2. `require('better-sqlite3')` does NOT actually load the native
binding. better-sqlite3's lib/database.js only calls
`require('bindings')('better_sqlite3.node')` LAZILY, inside the
Database constructor (line 48). So the previous smoke test
(`node -e "require('better-sqlite3')"`) returned successfully even
when the binding was missing — the same flaw the faucet/Dockerfile
smoke has, which the Dockerfile gets away with because its `npm
rebuild` actually works in that context.
Real fix:
- Drop the redundant `--ignore-scripts` CLI flag from `pnpm install`.
The .npmrc setting still applies, so biome/ultracite postinstalls
remain skipped (the original intent).
- Replace `pnpm rebuild better-sqlite3` with a direct invocation of
the package's own install script from its store directory:
cd node_modules/.pnpm/better-sqlite3@*/node_modules/better-sqlite3
npm run install
This bypasses the .npmrc gate (because it's a script run, not a
package install), and runs `prebuild-install`, which downloads the
prebuilt binding from upstream's GitHub release for the current
(node-20, linux-x64) tuple. Verified upstream — the prebuild for
v11.10.0 / NODE_MODULE_VERSION 115 / linux-x64 exists.
- Replace the broken `require()`-only smoke test with one that
instantiates an in-memory Database and executes a query, forcing
the .node binding to actually load:
node -e "const D=require('better-sqlite3'); const db=new D(':memory:'); db.exec('SELECT 1'); db.close()"
Verified locally (node 20.20.0, pnpm 9.15.9, simulating the exact CI
environment, after removing the binding to mirror a clean install):
- Direct install step → exit 0, prebuild-install fetches the 2.0 MB
.node file to build/Release/better_sqlite3.node
- Smoke step → "smoke OK"
- `pnpm --filter @pushflip/faucet test` → 17/17 pass (was: 1 fail
with "Could not locate the bindings file" on previous attempt)1 parent 7f8e646 commit 4b17b40
1 file changed
Lines changed: 33 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
73 | 78 | | |
74 | 79 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
85 | 95 | | |
86 | 96 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
99 | 107 | | |
100 | 108 | | |
101 | 109 | | |
| |||
0 commit comments