From 65bfb2b56dd111db503b10ce1b761c9bfc0414c6 Mon Sep 17 00:00:00 2001 From: Chase Adams Date: Thu, 8 Jan 2026 16:32:21 -0700 Subject: [PATCH 1/8] fix: fixed shell not working on macos --- .github/workflows/build.yml | 10 ++++++++++ package.json | 4 ++-- shell.js | 25 +++++++++++++++++++++++++ shell.ps1 | 20 -------------------- 4 files changed, 37 insertions(+), 22 deletions(-) create mode 100755 shell.js delete mode 100755 shell.ps1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68df492..f7120a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,6 +61,11 @@ jobs: - run: npm install --ignore-scripts - run: npm run build-debug - run: npm test + - run: npm run build-release + - name: Test shell wrapper + run: | + echo "SELECT 'wrapper test';" | node shell.js + node shell.js --version || true test-bun: strategy: @@ -90,6 +95,11 @@ jobs: - run: bun install --ignore-scripts - run: bun run build-debug - run: bun run test + - run: bun run build-release + - name: Test shell wrapper + run: | + echo "SELECT 'wrapper test';" | node shell.js + node shell.js --version || true publish: if: ${{ github.event_name == 'release' }} diff --git a/package.json b/package.json index 8326f29..9fd3dea 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/shell.js b/shell.js new file mode 100755 index 0000000..c9632c3 --- /dev/null +++ b/shell.js @@ -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); diff --git a/shell.ps1 b/shell.ps1 deleted file mode 100755 index a335951..0000000 --- a/shell.ps1 +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env sh -echo --% >/dev/null;: ' | out-null -<#' - - -# -# sh part -# -"$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/build/Release/zero_sqlite3" "$@" -# end bash part - -exit #> - - -# -# powershell part -# -$scriptDir = (Get-Item -Path $MyInvocation.MyCommand.Definition).DirectoryName -& (Join-Path $scriptDir "build" "Release" "zero_sqlite3.exe") @args - From c0ce8478e70a734ddf562eabbf9e457c226d6a10 Mon Sep 17 00:00:00 2001 From: Chase Adams Date: Thu, 8 Jan 2026 16:52:54 -0700 Subject: [PATCH 2/8] chore: bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9fd3dea..c77bb33 100644 --- a/package.json +++ b/package.json @@ -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", From 498df363eeb4b22cc51a1f197fadf35d8fc1a355 Mon Sep 17 00:00:00 2001 From: Chase Adams Date: Thu, 8 Jan 2026 16:54:09 -0700 Subject: [PATCH 3/8] test: temporary test to see if ci breaks --- package.json | 4 ++-- shell.ps1 | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100755 shell.ps1 diff --git a/package.json b/package.json index c77bb33..9e5c2cd 100644 --- a/package.json +++ b/package.json @@ -10,14 +10,14 @@ }, "main": "lib/index.js", "bin": { - "zero-sqlite3": "./shell.js" + "zero-sqlite3": "./shell.ps1" }, "files": [ "binding.gyp", "src/**/*.[ch]pp", "lib/**", "deps/**", - "shell.js" + "shell.ps1" ], "engines": { "node": "20.x || 22.x || 23.x || 24.x", diff --git a/shell.ps1 b/shell.ps1 new file mode 100755 index 0000000..a335951 --- /dev/null +++ b/shell.ps1 @@ -0,0 +1,20 @@ +#!/usr/bin/env sh +echo --% >/dev/null;: ' | out-null +<#' + + +# +# sh part +# +"$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/build/Release/zero_sqlite3" "$@" +# end bash part + +exit #> + + +# +# powershell part +# +$scriptDir = (Get-Item -Path $MyInvocation.MyCommand.Definition).DirectoryName +& (Join-Path $scriptDir "build" "Release" "zero_sqlite3.exe") @args + From 3dc05d37c694c3bea9c35d868bbfc775e749f9c5 Mon Sep 17 00:00:00 2001 From: Chase Adams Date: Thu, 8 Jan 2026 17:02:18 -0700 Subject: [PATCH 4/8] test: more tests with bash --- .github/workflows/build.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f7120a0..7490dc8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,15 @@ jobs: - run: npm run build-debug - run: npm test - run: npm run build-release - - name: Test shell wrapper + - name: Test shell wrapper (Windows) + if: ${{ startsWith(matrix.os, 'windows') }} + shell: powershell + run: | + echo "SELECT 'wrapper test';" | node shell.js + node shell.js --version || echo "Version check failed" + - name: Test shell wrapper (Unix) + if: ${{ !startsWith(matrix.os, 'windows') }} + shell: bash run: | echo "SELECT 'wrapper test';" | node shell.js node shell.js --version || true @@ -96,7 +104,15 @@ jobs: - run: bun run build-debug - run: bun run test - run: bun run build-release - - name: Test shell wrapper + - name: Test shell wrapper (Windows) + if: ${{ startsWith(matrix.os, 'windows') }} + shell: powershell + run: | + echo "SELECT 'wrapper test';" | node shell.js + node shell.js --version || echo "Version check failed" + - name: Test shell wrapper (Unix) + if: ${{ !startsWith(matrix.os, 'windows') }} + shell: bash run: | echo "SELECT 'wrapper test';" | node shell.js node shell.js --version || true From e39f0fb816f109a609b6efeb1c1100bc337c084e Mon Sep 17 00:00:00 2001 From: Chase Adams Date: Thu, 8 Jan 2026 17:09:30 -0700 Subject: [PATCH 5/8] chore: fix tests --- .github/workflows/build.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7490dc8..87fd102 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,14 +66,15 @@ jobs: if: ${{ startsWith(matrix.os, 'windows') }} shell: powershell run: | - echo "SELECT 'wrapper test';" | node shell.js - node shell.js --version || echo "Version check failed" + echo "SELECT 'wrapper test';" | npx zero-sqlite3 + npx zero-sqlite3 --version + if ($LASTEXITCODE -ne 0) { echo "Version check failed" } - name: Test shell wrapper (Unix) if: ${{ !startsWith(matrix.os, 'windows') }} shell: bash run: | - echo "SELECT 'wrapper test';" | node shell.js - node shell.js --version || true + echo "SELECT 'wrapper test';" | npx zero-sqlite3 + npx zero-sqlite3 --version || true test-bun: strategy: @@ -108,14 +109,15 @@ jobs: if: ${{ startsWith(matrix.os, 'windows') }} shell: powershell run: | - echo "SELECT 'wrapper test';" | node shell.js - node shell.js --version || echo "Version check failed" + echo "SELECT 'wrapper test';" | bunx zero-sqlite3 + bunx zero-sqlite3 --version + if ($LASTEXITCODE -ne 0) { echo "Version check failed" } - name: Test shell wrapper (Unix) if: ${{ !startsWith(matrix.os, 'windows') }} shell: bash run: | - echo "SELECT 'wrapper test';" | node shell.js - node shell.js --version || true + echo "SELECT 'wrapper test';" | bunx zero-sqlite3 + bunx zero-sqlite3 --version || true publish: if: ${{ github.event_name == 'release' }} From 0e3ddf96b7b46d518a85a69c92ade24f61a93f2f Mon Sep 17 00:00:00 2001 From: Chase Adams Date: Thu, 8 Jan 2026 17:14:50 -0700 Subject: [PATCH 6/8] chore: test --- .github/workflows/build.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 87fd102..6966c68 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,15 +66,15 @@ jobs: if: ${{ startsWith(matrix.os, 'windows') }} shell: powershell run: | - echo "SELECT 'wrapper test';" | npx zero-sqlite3 - npx zero-sqlite3 --version + echo "SELECT 'wrapper test';" | .\shell.ps1 + .\shell.ps1 --version if ($LASTEXITCODE -ne 0) { echo "Version check failed" } - name: Test shell wrapper (Unix) if: ${{ !startsWith(matrix.os, 'windows') }} shell: bash run: | - echo "SELECT 'wrapper test';" | npx zero-sqlite3 - npx zero-sqlite3 --version || true + echo "SELECT 'wrapper test';" | ./shell.ps1 + ./shell.ps1 --version || true test-bun: strategy: @@ -109,15 +109,15 @@ jobs: if: ${{ startsWith(matrix.os, 'windows') }} shell: powershell run: | - echo "SELECT 'wrapper test';" | bunx zero-sqlite3 - bunx zero-sqlite3 --version + echo "SELECT 'wrapper test';" | .\shell.ps1 + .\shell.ps1 --version if ($LASTEXITCODE -ne 0) { echo "Version check failed" } - name: Test shell wrapper (Unix) if: ${{ !startsWith(matrix.os, 'windows') }} shell: bash run: | - echo "SELECT 'wrapper test';" | bunx zero-sqlite3 - bunx zero-sqlite3 --version || true + echo "SELECT 'wrapper test';" | ./shell.ps1 + ./shell.ps1 --version || true publish: if: ${{ github.event_name == 'release' }} From ce97e3f768a41525f856eda58bc217871d401194 Mon Sep 17 00:00:00 2001 From: Chase Adams Date: Thu, 8 Jan 2026 17:19:32 -0700 Subject: [PATCH 7/8] chore: revert testing --- .github/workflows/build.yml | 16 ++++++++-------- package.json | 4 ++-- shell.ps1 | 20 -------------------- 3 files changed, 10 insertions(+), 30 deletions(-) delete mode 100755 shell.ps1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6966c68..676edf8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,15 +66,15 @@ jobs: if: ${{ startsWith(matrix.os, 'windows') }} shell: powershell run: | - echo "SELECT 'wrapper test';" | .\shell.ps1 - .\shell.ps1 --version + echo "SELECT 'wrapper test';" | node shell.js + node shell.js --version if ($LASTEXITCODE -ne 0) { echo "Version check failed" } - name: Test shell wrapper (Unix) if: ${{ !startsWith(matrix.os, 'windows') }} shell: bash run: | - echo "SELECT 'wrapper test';" | ./shell.ps1 - ./shell.ps1 --version || true + echo "SELECT 'wrapper test';" | node shell.js + node shell.js --version || true test-bun: strategy: @@ -109,15 +109,15 @@ jobs: if: ${{ startsWith(matrix.os, 'windows') }} shell: powershell run: | - echo "SELECT 'wrapper test';" | .\shell.ps1 - .\shell.ps1 --version + echo "SELECT 'wrapper test';" | node shell.js + node shell.js --version if ($LASTEXITCODE -ne 0) { echo "Version check failed" } - name: Test shell wrapper (Unix) if: ${{ !startsWith(matrix.os, 'windows') }} shell: bash run: | - echo "SELECT 'wrapper test';" | ./shell.ps1 - ./shell.ps1 --version || true + echo "SELECT 'wrapper test';" | node shell.js + node shell.js --version || true publish: if: ${{ github.event_name == 'release' }} diff --git a/package.json b/package.json index 9e5c2cd..c77bb33 100644 --- a/package.json +++ b/package.json @@ -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.ps1" + "shell.js" ], "engines": { "node": "20.x || 22.x || 23.x || 24.x", diff --git a/shell.ps1 b/shell.ps1 deleted file mode 100755 index a335951..0000000 --- a/shell.ps1 +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env sh -echo --% >/dev/null;: ' | out-null -<#' - - -# -# sh part -# -"$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/build/Release/zero_sqlite3" "$@" -# end bash part - -exit #> - - -# -# powershell part -# -$scriptDir = (Get-Item -Path $MyInvocation.MyCommand.Definition).DirectoryName -& (Join-Path $scriptDir "build" "Release" "zero_sqlite3.exe") @args - From 6bc9859a3b99072ff9d9e14f823180cb25be0209 Mon Sep 17 00:00:00 2001 From: Chase Adams Date: Thu, 8 Jan 2026 17:28:39 -0700 Subject: [PATCH 8/8] chore: fix tests --- .github/workflows/build.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 676edf8..371292c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,13 +68,12 @@ jobs: run: | echo "SELECT 'wrapper test';" | node shell.js node shell.js --version - if ($LASTEXITCODE -ne 0) { echo "Version check failed" } - name: Test shell wrapper (Unix) if: ${{ !startsWith(matrix.os, 'windows') }} shell: bash run: | echo "SELECT 'wrapper test';" | node shell.js - node shell.js --version || true + node shell.js --version test-bun: strategy: @@ -109,15 +108,14 @@ jobs: if: ${{ startsWith(matrix.os, 'windows') }} shell: powershell run: | - echo "SELECT 'wrapper test';" | node shell.js - node shell.js --version - if ($LASTEXITCODE -ne 0) { echo "Version check failed" } + 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';" | node shell.js - node shell.js --version || true + echo "SELECT 'wrapper test';" | bun shell.js + bun shell.js --version publish: if: ${{ github.event_name == 'release' }}