Skip to content

Commit aad52c8

Browse files
added changesets. Update queries for local only changes.
1 parent d42a11d commit aad52c8

File tree

8 files changed

+68
-49
lines changed

8 files changed

+68
-49
lines changed

.changeset/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"commit": false,
55
"fixed": [],
66
"linked": [],
7-
"access": "restricted",
7+
"access": "public",
88
"baseBranch": "main",
99
"updateInternalDependencies": "patch",
10-
"ignore": []
10+
"ignore": ["powersync-example"]
1111
}

.changeset/serious-bobcats-tie.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@journeyapps/powersync-sdk-react-native': patch
3+
'@journeyapps/powersync-sdk-common': patch
4+
---
5+
6+
Updated watched queries to trigger for local only tables.

.github/workflows/build-packages.yaml

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Ensures packages build correctly
2-
# Deploys Production/latest NPM packages to NPM registry if on `main` branch
3-
# Submodule packages are not published to production in this repo,
4-
# Submodule packages should be tagged and published from their own repo.
5-
name: Packages Deploy
2+
name: Build Packages
63

74
on:
85
push:
@@ -34,33 +31,3 @@ jobs:
3431

3532
- name: Build
3633
run: yarn build:packages
37-
38-
publish:
39-
name: Publish Production Packages
40-
runs-on: ubuntu-latest
41-
needs: build
42-
if: github.ref == 'refs/heads/main'
43-
steps:
44-
- uses: actions/checkout@v4
45-
with:
46-
persist-credentials: false
47-
48-
- name: Setup NodeJS
49-
uses: actions/setup-node@v2
50-
with:
51-
node-version: 18
52-
53-
- name: Setup Yarn
54-
run: |
55-
npm install -g yarn
56-
echo "Yarn version: $(yarn -v)"
57-
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> ~/.npmrc
58-
59-
- name: Install Dependencies
60-
run: yarn install --frozen-lockfile
61-
62-
- name: Build
63-
run: yarn build:packages
64-
65-
- name: Publish
66-
run: lerna exec "npm publish --tag=latest --no-git-checks" --parallel

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
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+
with:
18+
# Needed for build with frozen lockfile
19+
submodules: true
20+
21+
- name: Setup Node.js 18
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: 18
25+
26+
- name: Install Dependencies
27+
run: yarn install --frozen-lockfile
28+
29+
- name: Create Release Pull Request or Publish to npm
30+
id: changesets
31+
uses: changesets/action@v1
32+
with:
33+
# This expects you to have a script called release which does a build for your packages and calls changeset publish
34+
publish: yarn release
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,17 @@ yarn build:packages
4545
Development packages can be published by manually triggering the `dev-packages` workflow. Development packages are versioned as `0.0.0-dev.{short-sha}`.
4646

4747
### Production Packages
48-
Packages should be versioned with Lerna after PR approval.
48+
Pull requests should contain Changesets for changed packages.
4949

50-
Submodule production packages should be versioned, tagged and published from their own repository. Any dependencies should be updated here (if applicable) before versioning local packages.
51-
52-
```bash
53-
lerna version --no-private
50+
Add changesets with
51+
```Bash
52+
yarn changeset add
5453
```
5554

56-
The versioned and tagged changes should then be merged to `main` where production packages will be deployed via the `build-packages` workflow.
55+
Submodule production packages should be versioned, tagged and published from their own repository. Any dependencies should be updated here (if applicable) before merging pull requests.
56+
57+
58+
Merging a PR with Changesets will automatically create a PR with version bumps. That PR will be merged when releasing.
5759

5860
## Testing Supabase example app
5961

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"scripts": {
77
"clean:packages": "lerna run clean",
88
"build:packages": "lerna run build",
9-
"watch:packages": "yarn workspace @journeyapps/powersync-sdk-react-native watch"
9+
"watch:packages": "yarn workspace @journeyapps/powersync-sdk-react-native watch",
10+
"release": "yarn build:packages && yarn changeset publish"
1011
},
1112
"workspaces": {
1213
"packages": [

packages/powersync-sdk-common/src/client/AbstractPowerSyncDatabase.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,17 @@ export interface WatchOnChangeEvent {
3535
changedTables: string[];
3636
}
3737

38+
export interface PowerSyncDBListener extends StreamingSyncImplementationListener {}
39+
40+
const POWERSYNC_TABLE_MATCH = /(^ps_data__|^ps_local__)/;
41+
3842
export const DEFAULT_WATCH_THROTTLE_MS = 30;
3943

4044
export const DEFAULT_POWERSYNC_DB_OPTIONS = {
4145
retryDelay: 5000,
4246
logger: Logger.get('PowerSyncDatabase')
4347
};
4448

45-
export interface PowerSyncDBListener extends StreamingSyncImplementationListener {}
46-
4749
export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDBListener> {
4850
/**
4951
* Transactions should be queued in the DBAdapter, but we also want to prevent
@@ -437,10 +439,10 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
437439
const dispose = this.database.registerListener({
438440
tablesUpdated: async (update) => {
439441
const { table } = update;
440-
if (!table.startsWith('ps_data__')) {
442+
if (!table.match(POWERSYNC_TABLE_MATCH)) {
441443
return;
442444
}
443-
const tableName = table.replace(/^ps_data__/, '');
445+
const tableName = table.replace(POWERSYNC_TABLE_MATCH, '');
444446
throttledTableUpdates.push(tableName);
445447

446448
flushTableUpdates();

packages/powersync-sdk-react-native/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"homepage": "https://github.com/journeyapps/powersync-react-native-sdk/packages/powersync-sdk-react-native/#readme",
2626
"peerDependencies": {
27-
"@journeyapps/react-native-quick-sqlite": "^0.0.0",
27+
"@journeyapps/react-native-quick-sqlite": "^0.0.1-alpha.0",
2828
"base-64": "^1.0.0",
2929
"react": "*",
3030
"react-native-fetch-api": "^3.0.0",
@@ -45,6 +45,10 @@
4545
"typescript": "^4.1.3"
4646
},
4747
"keywords": [
48-
"data sync", "offline-first", "sqlite", "real-time data stream", "live data"
48+
"data sync",
49+
"offline-first",
50+
"sqlite",
51+
"real-time data stream",
52+
"live data"
4953
]
5054
}

0 commit comments

Comments
 (0)