Skip to content

Commit 5fb8a4b

Browse files
authored
Merge pull request #1 from powersync-ja/prepare-release
Include changes for hooks, prepare release
2 parents 6de572a + 562ffe5 commit 5fb8a4b

File tree

14 files changed

+993
-319
lines changed

14 files changed

+993
-319
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "master",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.changeset/tame-symbols-decide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@powersync/better-sqlite3": minor
3+
---
4+
5+
Initial version

.github/workflows/build.yml

Lines changed: 6 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ jobs:
2828
matrix:
2929
os:
3030
- ubuntu-20.04
31-
- macos-13
32-
- macos-14
33-
- windows-2019
31+
# - macos-13
32+
# - macos-14
33+
# - windows-2019
3434
node:
35-
- 18
36-
- 20
35+
# - 18
36+
# - 20
3737
- 22
38-
- 23
38+
# - 23
3939
name: Testing Node ${{ matrix.node }} on ${{ matrix.os }}
4040
runs-on: ${{ matrix.os }}
4141
steps:
@@ -63,117 +63,3 @@ jobs:
6363
sudo apt update
6464
sudo apt install libsqlite3-mod-spatialite -y
6565
node -e "require('./lib/index.js')(':memory:').loadExtension('mod_spatialite').exec('SELECT InitSpatialMetaData();')"
66-
67-
publish:
68-
if: ${{ github.event_name == 'release' }}
69-
name: Publishing to NPM
70-
runs-on: ubuntu-20.04
71-
needs:
72-
- prebuild
73-
- prebuild-alpine
74-
- prebuild-alpine-arm
75-
- prebuild-linux-arm
76-
steps:
77-
- uses: actions/checkout@v4
78-
- uses: actions/setup-node@v4
79-
with:
80-
node-version: 18
81-
registry-url: https://registry.npmjs.org
82-
- run: npm publish
83-
env:
84-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
85-
86-
prebuild:
87-
if: ${{ github.event_name == 'release' }}
88-
strategy:
89-
fail-fast: false
90-
matrix:
91-
os:
92-
- ubuntu-20.04
93-
- macos-13
94-
- macos-14
95-
- windows-2019
96-
name: Prebuild on ${{ matrix.os }}
97-
runs-on: ${{ matrix.os }}
98-
needs: test
99-
steps:
100-
- uses: actions/checkout@v4
101-
- uses: actions/setup-node@v4
102-
with:
103-
node-version: 18
104-
- if: ${{ startsWith(matrix.os, 'windows') }}
105-
run: pip.exe install setuptools
106-
- if: ${{ startsWith(matrix.os, 'macos') }}
107-
run: brew install python-setuptools
108-
- if: ${{ !startsWith(matrix.os, 'windows') && !startsWith(matrix.os, 'macos') }}
109-
run: python3 -m pip install setuptools
110-
- if: ${{ startsWith(matrix.os, 'ubuntu') }}
111-
run: |
112-
sudo apt update
113-
sudo apt install gcc-10 g++-10 -y
114-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10
115-
- run: npm install --ignore-scripts
116-
- run: ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}
117-
- run: ${{ env.ELECTRON_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}
118-
- if: matrix.os == 'windows-2019'
119-
run: |
120-
${{ env.NODE_BUILD_CMD }} --arch ia32 -u ${{ secrets.GITHUB_TOKEN }}
121-
${{ env.NO_V18_NODE_BUILD_CMD }} --arch arm64 -u ${{ secrets.GITHUB_TOKEN }}
122-
${{ env.ELECTRON_BUILD_CMD }} --arch ia32 -u ${{ secrets.GITHUB_TOKEN }}
123-
${{ env.ELECTRON_BUILD_CMD }} --arch arm64 -u ${{ secrets.GITHUB_TOKEN }}
124-
125-
prebuild-alpine:
126-
if: ${{ github.event_name == 'release' }}
127-
strategy:
128-
fail-fast: false
129-
name: Prebuild on alpine
130-
runs-on: ubuntu-latest
131-
container: node:18-alpine
132-
needs: test
133-
steps:
134-
- uses: actions/checkout@v4
135-
- run: apk add build-base git python3 py3-setuptools --update-cache
136-
- run: npm install --ignore-scripts
137-
- run: ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}
138-
139-
prebuild-alpine-arm:
140-
if: ${{ github.event_name == 'release' }}
141-
strategy:
142-
fail-fast: false
143-
matrix:
144-
arch:
145-
- arm/v7
146-
- arm64
147-
name: Prebuild on alpine (${{ matrix.arch }})
148-
runs-on: ubuntu-latest
149-
needs: test
150-
steps:
151-
- uses: actions/checkout@v4
152-
- uses: docker/setup-qemu-action@v3
153-
- run: |
154-
docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch }} node:18-alpine -c "\
155-
apk add build-base git python3 py3-setuptools --update-cache && \
156-
cd /tmp/project && \
157-
npm install --ignore-scripts && \
158-
${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}"
159-
160-
prebuild-linux-arm:
161-
if: ${{ github.event_name == 'release' }}
162-
strategy:
163-
fail-fast: false
164-
matrix:
165-
arch:
166-
- arm/v7
167-
- arm64
168-
name: Prebuild on Linux (${{ matrix.arch }})
169-
runs-on: ubuntu-latest
170-
needs: test
171-
steps:
172-
- uses: actions/checkout@v4
173-
- uses: docker/setup-qemu-action@v3
174-
- run: |
175-
docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch }} node:18-bullseye -c "\
176-
cd /tmp/project && \
177-
npm install --ignore-scripts && \
178-
${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }} && \
179-
if [ '${{ matrix.arch }}' = 'arm64' ]; then ${{ env.ELECTRON_BUILD_CMD }} --arch arm64 -u ${{ secrets.GITHUB_TOKEN }}; fi"

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
jobs:
11+
release:
12+
name: Release
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Repo
16+
uses: actions/checkout@v3
17+
18+
- name: Setup Node.js 20.x
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: 20.x
22+
23+
- name: Install Dependencies
24+
run: yarn
25+
26+
- name: Create Release Pull Request or Publish to npm
27+
id: changesets
28+
uses: changesets/action@v1
29+
with:
30+
# This expects you to have a script called release which does a build for your packages and calls changeset publish
31+
publish: yarn release
32+
version: yarn changeset version
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

lib/database.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ Database.prototype.function = require('./methods/function');
8181
Database.prototype.aggregate = require('./methods/aggregate');
8282
Database.prototype.table = require('./methods/table');
8383
Database.prototype.loadExtension = wrappers.loadExtension;
84+
Database.prototype.updateHook = wrappers.updateHook;
85+
Database.prototype.commitHook = wrappers.commitHook;
86+
Database.prototype.rollbackHook = wrappers.rollbackHook;
8487
Database.prototype.exec = wrappers.exec;
8588
Database.prototype.close = wrappers.close;
8689
Database.prototype.defaultSafeIntegers = wrappers.defaultSafeIntegers;

lib/methods/wrappers.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ exports.loadExtension = function loadExtension(...args) {
2020
return this;
2121
};
2222

23+
exports.updateHook = function updateHook(...args) {
24+
this[cppdb].updateHook(...args);
25+
return this;
26+
};
27+
28+
exports.commitHook = function commitHook(...args) {
29+
this[cppdb].commitHook(...args);
30+
return this;
31+
};
32+
33+
exports.rollbackHook = function rollbackHook(...args) {
34+
this[cppdb].rollbackHook(...args);
35+
return this;
36+
};
37+
2338
exports.defaultSafeIntegers = function defaultSafeIntegers(...args) {
2439
this[cppdb].defaultSafeIntegers(...args);
2540
return this;

package.json

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
{
2-
"name": "better-sqlite3",
3-
"version": "11.8.1",
4-
"description": "The fastest and simplest library for SQLite in Node.js.",
2+
"name": "@powersync/better-sqlite3",
3+
"version": "0.0.0",
4+
"publishConfig": {
5+
"access": "public"
6+
},
7+
"description": "PowerSync fork of better-sqlite, the fastest and simplest library for SQLite in Node.js.",
58
"homepage": "http://github.com/WiseLibs/better-sqlite3",
69
"author": "Joshua Wise <[email protected]>",
710
"repository": {
811
"type": "git",
9-
"url": "git://github.com/WiseLibs/better-sqlite3.git"
12+
"url": "git://github.com/powersync-ja/better-sqlite3.git"
1013
},
1114
"main": "lib/index.js",
1215
"files": [
@@ -16,29 +19,30 @@
1619
"deps/**"
1720
],
1821
"dependencies": {
19-
"bindings": "^1.5.0",
20-
"prebuild-install": "^7.1.1"
22+
"bindings": "^1.5.0"
2123
},
2224
"devDependencies": {
25+
"@changesets/cli": "^2.28.1",
2326
"chai": "^4.3.8",
2427
"cli-color": "^2.0.3",
2528
"fs-extra": "^11.1.1",
2629
"mocha": "^10.2.0",
30+
"node-gyp": "^11.1.0",
2731
"nodemark": "^0.3.0",
28-
"prebuild": "^13.0.1",
2932
"sqlite": "^5.0.1",
3033
"sqlite3": "^5.1.6"
3134
},
3235
"scripts": {
33-
"install": "prebuild-install || node-gyp rebuild --release",
36+
"install": "node-gyp rebuild --release",
3437
"build-release": "node-gyp rebuild --release",
3538
"build-debug": "node-gyp rebuild --debug",
3639
"rebuild-release": "npm run lzz && npm run build-release",
3740
"rebuild-debug": "npm run lzz && npm run build-debug",
3841
"test": "mocha --exit --slow=75 --timeout=5000",
3942
"benchmark": "node benchmark",
4043
"download": "bash ./deps/download.sh",
41-
"lzz": "lzz -hx hpp -sx cpp -k BETTER_SQLITE3 -d -hl -sl -e ./src/better_sqlite3.lzz"
44+
"lzz": "lzz -hx hpp -sx cpp -k BETTER_SQLITE3 -d -hl -sl -e ./src/better_sqlite3.lzz",
45+
"release": "yarn changeset publish"
4246
},
4347
"license": "MIT",
4448
"keywords": [

0 commit comments

Comments
 (0)