Skip to content

Commit

Permalink
[Wip Alpha] Web Support (#56)
Browse files Browse the repository at this point in the history
Initial support for web platform
  • Loading branch information
stevensJourney authored Feb 14, 2024
1 parent 8d37351 commit 57e5be3
Show file tree
Hide file tree
Showing 100 changed files with 3,803 additions and 2,099 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/demos.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Demos checks

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

on:
push:
branches:
- "**"
- '**'

jobs:
build:
Expand All @@ -23,7 +23,7 @@ jobs:
- name: Install Melos
run: flutter pub global activate melos
- name: Install dependencies
run: melos bootstrap
run: melos prepare
- name: Check formatting
run: melos format:check:demos
- name: Lint
Expand All @@ -43,6 +43,6 @@ jobs:
- name: Install melos
run: flutter pub global activate melos
- name: Install dependencies
run: melos bootstrap
run: melos prepare
- name: Run tests
run: melos test
13 changes: 7 additions & 6 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Packages check

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

on:
push:
branches:
- "**"
- '**'

jobs:
build:
Expand All @@ -23,7 +23,7 @@ jobs:
- name: Install Melos
run: flutter pub global activate melos
- name: Install dependencies
run: melos bootstrap
run: melos prepare
- name: Check formatting
run: melos format:check:packages
- name: Lint
Expand All @@ -46,7 +46,8 @@ jobs:
channel: 'stable'
- name: Install melos
run: flutter pub global activate melos
- name: Install dependencies
run: melos bootstrap
- name: Install dependencies and prepare project
run: melos prepare

- name: Run tests
run: melos test
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
permissions:
contents: write
id-token: write # Required for authentication using OIDC
runs-on: [ ubuntu-latest ]
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scripts/run-pana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ for PACKAGE in "$PACKAGES_DIR"/*; do
cd "$PACKAGE" || exit

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

# Return to the root directory
cd "$ROOT_DIR" || exit
Expand Down
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
.DS_Store
pubspec_overrides.yaml
.idea
.vscode
*.iml
.flutter-plugins-dependencies
.flutter-plugins
build

# Shared assets
assets

# Web assets
powersync_db.worker.js
sqlite3.wasm
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ This monorepo uses [melos](https://melos.invertase.dev/) to handle command and p

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.

To configure the monorepo for development run `melos prepare` after cloning

#### Blog posts

- [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)
Expand Down
3 changes: 2 additions & 1 deletion demos/supabase-anonymous-auth/lib/powersync.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// This file performs setup of the PowerSync database
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:logging/logging.dart';
import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';
Expand Down Expand Up @@ -136,7 +137,7 @@ String? getUserId() {
}

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

Expand Down
Loading

0 comments on commit 57e5be3

Please sign in to comment.