Skip to content

Commit 45632e5

Browse files
committed
ci: rebuild better-sqlite3 after npm ci --ignore-scripts
Native bindings for better-sqlite3 come from a postinstall script that downloads a prebuilt binary per (OS x arch x node). --ignore-scripts skips that step, so tests/build jobs that touch the SQLite index crash with 'Could not locate the bindings file'. Adding npm rebuild as a dedicated step pulls the prebuilt without re-enabling scripts globally. Applied in ci.yml (test, coverage, build), release.yml (all three npm ci sites), and nightly.yml.
1 parent 7b6358c commit 45632e5

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ jobs:
8989
cache: npm
9090
- name: Install dependencies
9191
run: npm ci --ignore-scripts
92+
- name: Rebuild native bindings (better-sqlite3 prebuild)
93+
run: npm rebuild better-sqlite3
9294
- name: Run vitest
9395
run: npx vitest run --reporter=default --reporter=junit --outputFile=./test-results.xml
9496
- name: Upload test results
@@ -115,6 +117,8 @@ jobs:
115117
cache: npm
116118
- name: Install dependencies
117119
run: npm ci --ignore-scripts
120+
- name: Rebuild native bindings (better-sqlite3 prebuild)
121+
run: npm rebuild better-sqlite3
118122
- name: vitest --coverage
119123
run: npm run test:coverage --silent || true
120124
- name: Upload coverage
@@ -141,6 +145,8 @@ jobs:
141145
cache: npm
142146
- name: Install dependencies
143147
run: npm ci --ignore-scripts
148+
- name: Rebuild native bindings (better-sqlite3 prebuild)
149+
run: npm rebuild better-sqlite3
144150
- name: Build (tsc + asset copy)
145151
run: npm run build
146152
- name: Smoke — forge doctor

.github/workflows/nightly.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
registry-url: https://registry.npmjs.org
2626
cache: npm
2727
- run: npm ci --ignore-scripts
28+
- run: npm rebuild better-sqlite3
2829
- run: npm run build
2930
- run: npx vitest run
3031
- name: Publish nightly to npm

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
node-version: ${{ env.NODE_VERSION }}
3838
cache: npm
3939
- run: npm ci --ignore-scripts
40+
- run: npm rebuild better-sqlite3
4041
- run: npm run build
4142
- run: npx vitest run
4243

@@ -73,6 +74,7 @@ jobs:
7374
node-version: ${{ env.NODE_VERSION }}
7475
cache: npm
7576
- run: npm ci --ignore-scripts
77+
- run: npm rebuild better-sqlite3
7678
- run: npm run build
7779
- run: npm pack
7880
- name: Upload tarball
@@ -191,6 +193,7 @@ jobs:
191193
registry-url: https://registry.npmjs.org
192194
cache: npm
193195
- run: npm ci --ignore-scripts
196+
- run: npm rebuild better-sqlite3
194197
- run: npm run build
195198
- run: npm publish --provenance --access public
196199
env:

0 commit comments

Comments
 (0)