Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into indexeddb-flushing
Browse files Browse the repository at this point in the history
  • Loading branch information
rkistner committed Nov 6, 2024
2 parents 21f9d00 + f03f15a commit 21fa93d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 49 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Compile Assets and Create Draft Release
on:
push:
tags:
- "powersync-v[0-9]+.[0-9]+.[0-9]+"
- 'powersync-v[0-9]+.[0-9]+.[0-9]+'

jobs:
build:
Expand All @@ -19,8 +19,8 @@ jobs:
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.x"
channel: "stable"
flutter-version: '3.x'
channel: 'stable'

- name: Install Melos
run: flutter pub global activate melos
Expand All @@ -34,6 +34,9 @@ jobs:
GH_REPO: ${{ github.repository }}
run: |
tag="${{ github.ref_name }}"
body="Release $tag"
gh release create --draft "$tag" --title "$tag" --notes "$body" --generate-notes
version="${tag#powersync-v}"
changes=$(awk "/## $version/{flag=1;next}/##/{flag=0}flag" packages/powersync/CHANGELOG.md)
body="Release $tag
$changes"
gh release create "$tag" --title "$tag" --notes "$body"
gh release upload "${{ github.ref_name }}" packages/powersync/assets/powersync_db.worker.js packages/powersync/assets/powersync_sync.worker.js
2 changes: 1 addition & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ git push --follow-tags

**Note: This will launch the `release.yaml` and `publish.yaml` github actions in `.github/workflows`. So only run it when you are absolutely sure you want to release.**

A version bump and tag push for `powersync` will also create a draft github release for the powersync web worker. The worker needs to be manually published in the GitHub [releases](https://github.com/powersync-ja/powersync.dart/releases).
A version bump and tag push for `powersync` will also create a Github release for the PowerSync web workers. Verify the release exists and is published in the [releases](https://github.com/powersync-ja/powersync.dart/releases).
51 changes: 8 additions & 43 deletions packages/powersync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@ flutter pub add powersync

# Getting Started

Our [full SDK reference](https://docs.powersync.com/client-sdk-references/flutter) contains everything you need to know to get started implementing PowerSync in your project.
Our [full SDK reference](https://docs.powersync.com/client-sdk-references/flutter) contains everything you need to know to get started implementing PowerSync in your project.

## **Web support - Beta**

Web support in version 1.9.0 is currently in a beta release. This means it is safe to use in production, provided that you've tested your use cases.
Flutter Web support in version `^1.9.0` is currently in a beta release. It is functionally ready for production use, provided that you've tested your use cases.

Please familiarize yourself with the limitations for Flutter Web documented [here](https://docs.powersync.com/client-sdk-references/flutter/flutter-web-support#limitations).

### Demo app

The easiest way to test Flutter Web support is to run the [Supabase Todo-List](https://github.com/powersync-ja/powersync.dart/tree/main/demos/supabase-todolist) demo app:

1. Checkout [this repo's](https://github.com/powersync-ja/powersync.dart/tree/main) `main` branch.
1. Clone [this repo](https://github.com/powersync-ja/powersync.dart/tree/main).

- Note: If you are an existing user updating to the latest code after a git pull, run `melos exec 'flutter pub upgrade'` in the repo's root directory and make sure it succeeds.

Expand All @@ -39,52 +41,15 @@ The easiest way to test Flutter Web support is to run the [Supabase Todo-List](h

### Installing PowerSync in your own project

Install the latest version of the package, for example:
Install the [latest version](https://pub.dev/packages/powersync/versions) of the package, for example:

```
flutter pub add powersync:'^1.9.0'
```

The latest version can be found [here](https://pub.dev/packages/powersync/versions).

### Additional config

Web support requires `sqlite3.wasm` and worker (`powersync_db.worker.js` and `powersync_sync.worker.js`) assets to be served from the web application. They can be downloaded to the `web` directory by running the following command in your application's root folder.

```dart
dart run powersync:setup_web
```

The same code is used for initializing native and web `PowerSyncDatabase` clients.

### Limitations

The API for Web is essentially the same as for native platforms, however, some features within `PowerSyncDatabase` clients are not available.

#### Imports

Flutter Web does not support importing directly from `sqlite3.dart` as it uses `dart:ffi`.

Change imports from

```Dart
import 'package/powersync/sqlite3.dart`
```

to

```Dart
import 'package/powersync/sqlite3_common.dart'
```

In code which needs to run on the Web platform. Isolated native specific code can still import from `sqlite3.dart`.

#### Database connections

Web DB connections do not support concurrency. A single DB connection is used. `readLock` and `writeLock` contexts do not
implement checks for preventing writable queries in read connections and vice-versa.
#### Additional config

Direct access to the synchronous `CommonDatabase` (`sqlite.Database` equivalent for web) connection is not available. `computeWithDatabase` is not available on web.
Additional config is required for web projects. Please see our docs [here](https://docs.powersync.com/client-sdk-references/flutter/flutter-web-support#additional-config) for details.

# Changelog

Expand Down

0 comments on commit 21fa93d

Please sign in to comment.