Skip to content

Commit 52d6d93

Browse files
Merge pull request #37 from powersync-ja/docs
[Feat] add docs to github pages
2 parents 7ca77c2 + c4f0a57 commit 52d6d93

30 files changed

+9394
-3849
lines changed

.github/workflows/build-packages.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
persist-credentials: false
1515

1616
- name: Setup NodeJS
17-
uses: actions/setup-node@v2
17+
uses: actions/setup-node@v4
1818
with:
1919
node-version: 18
2020
cache: 'yarn'

.github/workflows/deploy-docs.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Deploy docs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: ["docs", "main"]
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
concurrency:
13+
group: "pages"
14+
cancel-in-progress: false
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
environment: github-pages
20+
env:
21+
META_LOGO_URL: ${{vars.META_LOGO_URL}}
22+
ALGOLIA_APP_ID: ${{vars.ALGOLIA_APP_ID}}
23+
ALGOLIA_API_KEY: ${{vars.ALGOLIA_API_KEY}}
24+
ALGOLIA_INDEX_NAME: ${{vars.ALGOLIA_INDEX_NAME}}
25+
GH_URL: ${{vars.GH_URL}}
26+
GH_ORG: ${{vars.GH_ORG}}
27+
GH_PROJECT_NAME: ${{vars.GH_PROJECT_NAME}}
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v3
31+
- name: Setup NodeJS
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 18
35+
cache: yarn
36+
- name: Setup Yarn
37+
run: |
38+
npm install -g yarn
39+
echo "Yarn version: $(yarn -v)"
40+
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> ~/.npmrc
41+
- name: Install Dependencies
42+
run: yarn install --frozen-lockfile && cd docs && yarn install --frozen-lockfile
43+
- name: Build Packages
44+
run: yarn build:packages
45+
- name: Build Docs
46+
run: yarn build:docs
47+
- uses: actions/upload-pages-artifact@v2
48+
with:
49+
path: ./docs/build
50+
deploy:
51+
runs-on: ubuntu-latest
52+
environment:
53+
name: github-pages
54+
url: ${{ steps.deployment.outputs.page_url }}
55+
needs: build
56+
steps:
57+
- name: Deploy to GitHub Pages
58+
id: deployment
59+
uses: actions/deploy-pages@v2

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ tsconfig.tsbuildinfo
55
yarn-error.log
66
.vscode
77
.DS_STORE
8-
.idea
8+
.idea

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ Monorepo for all things React Native and PowerSync.
55
## Monorepo Structure
66

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

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

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

1616
# Development
1717

1818
## Git Submodules
19+
1920
After cloning this repo be sure to init the Git submodules
2021

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

2728
Install workspace dependencies
29+
2830
```bash
2931
yarn install
3032
```
3133

3234
Build packages
35+
3336
```bash
3437
yarn build:packages
3538
```
3639

37-
3840
## Versioning
3941

40-
4142
### Development Packages
42-
Development packages can be published by manually triggering the `dev-packages` workflow. Development packages are versioned as `0.0.0-{tag}-DATETIMESTAMP`.
43+
44+
Development packages can be published by manually triggering the `dev-packages` workflow. Development packages are versioned as `0.0.0-{tag}-DATETIMESTAMP`.
4345

4446
### Production Packages
47+
4548
Pull requests should contain Changesets for changed packages.
4649

4750
Add changesets with
51+
4852
```Bash
4953
yarn changeset add
5054
```
5155

52-
Merging a PR with Changesets will automatically create a PR with version bumps. That PR will be merged when releasing.
56+
Merging a PR with Changesets will automatically create a PR with version bumps. That PR will be merged when releasing.
5357

5458
## React Native Quick SQLite Development
5559

56-
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.
60+
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>.
5761

5862
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`.
5963

6064
```bash
6165
npm install -g mtsl
6266
```
67+
6368
```bash
6469
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
6570
```
@@ -68,15 +73,14 @@ mtsl add -s "[source path to your react-native-quick-sqlite repo folder]" -d "[t
6873
mtsl start "[the id returned from step above]"
6974
```
7075

71-
7276
## Testing Supabase example app
7377

7478
``` bash
7579
cd apps/supabase-todolist
7680
```
7781

7882
Test on either Android or iOS
83+
7984
```bash
8085
yarn ios
8186
```
82-

docs/.env.example

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
META_LOGO_URL=https://assets-global.website-files.com/651d89402147985dc475ff48/65577a5d2602b4209f37f936_powersync-website-meta-img.png
2+
3+
ALGOLIA_APP_ID=8U0Z3F95NH
4+
# Public API key: it is safe to commit it
5+
ALGOLIA_API_KEY=45caa5b7ec2fd9e5f3dbfe8b3c661c04
6+
ALGOLIA_INDEX_NAME=powersync-react-native-sdk-react-native-sdk
7+
8+
# Can't use GITHUB_ when using Github actions
9+
GH_URL=https://powersync-ja.github.io/
10+
GH_ORG=powersync-ja
11+
GH_PROJECT_NAME=powersync-react-native-sdk

docs/.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*
21+
22+
docs/attachments-sdk/
23+
docs/common-sdk/
24+
docs/react-native-sdk/
25+
docs/react-sdk/
26+
27+
.env

docs/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Website
2+
3+
This website is built using [Docusaurus 3](https://docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```bash
8+
yarn
9+
```
10+
11+
### Local Development
12+
13+
```bash
14+
yarn start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
### Build
20+
21+
```bash
22+
yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
Using SSH:
30+
31+
```bash
32+
USE_SSH=true yarn deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```bash
38+
GIT_USER=<Your GitHub username> yarn deploy
39+
```
40+
41+
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.

docs/babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
};

docs/docs/index.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
id: "index"
3+
title: "PowerSync React Native SDK Docs"
4+
sidebar_label: "Readme"
5+
sidebar_position: 0
6+
custom_edit_url: null
7+
---
8+
9+
# PowerSync React Native SDK
10+
11+
Monorepo for all things React Native and PowerSync.
12+
13+
## Monorepo Structure
14+
15+
- [apps/supabase-todolist](https://github.com/powersync-ja/powersync-supabase-react-native-todolist-demo/tree/e6a1d045ab8244041651757402adc562a6699a4f)
16+
- An Expo React native app using Supabase.
17+
18+
- [packages/powersync-sdk-common](./common-sdk/index.md)
19+
- A TypeScript implementation of a PowerSync database connector and streaming sync bucket implementation.
20+
21+
- [packages/powersync-sdk-react-native](./react-native-sdk/index.md)
22+
- An extension of `packages/powersync-sdk-common` which provides React Native specific implementations of abstracted features.
23+
24+
# Development
25+
26+
## Git Submodules
27+
28+
After cloning this repo be sure to init the Git submodules
29+
30+
```bash
31+
git submodule init && git submodule update
32+
```
33+
34+
This monorepo uses Yarn as it works well with React native.
35+
36+
Install workspace dependencies
37+
38+
```bash
39+
yarn install
40+
```
41+
42+
Build packages
43+
44+
```bash
45+
yarn build:packages
46+
```
47+
48+
## Versioning
49+
50+
### Development Packages
51+
52+
Development packages can be published by manually triggering the `dev-packages` workflow. Development packages are versioned as `0.0.0-{tag}-DATETIMESTAMP`.
53+
54+
### Production Packages
55+
56+
Pull requests should contain Changesets for changed packages.
57+
58+
Add changesets with
59+
60+
```Bash
61+
yarn changeset add
62+
```
63+
64+
Merging a PR with Changesets will automatically create a PR with version bumps. That PR will be merged when releasing.
65+
66+
## React Native Quick SQLite Development
67+
68+
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>.
69+
70+
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`.
71+
72+
```bash
73+
npm install -g mtsl
74+
```
75+
76+
```bash
77+
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
78+
```
79+
80+
```bash
81+
mtsl start "[the id returned from step above]"
82+
```
83+
84+
## Testing Supabase example app
85+
86+
``` bash
87+
cd apps/supabase-todolist
88+
```
89+
90+
Test on either Android or iOS
91+
92+
```bash
93+
yarn ios
94+
```

0 commit comments

Comments
 (0)