Skip to content

Commit 3e6fac6

Browse files
authored
Tauri SDK (#902)
1 parent ccf16f0 commit 3e6fac6

71 files changed

Lines changed: 3679 additions & 23 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"access": "restricted",
88
"baseBranch": "main",
99
"updateInternalDependencies": "patch",
10-
"ignore": ["!@powersync/*"],
10+
"ignore": ["import-tests", "powersynctests"],
1111
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
1212
"onlyUpdatePeerDependentsWhenOutOfRange": true,
1313
"updateInternalDependents": "out-of-range"

.changeset/thick-hats-joke.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'tauri-plugin-powersync': patch
3+
'@powersync/tauri-plugin': patch
4+
---
5+
6+
Initial release
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- tauri-plugin-powersync@[0-9]+.[0-9]+.[0-9]+
6+
7+
jobs:
8+
publish_crates_io:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
id-token: write # Required for OIDC token exchange
12+
steps:
13+
- uses: actions/checkout@v6
14+
- uses: rust-lang/crates-io-auth-action@v1
15+
id: auth
16+
17+
- name: Publish powersync crate
18+
run: cargo publish
19+
working-directory: powersync
20+
env:
21+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

.github/workflows/test-tauri.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Tauri Integration tests
2+
on:
3+
pull_request: # triggered for any PR updates (including new pushes to PR branch)
4+
5+
jobs:
6+
check-changes:
7+
name: Check for relevant changes
8+
runs-on: ubuntu-latest
9+
outputs:
10+
should_run: ${{ steps.check.outputs.should_run }}
11+
steps:
12+
- uses: actions/checkout@v6
13+
with:
14+
fetch-depth: 0
15+
- name: Check for changes
16+
id: check
17+
run: |
18+
git fetch origin ${{ github.base_ref }}
19+
if git diff --quiet origin/${{ github.base_ref }} -- packages/common packages/tauri; then
20+
echo "should_run=false" >> $GITHUB_OUTPUT
21+
else
22+
echo "should_run=true" >> $GITHUB_OUTPUT
23+
fi
24+
25+
test-tauri:
26+
name: Tauri integration tests macOS
27+
runs-on: macos-latest
28+
needs: check-changes
29+
if: needs.check-changes.outputs.should_run == 'true'
30+
timeout-minutes: 15
31+
32+
steps:
33+
- uses: actions/checkout@v6
34+
- name: Enable Corepack
35+
run: corepack enable
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v6
38+
with:
39+
node-version-file: '.nvmrc'
40+
cache: pnpm
41+
42+
- name: Install dependencies
43+
run: pnpm install
44+
- name: Build
45+
run: pnpm run -r --filter "@powersync/tauri-plugin..." build
46+
- name: Compile test runner
47+
run: cargo build -p test-runner
48+
- name: Test
49+
working-directory: packages/tauri
50+
run: pnpm test

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ demos/**/.pnpmfile.cjs
2626
demos/**/.branches
2727
demos/**/.temp
2828

29+
Cargo.lock
30+
target/
31+
# Large files generated by Tauri
32+
**/gen/schemas/

Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Having a top-level Cargo.toml makes it easier to use rust-analyzer in VS Code when opening
2+
# this project.
3+
4+
[workspace]
5+
resolver = "3"
6+
members = [
7+
"packages/tauri",
8+
"packages/tauri/test-runner",
9+
"demos/tauri-app/src-tauri"
10+
]
11+
12+
[workspace.package]
13+
repository = "https://github.com/powersync-ja/powersync-js"

demos/tauri-app/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# PowerSync Tauri demo
2+
3+
This demonstrates a minimal Tauri app using PowerSync for local persistence and data sync.
4+
5+
It is designed to run with a [self-hosted instance](https://github.com/powersync-ja/self-host-demo/). To get started:
6+
7+
1. Clone the [self-host-demo](https://github.com/powersync-ja/self-host-demo/) repository.
8+
2. Change `config/sync-config.yaml` to the Sync Config from this readme.
9+
3. Run `pnpm tauri dev` to start the app.
10+
11+
```yaml
12+
# config/sync-config.yaml
13+
config:
14+
edition: 3
15+
16+
streams:
17+
lists:
18+
query: SELECT * FROM lists
19+
auto_subscribe: true
20+
todos:
21+
query: SELECT * FROM todos WHERE list_id = subscription.parameter('list')
22+
```
23+
24+
When opening the app, you should see a list displaying all `lists` rows from the server. Clicking on the `Open in new window` button opens the list in a new window. All windows have their own JavaScript context, but share queries and sync in real-time thanks to the PowerSync Tauri plugin.

demos/tauri-app/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>PowerSync Tauri Demo</title>
7+
</head>
8+
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

demos/tauri-app/package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "tauri-app",
3+
"private": true,
4+
"version": "0.1.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "vite build",
9+
"preview": "vite preview",
10+
"tauri": "tauri"
11+
},
12+
"dependencies": {
13+
"@powersync/common": "1.50.0",
14+
"@powersync/tauri-plugin": "0.0.1",
15+
"@powersync/react": "1.9.1",
16+
"@tauri-apps/api": "^2.0.0",
17+
"@tanstack/react-router": "^1.167.4",
18+
"react": "^19.2.4",
19+
"react-dom": "^19.2.4"
20+
},
21+
"devDependencies": {
22+
"@tauri-apps/cli": "^2.0.0",
23+
"@types/react": "^19.2.14",
24+
"@types/react-dom": "^19.2.3",
25+
"@vitejs/plugin-react": "^6.0.1",
26+
"@tanstack/router-plugin": "^1.166.13",
27+
"typescript": "^5.9.3",
28+
"vite": "^8.0.0"
29+
}
30+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
packages:
2+
- .

0 commit comments

Comments
 (0)