Skip to content

Commit d109de8

Browse files
Merge pull request #8 from journeyapps/packages-version
[Workflow] Update Packages Deploy
2 parents a8a9f83 + c066c70 commit d109de8

File tree

12 files changed

+1073
-60
lines changed

12 files changed

+1073
-60
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/config@2.3.1/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": ["powersync-example"]
11+
}

.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.
Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: Packages Deploy
1+
# Ensures packages build correctly
2+
name: Build Packages
23

34
on:
45
push:
@@ -8,42 +9,16 @@ jobs:
89
name: Build Packages
910
runs-on: ubuntu-latest
1011
steps:
11-
- uses: actions/checkout@v3
12-
with:
13-
submodules: true
14-
15-
- name: Setup NodeJS
16-
uses: actions/setup-node@v2
17-
with:
18-
node-version: 16
19-
cache: 'yarn'
20-
21-
- name: Setup Yarn
22-
run: |
23-
npm install -g yarn
24-
echo "Yarn version: $(yarn -v)"
25-
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> ~/.npmrc
26-
27-
- name: Install Dependencies
28-
run: yarn install --frozen-lockfile
29-
30-
- name: Build
31-
run: yarn build:packages
32-
33-
publish:
34-
name: Publish Production Packages
35-
runs-on: ubuntu-latest
36-
needs: build
37-
if: github.ref == 'refs/heads/main'
38-
steps:
39-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
4013
with:
4114
submodules: true
15+
persist-credentials: false
4216

4317
- name: Setup NodeJS
4418
uses: actions/setup-node@v2
4519
with:
4620
node-version: 18
21+
cache: 'yarn'
4722

4823
- name: Setup Yarn
4924
run: |
@@ -56,6 +31,3 @@ jobs:
5631

5732
- name: Build
5833
run: yarn build:packages
59-
60-
- name: Publish
61-
run: lerna exec "npm publish --tag=latest --no-git-checks" --parallel

.github/workflows/dev-packages.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Action to publish packages under the `next` tag for testing
2+
# Packages are versioned as `0.0.0-dev.{short-sha}`
13
name: Packages Deploy
24

35
on: workflow_dispatch
@@ -7,9 +9,10 @@ jobs:
79
name: Publish Dev Packages
810
runs-on: ubuntu-latest
911
steps:
10-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1113
with:
1214
submodules: true
15+
persist-credentials: false
1316

1417
- name: Setup NodeJS
1518
uses: actions/setup-node@v2

.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
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: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Monorepo for all things React Native and PowerSync.
44

5-
## Monorepo structure
5+
## Monorepo Structure
66

77
- `apps/supabase-todolist`
88
* An Expo React native app using Supabase.
@@ -18,7 +18,7 @@ Monorepo for all things React Native and PowerSync.
1818

1919
# Development
2020

21-
## Git submodules
21+
## Git Submodules
2222
After cloning this repo be sure to init the Git submodules
2323

2424
```bash
@@ -37,6 +37,26 @@ Build packages
3737
yarn build:packages
3838
```
3939

40+
41+
## Versioning
42+
43+
44+
### Development Packages
45+
Development packages can be published by manually triggering the `dev-packages` workflow. Development packages are versioned as `0.0.0-dev.{short-sha}`.
46+
47+
### Production Packages
48+
Pull requests should contain Changesets for changed packages.
49+
50+
Add changesets with
51+
```Bash
52+
yarn changeset add
53+
```
54+
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.
59+
4060
## Testing Supabase example app
4161

4262
``` bash

apps/supabase-todolist

package.json

Lines changed: 3 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": [
@@ -23,6 +24,7 @@
2324
},
2425
"dependencies": {},
2526
"devDependencies": {
27+
"@changesets/cli": "^2.26.2",
2628
"lerna": "7.3.0"
2729
}
2830
}

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_data_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();

0 commit comments

Comments
 (0)