-
Notifications
You must be signed in to change notification settings - Fork 60
[Feat] add docs to github pages #37
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
Changes from all commits
3ffd407
0333078
5522401
f6e3d93
fe75a6c
2f40903
b381444
65a3c12
4a0a5b7
f45dc8c
2838a1c
5c070e6
e8218e0
b079380
ba934ef
cb29073
2341ab8
2b82227
e25a108
941e934
093f162
5e7e202
da3e442
ce12951
322a640
71e6355
6f23aeb
6ef044e
1060159
f0d3e42
89053e2
70d4e79
e90c676
b922cea
d0abcc5
3287be9
842cc3e
7c5e073
98563bb
c4f0a57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,4 +5,4 @@ tsconfig.tsbuildinfo | |
| yarn-error.log | ||
| .vscode | ||
| .DS_STORE | ||
| .idea | ||
| .idea | ||
| 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 |
| 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 |
| 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. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| module.exports = { | ||
| presets: [require.resolve('@docusaurus/core/lib/babel/preset')], | ||
| }; |
| 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 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
| ``` | ||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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