Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ env:
# See https://github.com/nodejs/release#release-schedule
# Node.js v20 EOL = 2026-04-30. v22 EOL = 2027-04-30. v23 EOL = 2025-06-01. v24 EOL = 2028-04-30.
NODE_BUILD_CMD: npx --no-install prebuild -r node -t 20.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0 --include-regex '_sqlite3'
# Bun versions - see https://github.com/oven-sh/bun/releases
BUN_BUILD_CMD: npx --no-install prebuild -r bun -t 1.1.0 --include-regex '_sqlite3'

jobs:
test:
Expand Down Expand Up @@ -53,6 +55,35 @@ jobs:
- run: npm run build-debug
- run: npm test

test-bun:
strategy:
matrix:
os:
- ubuntu-22.04
- macos-13
- macos-14
bun:
- 1.2.23
name: Testing Bun ${{ matrix.bun }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ matrix.bun }}
- if: ${{ startsWith(matrix.os, 'macos') }}
run: brew install python-setuptools
- if: ${{ !startsWith(matrix.os, 'macos') }}
run: python3 -m pip install setuptools
- if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt update
sudo apt install -y gcc-10 g++-10 libreadline-dev libncurses5-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10
- run: bun install --ignore-scripts
- run: bun run build-debug
- run: bun run test

publish:
if: ${{ github.event_name == 'release' }}
name: Publishing to NPM
Expand All @@ -63,6 +94,7 @@ jobs:
- prebuild-alpine-arm
- prebuild-linux-x64
- prebuild-linux-arm
- prebuild-bun
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
Expand Down Expand Up @@ -164,3 +196,35 @@ jobs:
cd /tmp/project && \
npm install --ignore-scripts && \
${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}"

prebuild-bun:
if: ${{ github.event_name == 'release' }}
strategy:
fail-fast: false
matrix:
os:
- macos-13
- macos-14
- ubuntu-22.04
name: Prebuild Bun on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: test-bun
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 20
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.23
- if: ${{ startsWith(matrix.os, 'macos') }}
run: brew install python-setuptools
- if: ${{ !startsWith(matrix.os, 'macos') }}
run: python3 -m pip install setuptools
- if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt update
sudo apt install -y gcc-10 g++-10 libreadline-dev libncurses5-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10
- run: npm install --ignore-scripts
- run: ${{ env.BUN_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ So far the changes are:

* Build the [bedrock](https://sqlite.org/src/timeline?r=bedrock) branch of SQLite to enable [`begin concurrent`](https://www.sqlite.org/src/doc/begin-concurrent/doc/begin_concurrent.md).
* Create a shell too, so we can debug db files created
* Supports both Node.js (20.x, 22.x, 23.x, 24.x) and Bun (>=1.1.0) runtimes

Other changes will be likely be made over time.
10 changes: 10 additions & 0 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ If you still have issues, try these steps:
1. Delete your `$HOME/.node-gyp` directory
1. Run `npm install`

## Bun

If you're using Bun and encounter issues:

1. Ensure you're using Bun 1.1.0 or later
2. Try rebuilding: `bun run build-release`
3. Check that prebuilt binaries are available for your platform

Note: Bun uses the same native module system as Node.js, so most Node.js troubleshooting steps apply.

## Still stuck?

Browse [previous installation issues](https://github.com/WiseLibs/better-sqlite3/issues?q=is%3Aissue).
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"shell.sh"
],
"engines": {
"node": "20.x || 22.x || 23.x || 24.x"
"node": "20.x || 22.x || 23.x || 24.x",
"bun": ">=1.1.0"
},
"types": "lib/index.d.ts",
"dependencies": {
Expand Down