Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
updated from main
Browse files Browse the repository at this point in the history
  • Loading branch information
stevensJourney committed Nov 16, 2023
2 parents b1da454 + 58a1cd2 commit d947b90
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- name: Setup PNPM
run: |
npm install -g pnpm
npm install -g pnpm@8
echo "PNPM version: $(pnpm -v)"
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> ~/.npmrc
Expand Down
39 changes: 34 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
workflow_dispatch:

concurrency: ${{ github.workflow }}-${{ github.ref }}

Expand All @@ -15,20 +16,48 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node.js 18
- name: Setup Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20

- name: Setup PNPM
run: |
npm install -g pnpm@8
echo "PNPM version: $(pnpm -v)"
- name: Setup NPMRC
run: |
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> ~/.npmrc
- name: Install Dependencies
run: pnpm
run: pnpm install --frozen-lockfile

- name: Build packages
run: pnpm build:packages

- id: is_dev
run: |
IS_DEV=${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/changeset-release/main' }}
echo "value=$IS_DEV" >> $GITHUB_OUTPUT
- name: Publish dev packages
if: ${{ steps.is_dev.outputs.value == 'true' }}
run: |
pnpm changeset version --no-git-tag --snapshot dev
pnpm changeset publish --tag next
- name: Create Release Pull Request or Publish to npm
if: ${{ steps.is_dev.outputs.value == 'false' }}
id: changesets
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm release
version: pnpm ci:version
commit: 'chore: update versions'
title: '[Chore] update versions'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish production components.
if: ${{ github.ref == 'refs/heads/main' && steps.changesets.outputs.hasChangesets == 'false' }}
run: pnpm ci:publish
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ pnpm install
pnpm build:packages
```

To run a demo app see [README](./demos/powersync-nextjs-demo/README.md)
To run a demo app follow the [getting started](./demos/powersync-nextjs-demo/README.md#getting-started) instructions.
2 changes: 1 addition & 1 deletion demos/powersync-nextjs-demo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ next-env.d.ts
**/public/sw.js
**/public/swe-worker-*
**/public/worker-*.js
**/public/fallback-*.js
**/public/fallback-*.js
15 changes: 15 additions & 0 deletions demos/powersync-nextjs-demo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# @journeyapps/powersync-nextjs-demo

## 0.1.2

### Patch Changes

- Updated dependencies [5d9cbb9]
- @journeyapps/powersync-sdk-web@0.0.2

## 0.1.1

### Patch Changes

- Updated dependencies [af78f76]
- @journeyapps/powersync-sdk-web@0.0.1
6 changes: 2 additions & 4 deletions demos/powersync-nextjs-demo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@journeyapps/powersync-nextjs-demo",
"version": "0.1.0",
"version": "0.1.2",
"private": true,
"scripts": {
"build": "next build",
Expand All @@ -26,9 +26,7 @@
"lodash": "^4.17.21",
"next": "14.0.0",
"react": "^18",
"react-dom": "^18",
"workbox-strategies": "^7.0.0",
"workbox-sw": "^7.0.0"
"react-dom": "^18"
},
"devDependencies": {
"@types/lodash": "^4.14.200",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,12 @@ import { PowerSyncContext } from '@journeyapps/powersync-react';
import { WASQLitePowerSyncDatabaseOpenFactory } from '@journeyapps/powersync-sdk-web';
import { AppSchema } from '@/library/powersync/AppSchema';
import { SupabaseConnector } from '@/library/powersync/SupabaseConnector';
import { useRouter, usePathname } from 'next/navigation';
import { DEFAULT_ENTRY_ROUTE } from '../Routes';
import { useRouter } from 'next/navigation';
import { CircularProgress } from '@mui/material';

const SupabaseContext = React.createContext<SupabaseConnector | null>(null);
export const useSupabase = () => React.useContext(SupabaseContext);

/**
* This provider acts as an authenticator guard. If there is no active
* session it will navigate to the login screen. If there is an
* active session and the current path is the index, it will navigate
* to the default entry point page.
*/
const REDIRECT_ON_AUTHENTICATED_ROUTES = ['/'];

export const SystemProvider = ({ children }: { children: React.ReactNode }) => {
const [connector] = React.useState(new SupabaseConnector());
const [powerSync] = React.useState(
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"scripts": {
"build:all": "pnpm run -r build",
"build:packages": "pnpm run --filter './packages/**' -r build",
"ci:version": "changeset version && pnpm install --no-frozen-lockfile",
"ci:publish": "changeset publish && git push --follow-tags",
"clean": "pnpm run -r clean",
"release": "pnpm build:packages && pnpm changeset publish",
"watch": "pnpm run --parallel watch"
},
"keywords": [],
Expand Down
13 changes: 13 additions & 0 deletions packages/powersync-sdk-web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# @journeyapps/powersync-sdk-web

## 0.0.2

### Patch Changes

- 5d9cbb9: Update package readme

## 0.0.1

### Patch Changes

- af78f76: Initial Alpha version
16 changes: 10 additions & 6 deletions packages/powersync-sdk-web/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# PowerSync SDK for Web

[PowerSync](https://powersync.co) is a service and set of SDKs that keeps Postgres databases in sync with on-device SQLite databases. See a summary of features [here](https://docs.powersync.co/client-sdk-references/react-native-and-expo).
[PowerSync](https://powersync.co) is a service and set of SDKs that keeps Postgres databases in sync with on-device SQLite databases.

## Alpha Release
This React Native SDK package is currently in an alpha release.
This SDK package is currently in an alpha release.

# Installation

Expand All @@ -28,7 +28,7 @@ This package uses [js-logger](https://www.npmjs.com/package/js-logger) for loggi

Enable JS Logger with your logging interface of choice or use the default `console`
```JavaScript
import { Logger } from 'js-logger';
import Logger from 'js-logger';

// Log messages will be written to the window's console.
Logger.useDefaults();
Expand All @@ -51,7 +51,7 @@ See our [Docs](https://docs.powersync.co/usage/installation/client-side-setup) f
import {
Column,
ColumnType,
RNQSPowerSyncDatabaseOpenFactory,
WASQLitePowerSyncDatabaseOpenFactory,
Schema,
Table
} from '@journeyapps/powersync-sdk-web';
Expand Down Expand Up @@ -87,7 +87,6 @@ class Connector {
endpoint: '[The PowerSync instance URL]',
token: 'An authentication token',
expiresAt: 'When the token expires',
userID: 'User ID to associate the session with'
};
}

Expand All @@ -105,4 +104,9 @@ export const connectPowerSync = async () => {

React hooks are available in the [@journeyapps/powersync-react](https://www.npmjs.com/package/@journeyapps/powersync-react) package

Refer to our [full documentation](https://docs.powersync.co/client-sdk-references/react-native-and-expo) to learn more.
## Demo Apps

See our [NextJS Demo App](https://github.com/powersync-ja/powersync-web-sdk/tree/main/demos/powersync-nextjs-demo) for how to use this SDK with NextJS and Supabase.

# Known Issues
This initial SDK version uses a `SharedWorker` for DB operations which is not supported on Chrome for Android. Future SDK versions will feature selectable DB Adapters which will increase compatibility.
2 changes: 1 addition & 1 deletion packages/powersync-sdk-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@journeyapps/powersync-sdk-web",
"version": "0.0.0",
"version": "0.0.2",
"description": "A Web SDK for JourneyApps PowerSync",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
6 changes: 0 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d947b90

Please sign in to comment.