Skip to content

Commit 57e5be3

Browse files
[Wip Alpha] Web Support (#56)
Initial support for web platform
1 parent 8d37351 commit 57e5be3

File tree

100 files changed

+3803
-2099
lines changed

Some content is hidden

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

100 files changed

+3803
-2099
lines changed

.github/workflows/demos.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name: Demos checks
22

33
concurrency:
4-
group: demos-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
5-
cancel-in-progress: true
4+
group: demos-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
5+
cancel-in-progress: true
66

77
on:
88
push:
99
branches:
10-
- "**"
10+
- '**'
1111

1212
jobs:
1313
build:
@@ -23,7 +23,7 @@ jobs:
2323
- name: Install Melos
2424
run: flutter pub global activate melos
2525
- name: Install dependencies
26-
run: melos bootstrap
26+
run: melos prepare
2727
- name: Check formatting
2828
run: melos format:check:demos
2929
- name: Lint
@@ -43,6 +43,6 @@ jobs:
4343
- name: Install melos
4444
run: flutter pub global activate melos
4545
- name: Install dependencies
46-
run: melos bootstrap
46+
run: melos prepare
4747
- name: Run tests
4848
run: melos test

.github/workflows/packages.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name: Packages check
22

33
concurrency:
4-
group: packages-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
5-
cancel-in-progress: true
4+
group: packages-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
5+
cancel-in-progress: true
66

77
on:
88
push:
99
branches:
10-
- "**"
10+
- '**'
1111

1212
jobs:
1313
build:
@@ -23,7 +23,7 @@ jobs:
2323
- name: Install Melos
2424
run: flutter pub global activate melos
2525
- name: Install dependencies
26-
run: melos bootstrap
26+
run: melos prepare
2727
- name: Check formatting
2828
run: melos format:check:packages
2929
- name: Lint
@@ -46,7 +46,8 @@ jobs:
4646
channel: 'stable'
4747
- name: Install melos
4848
run: flutter pub global activate melos
49-
- name: Install dependencies
50-
run: melos bootstrap
49+
- name: Install dependencies and prepare project
50+
run: melos prepare
51+
5152
- name: Run tests
5253
run: melos test

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
permissions:
88
contents: write
99
id-token: write # Required for authentication using OIDC
10-
runs-on: [ ubuntu-latest ]
10+
runs-on: [ubuntu-latest]
1111
steps:
1212
- uses: actions/checkout@v3
1313
- uses: subosito/flutter-action@v2

.github/workflows/scripts/run-pana.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ for PACKAGE in "$PACKAGES_DIR"/*; do
1717
cd "$PACKAGE" || exit
1818

1919
# Run the pana command
20-
flutter pub global run pana --no-warning --exit-code-threshold 0
20+
flutter pub global run pana --no-warning --exit-code-threshold 10
2121

2222
# Return to the root directory
2323
cd "$ROOT_DIR" || exit

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
.DS_Store
55
pubspec_overrides.yaml
66
.idea
7+
.vscode
78
*.iml
89
.flutter-plugins-dependencies
910
.flutter-plugins
11+
build
12+
13+
# Shared assets
14+
assets
15+
16+
# Web assets
17+
powersync_db.worker.js
18+
sqlite3.wasm

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ This monorepo uses [melos](https://melos.invertase.dev/) to handle command and p
1818

1919
For detailed usage, check out the inner [powersync](https://github.com/powersync-ja/powersync.dart/tree/master/packages/powersync) and [attachments helper](https://github.com/powersync-ja/powersync.dart/tree/master/packages/powersync_attachments_helper) packages.
2020

21+
To configure the monorepo for development run `melos prepare` after cloning
22+
2123
#### Blog posts
2224

2325
- [Flutter Tutorial: building an offline-first chat app with Supabase and PowerSync](https://www.powersync.com/blog/flutter-tutorial-building-an-offline-first-chat-app-with-supabase-and-powersync)

demos/supabase-anonymous-auth/lib/powersync.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// This file performs setup of the PowerSync database
22
import 'dart:io';
33

4+
import 'package:flutter/foundation.dart';
45
import 'package:logging/logging.dart';
56
import 'package:path/path.dart';
67
import 'package:path_provider/path_provider.dart';
@@ -136,7 +137,7 @@ String? getUserId() {
136137
}
137138

138139
Future<String> getDatabasePath() async {
139-
final dir = await getApplicationSupportDirectory();
140+
final dir = kIsWeb ? Directory('/') : await getApplicationSupportDirectory();
140141
return join(dir.path, 'powersync-demo.db');
141142
}
142143

0 commit comments

Comments
 (0)