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
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@ jobs:
- run: npm install --ignore-scripts
- run: npm run build-debug
- run: npm test
- run: npm run build-release
- name: Test shell wrapper (Windows)
if: ${{ startsWith(matrix.os, 'windows') }}
shell: powershell
run: |
echo "SELECT 'wrapper test';" | node shell.js
node shell.js --version
- name: Test shell wrapper (Unix)
if: ${{ !startsWith(matrix.os, 'windows') }}
shell: bash
run: |
echo "SELECT 'wrapper test';" | node shell.js
node shell.js --version

test-bun:
strategy:
Expand Down Expand Up @@ -90,6 +103,19 @@ jobs:
- run: bun install --ignore-scripts
- run: bun run build-debug
- run: bun run test
- run: bun run build-release
- name: Test shell wrapper (Windows)
if: ${{ startsWith(matrix.os, 'windows') }}
shell: powershell
run: |
echo "SELECT 'wrapper test';" | bun shell.js
bun shell.js --version
- name: Test shell wrapper (Unix)
if: ${{ !startsWith(matrix.os, 'windows') }}
shell: bash
run: |
echo "SELECT 'wrapper test';" | bun shell.js
bun shell.js --version

publish:
if: ${{ github.event_name == 'release' }}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rocicorp/zero-sqlite3",
"version": "1.0.14",
"version": "1.0.15",
"description": "better-sqlite3 on bedrock",
"homepage": "https://github.com/rocicorp/zero-sqlite3",
"author": "Rocicorp",
Expand All @@ -10,14 +10,14 @@
},
"main": "lib/index.js",
"bin": {
"zero-sqlite3": "./shell.ps1"
"zero-sqlite3": "./shell.js"
},
"files": [
"binding.gyp",
"src/**/*.[ch]pp",
"lib/**",
"deps/**",
"shell.sh"
"shell.js"
],
"engines": {
"node": "20.x || 22.x || 23.x || 24.x",
Expand Down
25 changes: 25 additions & 0 deletions shell.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env node
const { spawnSync } = require('child_process');
const path = require('path');
const fs = require('fs');

const binaryName = process.platform === 'win32' ? 'zero_sqlite3.exe' : 'zero_sqlite3';
const binary = path.join(__dirname, 'build', 'Release', binaryName);

if (!fs.existsSync(binary)) {
console.error(`Error: Binary not found at ${binary}`);
console.error('Please run: npm run build-release');
process.exit(1);
}

const result = spawnSync(binary, process.argv.slice(2), { stdio: 'inherit' });

if (result.error) {
console.error(`Error executing binary: ${result.error.message}`);
if (result.error.code === 'ENOEXEC') {
console.error('The binary may be built for a different platform. Please rebuild with: npm run build-release');
}
process.exit(1);
}

process.exit(result.status ?? 1);
20 changes: 0 additions & 20 deletions shell.ps1

This file was deleted.