Skip to content

Commit 4e1f30f

Browse files
committed
Initial release v0.3.1
High-performance Node.js driver for Stoolap embedded SQL database. - Async and sync APIs for execute, query, queryOne, queryRaw - PreparedStatement with cached execution plans (bypass cache lookup) - Transaction support with batch execution - Direct V8 bulk object creation via C++ FFI (bypasses NAPI overhead) - Positional ($1) and named (:key) parameter binding - File-based persistence with configurable WAL and sync modes - Pre-built binaries for macOS, Linux, Windows (x64 + ARM64) - CI/CD workflows for cross-platform build, test, and npm publish
0 parents  commit 4e1f30f

22 files changed

Lines changed: 8622 additions & 0 deletions

.github/workflows/ci.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags-ignore: ['**']
7+
pull_request:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
build:
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
settings:
19+
- host: macos-latest
20+
target: aarch64-apple-darwin
21+
build: npm run build -- --target aarch64-apple-darwin
22+
- host: macos-13
23+
target: x86_64-apple-darwin
24+
build: npm run build -- --target x86_64-apple-darwin
25+
- host: ubuntu-latest
26+
target: x86_64-unknown-linux-gnu
27+
build: npm run build -- --target x86_64-unknown-linux-gnu
28+
- host: ubuntu-latest
29+
target: aarch64-unknown-linux-gnu
30+
build: |
31+
sudo apt-get update
32+
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
33+
export CC=aarch64-linux-gnu-gcc
34+
export CXX=aarch64-linux-gnu-g++
35+
npm run build -- --target aarch64-unknown-linux-gnu
36+
- host: windows-latest
37+
target: x86_64-pc-windows-msvc
38+
build: npm run build -- --target x86_64-pc-windows-msvc
39+
40+
name: Build - ${{ matrix.settings.target }}
41+
runs-on: ${{ matrix.settings.host }}
42+
steps:
43+
- uses: actions/checkout@v4
44+
45+
- uses: actions/setup-node@v4
46+
with:
47+
node-version: 22
48+
49+
- name: Install Rust
50+
uses: dtolnay/rust-toolchain@stable
51+
with:
52+
targets: ${{ matrix.settings.target }}
53+
54+
- name: Install dependencies
55+
run: npm install
56+
57+
- name: Build native addon
58+
run: ${{ matrix.settings.build }}
59+
60+
- name: Upload artifact
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: bindings-${{ matrix.settings.target }}
64+
path: '*.node'
65+
if-no-files-found: error
66+
67+
test:
68+
name: Test - node@${{ matrix.node }} (${{ matrix.os }})
69+
needs: build
70+
strategy:
71+
fail-fast: false
72+
matrix:
73+
os: [ubuntu-latest, macos-latest, windows-latest]
74+
node: [18, 20, 22]
75+
runs-on: ${{ matrix.os }}
76+
steps:
77+
- uses: actions/checkout@v4
78+
79+
- uses: actions/setup-node@v4
80+
with:
81+
node-version: ${{ matrix.node }}
82+
83+
- name: Install dependencies
84+
run: npm install
85+
86+
- name: Determine artifact name
87+
id: artifact
88+
shell: bash
89+
run: |
90+
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then
91+
echo "name=bindings-aarch64-apple-darwin" >> $GITHUB_OUTPUT
92+
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
93+
echo "name=bindings-x86_64-unknown-linux-gnu" >> $GITHUB_OUTPUT
94+
elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then
95+
echo "name=bindings-x86_64-pc-windows-msvc" >> $GITHUB_OUTPUT
96+
fi
97+
98+
- name: Download artifact
99+
uses: actions/download-artifact@v4
100+
with:
101+
name: ${{ steps.artifact.outputs.name }}
102+
path: .
103+
104+
- name: Run tests
105+
run: npm test

.github/workflows/publish.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
7+
permissions:
8+
contents: write
9+
id-token: write
10+
11+
jobs:
12+
build:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
settings:
17+
- host: macos-latest
18+
target: aarch64-apple-darwin
19+
build: npm run build -- --target aarch64-apple-darwin
20+
- host: macos-13
21+
target: x86_64-apple-darwin
22+
build: npm run build -- --target x86_64-apple-darwin
23+
- host: ubuntu-latest
24+
target: x86_64-unknown-linux-gnu
25+
build: npm run build -- --target x86_64-unknown-linux-gnu
26+
- host: ubuntu-latest
27+
target: aarch64-unknown-linux-gnu
28+
build: |
29+
sudo apt-get update
30+
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
31+
export CC=aarch64-linux-gnu-gcc
32+
export CXX=aarch64-linux-gnu-g++
33+
npm run build -- --target aarch64-unknown-linux-gnu
34+
- host: windows-latest
35+
target: x86_64-pc-windows-msvc
36+
build: npm run build -- --target x86_64-pc-windows-msvc
37+
38+
name: Build - ${{ matrix.settings.target }}
39+
runs-on: ${{ matrix.settings.host }}
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- uses: actions/setup-node@v4
44+
with:
45+
node-version: 22
46+
47+
- name: Install Rust
48+
uses: dtolnay/rust-toolchain@stable
49+
with:
50+
targets: ${{ matrix.settings.target }}
51+
52+
- name: Install dependencies
53+
run: npm install
54+
55+
- name: Build native addon
56+
run: ${{ matrix.settings.build }}
57+
58+
- name: Upload artifact
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: bindings-${{ matrix.settings.target }}
62+
path: '*.node'
63+
if-no-files-found: error
64+
65+
publish:
66+
name: Publish to npm
67+
runs-on: ubuntu-latest
68+
needs: build
69+
steps:
70+
- uses: actions/checkout@v4
71+
72+
- uses: actions/setup-node@v4
73+
with:
74+
node-version: 22
75+
registry-url: https://registry.npmjs.org
76+
77+
- name: Install dependencies
78+
run: npm install
79+
80+
- name: Download all artifacts
81+
uses: actions/download-artifact@v4
82+
with:
83+
path: artifacts
84+
85+
- name: Move artifacts
86+
run: |
87+
for dir in artifacts/bindings-*/; do
88+
cp "$dir"*.node .
89+
done
90+
ls -la *.node
91+
92+
- name: Generate npm packages
93+
run: npx napi prepublish -t npm
94+
95+
- name: Publish platform packages
96+
run: |
97+
for pkg in npm/*/; do
98+
if [ -f "$pkg/package.json" ]; then
99+
echo "Publishing $pkg..."
100+
npm publish "$pkg" --access public --provenance || true
101+
fi
102+
done
103+
env:
104+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
105+
106+
- name: Publish main package
107+
run: npm publish --access public --provenance
108+
env:
109+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
110+
111+
- name: Create GitHub Release
112+
uses: softprops/action-gh-release@v2
113+
with:
114+
generate_release_notes: true
115+
files: '*.node'

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Rust
2+
target/
3+
4+
# Node.js
5+
node_modules/
6+
7+
# Native binaries
8+
*.node
9+
10+
# npm platform packages (generated by napi prepublish)
11+
npm/*/README.md
12+
npm/*/package.json
13+
14+
# Benchmarks (devDependency on better-sqlite3)
15+
benchmark.mjs
16+
profile.mjs
17+
18+
# OS
19+
.DS_Store
20+
Thumbs.db
21+
22+
# IDE
23+
.idea/
24+
.vscode/
25+
*.swp
26+
*.swo

0 commit comments

Comments
 (0)