Skip to content

[Web Alpha] Improvements 1 #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Check publish score
run: |
flutter pub global activate pana
./.github/workflows/scripts/run-pana.sh
melos analyze:packages:pana --no-select

test:
runs-on: ubuntu-latest
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This triggers whenever a tagged release is pushed
name: Compile Assets and Create Draft Release

on:
push:
tags:
# Trigger on tags beginning with 'v'
# Note that `melos version ...` adds the package name as a suffix
# This action is not compatible with tags such as `powersync-v1.1.1`
# marvinpinto/action-automatic-releases struggles to generate changelogs
# Be sure to manually tag the commit to trigger this action
- 'v*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.x'
channel: 'stable'

- name: Install Melos
run: flutter pub global activate melos

- name: Install Dependencies and Compile Assets
run: melos prepare

- name: Create Draft Release
uses: 'marvinpinto/action-automatic-releases@latest'
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
prerelease: true # TODO update when out of alpha
draft: true
files: |
assets/powersync_db.worker.js
25 changes: 0 additions & 25 deletions .github/workflows/scripts/run-pana.sh

This file was deleted.

33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 2024-02-15

### Changes

---

Packages with breaking changes:

- There are no breaking changes in this release.

Packages with other changes:

- [`powersync` - `v1.3.0-alpha.2`](#powersync---v130-alpha2)
- [`powersync_attachments_helper` - `v0.3.0-alpha.2`](#powersync_attachments_helper---v030-alpha2)

Packages with dependency updates only:

> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project.

- `powersync_attachments_helper` - `v0.3.0-alpha.2`

---

#### `powersync` - `v1.3.0-alpha.2`

- **FIX**(powersync-attachements-helper): pubspec file (#29).
- **DOCS**: update readme and getting started (#51).

12 changes: 8 additions & 4 deletions demos/supabase-anonymous-auth/lib/powersync.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// This file performs setup of the PowerSync database
import 'dart:io';

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

Future<String> getDatabasePath() async {
final dir = kIsWeb ? Directory('/') : await getApplicationSupportDirectory();
return join(dir.path, 'powersync-demo.db');
const dbFilename = 'powersync-demo.db';
// getApplicationSupportDirectory is not supported on Web
if (kIsWeb) {
return dbFilename;
}
final dir = await getApplicationSupportDirectory();
return join(dir.path, dbFilename);
}

Future<void> openDatabase() async {
Expand Down
8 changes: 8 additions & 0 deletions demos/supabase-anonymous-auth/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
universal_io:
dependency: "direct main"
description:
name: universal_io
sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad"
url: "https://pub.dev"
source: hosted
version: "2.2.2"
url_launcher:
dependency: transitive
description:
Expand Down
3 changes: 2 additions & 1 deletion demos/supabase-anonymous-auth/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ dependencies:
flutter:
sdk: flutter

powersync: ^1.3.0-alpha.1
powersync: ^1.3.0-alpha.2
path_provider: ^2.1.1
supabase_flutter: ^2.0.2
path: ^1.8.3
logging: ^1.2.0
sqlite_async: ^0.7.0-alpha.1
universal_io: ^2.2.2

dev_dependencies:
flutter_test:
Expand Down
12 changes: 8 additions & 4 deletions demos/supabase-edge-function-auth/lib/powersync.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// This file performs setup of the PowerSync database
import 'dart:io';

import 'package:universal_io/io.dart';
import 'package:flutter/foundation.dart';
import 'package:logging/logging.dart';
import 'package:path/path.dart';
Expand Down Expand Up @@ -140,8 +139,13 @@ String? getUserId() {
}

Future<String> getDatabasePath() async {
final dir = kIsWeb ? Directory('/') : await getApplicationSupportDirectory();
return join(dir.path, 'powersync-demo.db');
const dbFilename = 'powersync-demo.db';
// getApplicationSupportDirectory is not supported on Web
if (kIsWeb) {
return dbFilename;
}
final dir = await getApplicationSupportDirectory();
return join(dir.path, dbFilename);
}

Future<void> openDatabase() async {
Expand Down
8 changes: 8 additions & 0 deletions demos/supabase-edge-function-auth/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
universal_io:
dependency: "direct main"
description:
name: universal_io
sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad"
url: "https://pub.dev"
source: hosted
version: "2.2.2"
url_launcher:
dependency: transitive
description:
Expand Down
3 changes: 2 additions & 1 deletion demos/supabase-edge-function-auth/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ dependencies:
flutter:
sdk: flutter

powersync: ^1.3.0-alpha.1
powersync: ^1.3.0-alpha.2
path_provider: ^2.1.1
supabase_flutter: ^2.0.2
path: ^1.8.3
logging: ^1.2.0
sqlite_async: ^0.7.0-alpha.1
universal_io: ^2.2.2

dev_dependencies:
flutter_test:
Expand Down
11 changes: 7 additions & 4 deletions demos/supabase-simple-chat/lib/powersync.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:powersync/powersync.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
Expand Down Expand Up @@ -27,8 +25,13 @@ final List<RegExp> fatalResponseCodes = [
late final PowerSyncDatabase db;

Future<String> getDatabasePath() async {
final dir = kIsWeb ? Directory('/') : await getApplicationSupportDirectory();
return join(dir.path, 'powersync-demo.db');
const dbFilename = 'powersync-demo.db';
// getApplicationSupportDirectory is not supported on Web
if (kIsWeb) {
return dbFilename;
}
final dir = await getApplicationSupportDirectory();
return join(dir.path, dbFilename);
}

bool isLoggedIn() {
Expand Down
8 changes: 8 additions & 0 deletions demos/supabase-simple-chat/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
universal_io:
dependency: "direct main"
description:
name: universal_io
sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad"
url: "https://pub.dev"
source: hosted
version: "2.2.2"
url_launcher:
dependency: transitive
description:
Expand Down
3 changes: 2 additions & 1 deletion demos/supabase-simple-chat/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ dependencies:

supabase_flutter: ^1.10.25
timeago: ^3.6.0
powersync: ^1.3.0-alpha.1
powersync: ^1.3.0-alpha.2
path_provider: ^2.1.1
path: ^1.8.3
logging: ^1.2.0
universal_io: ^2.2.2

dev_dependencies:
flutter_test:
Expand Down
11 changes: 7 additions & 4 deletions demos/supabase-todolist/lib/powersync.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// 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';
Expand Down Expand Up @@ -148,8 +146,13 @@ String? getUserId() {
}

Future<String> getDatabasePath() async {
final dir = kIsWeb ? Directory('/') : await getApplicationSupportDirectory();
return join(dir.path, 'powersync-demo.db');
const dbFilename = 'powersync-demo.db';
// getApplicationSupportDirectory is not supported on Web
if (kIsWeb) {
return dbFilename;
}
final dir = await getApplicationSupportDirectory();
return join(dir.path, dbFilename);
}

Future<void> openDatabase() async {
Expand Down
8 changes: 8 additions & 0 deletions demos/supabase-todolist/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
universal_io:
dependency: "direct main"
description:
name: universal_io
sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad"
url: "https://pub.dev"
source: hosted
version: "2.2.2"
url_launcher:
dependency: transitive
description:
Expand Down
3 changes: 2 additions & 1 deletion demos/supabase-todolist/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ dependencies:
sdk: flutter
powersync_attachments_helper: ^0.3.0-alpha.1

powersync: ^1.3.0-alpha.1
powersync: ^1.3.0-alpha.2
path_provider: ^2.1.1
supabase_flutter: ^2.0.1
path: ^1.8.3
logging: ^1.2.0
sqlite_async: ^0.7.0-alpha.1
camera: ^0.10.5+7
image: ^4.1.3
universal_io: ^2.2.2

dev_dependencies:
flutter_test:
Expand Down
36 changes: 21 additions & 15 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,19 @@ ide:
scripts:
prepare: melos bootstrap && melos compile:webworker && melos update:wasm

format:
description: Format Dart code.
run: dart format .

format:check:packages:
description: Check formatting of Dart code in packages.
run: dart format --output none --set-exit-if-changed packages

format:check:demos:
description: Check formatting of Dart code in demos.
run: dart format --output none --set-exit-if-changed demos
analyze:demos:
description: Analyze Dart code in demos.
run: dart analyze demos --fatal-infos

analyze:packages:
description: Analyze Dart code in packages.
run: dart analyze packages --fatal-infos

analyze:demos:
description: Analyze Dart code in demos.
run: dart analyze demos --fatal-infos
analyze:packages:pana:
description: Analyze Dart packages with Pana
exec: flutter pub global run pana --no-warning --exit-code-threshold 10
packageFilters:
noPrivate: true

compile:webworker:
description: Compile Javascript web worker distributable
Expand All @@ -38,7 +32,17 @@ scripts:
scope:
- powersync_web_worker

update:wasm: sh scripts/init_sqlite_wasm.sh
format:
description: Format Dart code.
run: dart format .

format:check:demos:
description: Check formatting of Dart code in demos.
run: dart format --output none --set-exit-if-changed demos

format:check:packages:
description: Check formatting of Dart code in packages.
run: dart format --output none --set-exit-if-changed packages

test:
description: Run tests in a specific package.
Expand All @@ -52,3 +56,5 @@ scripts:
# as they could change the behaviour of how tests filter packages.
env:
MELOS_TEST: true

update:wasm: dart run scripts/init_sqlite_wasm.dart
8 changes: 8 additions & 0 deletions packages/powersync/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
## 1.3.0-alpha.2

- **FIX**(powersync-attachements-helper): pubspec file (#29).
- **DOCS**: update readme and getting started (#51).

## 1.3.0-alpha.1

- Added initial support for Web platform.
## 1.2.2

- Deprecate DevConnector and related

## 1.2.1

Expand Down
Loading