Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3ffd407
feat: add docs
Nov 27, 2023
0333078
feat: add docs
Nov 27, 2023
5522401
fix: type issue
Nov 27, 2023
f6e3d93
fix: type issue
Nov 27, 2023
fe75a6c
chore: remove docs folder
Nov 27, 2023
2f40903
chore: add gitignore
Nov 27, 2023
b381444
chore: improve styling
Nov 28, 2023
65a3c12
chore: improve styling
Nov 28, 2023
4a0a5b7
chore: try docusaurus
Nov 29, 2023
f45dc8c
fix: auto generated docs not ignored
Nov 29, 2023
2838a1c
fix: auto generated docs not ignored
Nov 29, 2023
5c070e6
fix: deployment settings
Nov 29, 2023
e8218e0
fix: deployment settings
Nov 29, 2023
b079380
chore: try file permissions
Nov 29, 2023
ba934ef
chore: try file permissions
Nov 29, 2023
cb29073
test: different action
Nov 29, 2023
2341ab8
test: different action
Nov 29, 2023
2b82227
test: different action
Nov 29, 2023
e25a108
test: folders
Nov 29, 2023
941e934
test: folders
Nov 29, 2023
093f162
test: folders
Nov 29, 2023
5e7e202
test: folders
Nov 30, 2023
da3e442
fix: packages issue
Nov 30, 2023
ce12951
fix: packages issue
Nov 30, 2023
322a640
chore: use images for socials
Nov 30, 2023
71e6355
feat: add search
Dec 1, 2023
6f23aeb
chore: disable search for now
Dec 1, 2023
6ef044e
chore: remove unnecessary deps
Dec 1, 2023
1060159
Merge branch 'main' into docs
DominicGBauer Dec 1, 2023
f0d3e42
chore: pr feedback
Dec 4, 2023
89053e2
chore: change to main branch
Dec 4, 2023
70d4e79
chore: remove unused json files
Dec 4, 2023
e90c676
fix: command
Dec 4, 2023
b922cea
chore: pr feedback
Dec 4, 2023
d0abcc5
fix: invalid naming
Dec 4, 2023
3287be9
chore: inject vars
Dec 4, 2023
842cc3e
chore: casing of name
Dec 4, 2023
7c5e073
chore: inject env
Dec 4, 2023
98563bb
chore: inject env
Dec 4, 2023
c4f0a57
fix: links
Dec 4, 2023
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/build-packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
persist-credentials: false

- name: Setup NodeJS
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Deploy docs to GitHub Pages

on:
push:
branches: ["docs", "main"]

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
environment: github-pages
env:
META_LOGO_URL: ${{vars.META_LOGO_URL}}
ALGOLIA_APP_ID: ${{vars.ALGOLIA_APP_ID}}
ALGOLIA_API_KEY: ${{vars.ALGOLIA_API_KEY}}
ALGOLIA_INDEX_NAME: ${{vars.ALGOLIA_INDEX_NAME}}
GH_URL: ${{vars.GH_URL}}
GH_ORG: ${{vars.GH_ORG}}
GH_PROJECT_NAME: ${{vars.GH_PROJECT_NAME}}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
- name: Setup Yarn
run: |
npm install -g yarn
echo "Yarn version: $(yarn -v)"
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> ~/.npmrc
- name: Install Dependencies
run: yarn install --frozen-lockfile && cd docs && yarn install --frozen-lockfile
- name: Build Packages
run: yarn build:packages
- name: Build Docs
run: yarn build:docs
- uses: actions/upload-pages-artifact@v2
with:
path: ./docs/build
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ tsconfig.tsbuildinfo
yarn-error.log
.vscode
.DS_STORE
.idea
.idea
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ Monorepo for all things React Native and PowerSync.
## Monorepo Structure

- [packages/powersync-sdk-common](./packages/powersync-sdk-common/README.md)
* A TypeScript implementation of a PowerSync database connector and streaming sync bucket implementation.
- A TypeScript implementation of a PowerSync database connector and streaming sync bucket implementation.

- [packages/powersync-sdk-react-native](./packages/powersync-sdk-react-native/README.md)
* An extension of `packages/powersync-sdk-common` which provides React Native specific implementations of abstracted features.
- An extension of `packages/powersync-sdk-common` which provides React Native specific implementations of abstracted features.

- [apps/supabase-todolist](https://github.com/powersync-ja/powersync-supabase-react-native-todolist-demo)
* An Expo React Native demo app using Supabase.
- An Expo React Native demo app using Supabase.

# Development

## Git Submodules

After cloning this repo be sure to init the Git submodules

```bash
Expand All @@ -25,41 +26,45 @@ git submodule init && git submodule update
This monorepo uses Yarn as it works well with React Native.

Install workspace dependencies

```bash
yarn install
```

Build packages

```bash
yarn build:packages
```


## Versioning


### Development Packages
Development packages can be published by manually triggering the `dev-packages` workflow. Development packages are versioned as `0.0.0-{tag}-DATETIMESTAMP`.

Development packages can be published by manually triggering the `dev-packages` workflow. Development packages are versioned as `0.0.0-{tag}-DATETIMESTAMP`.

### Production Packages

Pull requests should contain Changesets for changed packages.

Add changesets with

```Bash
yarn changeset add
```

Merging a PR with Changesets will automatically create a PR with version bumps. That PR will be merged when releasing.
Merging a PR with Changesets will automatically create a PR with version bumps. That PR will be merged when releasing.

## React Native Quick SQLite Development

Testing live development changes to `@journeyapps/react-native-quick-sqlite` will not work with standard `yarn link` commands. Metro does not work well with symlinks https://github.com/facebook/metro/issues/286.
Testing live development changes to `@journeyapps/react-native-quick-sqlite` will not work with standard `yarn link` commands. Metro does not work well with symlinks <https://github.com/facebook/metro/issues/286>.

The process of releasing development packages for `@journeyapps/react-native-quick-sqlite` for each change can be tedious and slow. A faster (and hackier) method is to use [mtsl](https://www.npmjs.com/package/mtsl) which will watch and copy the package into this workspace's `node_modules`.

```bash
npm install -g mtsl
```

```bash
mtsl add -s "[source path to your react-native-quick-sqlite repo folder]" -d "[this workspaces root node_modules folder]"/@journeyapps/react-native-quick-sqlite
```
Expand All @@ -68,15 +73,14 @@ mtsl add -s "[source path to your react-native-quick-sqlite repo folder]" -d "[t
mtsl start "[the id returned from step above]"
```


## Testing Supabase example app

``` bash
cd apps/supabase-todolist
```

Test on either Android or iOS

```bash
yarn ios
```

11 changes: 11 additions & 0 deletions docs/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
META_LOGO_URL=https://assets-global.website-files.com/651d89402147985dc475ff48/65577a5d2602b4209f37f936_powersync-website-meta-img.png

ALGOLIA_APP_ID=8U0Z3F95NH
# Public API key: it is safe to commit it
ALGOLIA_API_KEY=45caa5b7ec2fd9e5f3dbfe8b3c661c04
ALGOLIA_INDEX_NAME=powersync-react-native-sdk-react-native-sdk

# Can't use GITHUB_ when using Github actions
GH_URL=https://powersync-ja.github.io/
GH_ORG=powersync-ja
GH_PROJECT_NAME=powersync-react-native-sdk
27 changes: 27 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

docs/attachments-sdk/
docs/common-sdk/
docs/react-native-sdk/
docs/react-sdk/

.env
41 changes: 41 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus 3](https://docusaurus.io/), a modern static website generator.

### Installation

```bash
yarn
```

### Local Development

```bash
yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```bash
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this should be removed if we are using a Github action to deploy? Or is it intended to be deployed from a local machine?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can deploy from your local machine as well, which can be helpful when not necessarily always wanting to push up to the branch and fire an action


Using SSH:

```bash
USE_SSH=true yarn deploy
```

Not using SSH:

```bash
GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
94 changes: 94 additions & 0 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
id: "index"
title: "PowerSync React Native SDK Docs"
sidebar_label: "Readme"
sidebar_position: 0
custom_edit_url: null
---

# PowerSync React Native SDK
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a duplicate of the root README.md file. Is that necessary to be committed or could it not be generated as part of the build process for docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the homepage when going to https://powersync-ja.github.io/powersync-react-native-sdk/. If we don't have the file nothing is displayed and there is a page not found instead. Ideally, this page will be changed in future to be more like a homepage.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we look into generating this just-in-time as part of the deploy pipeline?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This relates to what I mentioned here: https://journeyapps.slack.com/archives/C04LUNZQJ9J/p1701436748604959?thread_ts=1701330368.833539&cid=C04LUNZQJ9J

The links to packages/powersync-sdk-common and packages/powersync-sdk-react-native are giving a 404 on that README homepage at https://powersync-ja.github.io/powersync-react-native-sdk/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might be something for the future since we probably don't really want the README to be the homepage. I've fixed the links though so they now redirect to the correct readme


Monorepo for all things React Native and PowerSync.

## Monorepo Structure

- [apps/supabase-todolist](https://github.com/powersync-ja/powersync-supabase-react-native-todolist-demo/tree/e6a1d045ab8244041651757402adc562a6699a4f)
- An Expo React native app using Supabase.

- [packages/powersync-sdk-common](./common-sdk/index.md)
- A TypeScript implementation of a PowerSync database connector and streaming sync bucket implementation.

- [packages/powersync-sdk-react-native](./react-native-sdk/index.md)
- An extension of `packages/powersync-sdk-common` which provides React Native specific implementations of abstracted features.

# Development

## Git Submodules

After cloning this repo be sure to init the Git submodules

```bash
git submodule init && git submodule update
```

This monorepo uses Yarn as it works well with React native.

Install workspace dependencies

```bash
yarn install
```

Build packages

```bash
yarn build:packages
```

## Versioning

### Development Packages

Development packages can be published by manually triggering the `dev-packages` workflow. Development packages are versioned as `0.0.0-{tag}-DATETIMESTAMP`.

### Production Packages

Pull requests should contain Changesets for changed packages.

Add changesets with

```Bash
yarn changeset add
```

Merging a PR with Changesets will automatically create a PR with version bumps. That PR will be merged when releasing.

## React Native Quick SQLite Development

Testing live development changes to `@journeyapps/react-native-quick-sqlite` will not with with standard `yarn link` commands. Metro does not work well with symlinks <https://github.com/facebook/metro/issues/286>.

The process of releasing development packages for `@journeyapps/react-native-quick-sqlite` for each change can be tedious and slow. A faster (and hackier) method is to use [mtsl](https://www.npmjs.com/package/mtsl) which will watch and copy the package into this workspace's `node_modules`.

```bash
npm install -g mtsl
```

```bash
mtsl add -s "[source path to your react-native-quick-sqlite repo folder]" -d "[this workspaces root node_modules folder]"/@journeyapps/react-native-quick-sqlite
```

```bash
mtsl start "[the id returned from step above]"
```

## Testing Supabase example app

``` bash
cd apps/supabase-todolist
```

Test on either Android or iOS

```bash
yarn ios
```
Loading