@rocicorp/zero-sqlite3 1.0.14 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/package.json +3 -3
  2. package/shell.js +25 -0
  3. package/shell.ps1 +0 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rocicorp/zero-sqlite3",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "better-sqlite3 on bedrock",
5
5
  "homepage": "https://github.com/rocicorp/zero-sqlite3",
6
6
  "author": "Rocicorp",
@@ -10,14 +10,14 @@
10
10
  },
11
11
  "main": "lib/index.js",
12
12
  "bin": {
13
- "zero-sqlite3": "./shell.ps1"
13
+ "zero-sqlite3": "./shell.js"
14
14
  },
15
15
  "files": [
16
16
  "binding.gyp",
17
17
  "src/**/*.[ch]pp",
18
18
  "lib/**",
19
19
  "deps/**",
20
- "shell.sh"
20
+ "shell.js"
21
21
  ],
22
22
  "engines": {
23
23
  "node": "20.x || 22.x || 23.x || 24.x",
package/shell.js ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ const { spawnSync } = require('child_process');
3
+ const path = require('path');
4
+ const fs = require('fs');
5
+
6
+ const binaryName = process.platform === 'win32' ? 'zero_sqlite3.exe' : 'zero_sqlite3';
7
+ const binary = path.join(__dirname, 'build', 'Release', binaryName);
8
+
9
+ if (!fs.existsSync(binary)) {
10
+ console.error(`Error: Binary not found at ${binary}`);
11
+ console.error('Please run: npm run build-release');
12
+ process.exit(1);
13
+ }
14
+
15
+ const result = spawnSync(binary, process.argv.slice(2), { stdio: 'inherit' });
16
+
17
+ if (result.error) {
18
+ console.error(`Error executing binary: ${result.error.message}`);
19
+ if (result.error.code === 'ENOEXEC') {
20
+ console.error('The binary may be built for a different platform. Please rebuild with: npm run build-release');
21
+ }
22
+ process.exit(1);
23
+ }
24
+
25
+ process.exit(result.status ?? 1);
package/shell.ps1 DELETED
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env sh
2
- echo --% >/dev/null;: ' | out-null
3
- <#'
4
-
5
-
6
- #
7
- # sh part
8
- #
9
- "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/build/Release/zero_sqlite3" "$@"
10
- # end bash part
11
-
12
- exit #>
13
-
14
-
15
- #
16
- # powershell part
17
- #
18
- $scriptDir = (Get-Item -Path $MyInvocation.MyCommand.Definition).DirectoryName
19
- & (Join-Path $scriptDir "build" "Release" "zero_sqlite3.exe") @args
20
-