Skip to content

Commit

Permalink
Merge pull request #37 from powersync-ja/docs
Browse files Browse the repository at this point in the history
[Feat] add docs to github pages
  • Loading branch information
DominicGBauer authored Dec 5, 2023
2 parents 7ca77c2 + c4f0a57 commit 52d6d93
Show file tree
Hide file tree
Showing 30 changed files with 9,394 additions and 3,849 deletions.
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

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

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

0 comments on commit 52d6d93

Please sign in to comment.