Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 338012e

Browse files
committed
build: Bring update script for better-sqlite3
1 parent e778680 commit 338012e

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

bin/better-sqlite3/update.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
ELECTRON_VERSION="electron-v125"
3+
NODE_VERSION="node-v115"
4+
5+
if ! command -v jq &> /dev/null; then
6+
echo "Missing command: jq"
7+
exit 1
8+
fi
9+
10+
script_dir=$(realpath $(dirname $0))
11+
cd "$script_dir"
12+
BETTER_SQLITE3_VERSION=$(jq -r '.dependencies.["better-sqlite3"]' ../../package.json | grep -oP "\d+\.\d+\.\d+")
13+
14+
if [ -z $BETTER_SQLITE3_VERSION ]; then
15+
echo "Unable to determine better-sqlite3 version."
16+
exit 2
17+
fi
18+
19+
echo "Version: $BETTER_SQLITE3_VERSION"
20+
21+
function download() {
22+
version="$1"
23+
platform="$2"
24+
dest_name="$3"
25+
url=https://github.com/WiseLibs/better-sqlite3/releases/download/v${BETTER_SQLITE3_VERSION}/better-sqlite3-v${BETTER_SQLITE3_VERSION}-${version}-${platform}.tar.gz
26+
temp_file="temp.tar.gz"
27+
curl -L "$url" -o "$temp_file"
28+
tar -xzvf "$temp_file"
29+
mv build/Release/better_sqlite3.node "$dest_name-better_sqlite3.node"
30+
rm -rf build
31+
rm -f "$temp_file"
32+
}
33+
34+
download $NODE_VERSION "linux-x64" "linux-server"
35+
download $ELECTRON_VERSION "linux-x64" "linux-desktop"
36+
download $ELECTRON_VERSION "win32-x64" "win"
37+
download $ELECTRON_VERSION "darwin-x64" "mac-x64"
38+
download $ELECTRON_VERSION "darwin-arm64" "mac-arm64"

0 commit comments

Comments
 (0)