Skip to content

Commit

Permalink
Merge pull request #186 from oasisprotocol/matevz/feature/typedoc
Browse files Browse the repository at this point in the history
clients/js: Add typedoc deployment
  • Loading branch information
matevz authored Sep 22, 2023
2 parents 6d67f7e + f8197f3 commit bf1c5ef
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 19 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/ci-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: ci-docs

on:
push:
paths:
- clients/js/**
branches:
- main

# Cancel in-progress jobs on same branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
js-docs:
name: js-docs
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./clients/js
steps:
- name: Checkout code
uses: actions/checkout@v4

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

- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm --filter @oasisprotocol/sapphire-paratime install

- name: Build docs
run: |
pnpm typedoc
- name: Deploy to api-reference branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: clients/js/docs/api
publish_branch: api-reference
destination_dir: js/sapphire-paratime
commit_message: Deploy js API reference ${{ github.event.head_commit.message }}
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com

3 changes: 3 additions & 0 deletions .github/workflows/ci-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ jobs:
- name: Build JS client
run: pnpm build

- name: Build typedoc
run: pnpm typedoc

- name: Upload client-js build
uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion clients/js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ by wrapping your existing `ethers.Provider`/`window.ethereum`/`web3.providers.*`
Once you wrap your provider, you can use Sapphire just like you would use Ethereum.

[@oasisprotocol/sapphire-paratime]: https://www.npmjs.com/package/@oasisprotocol/sapphire-paratime
[sapphire paratime]: https://docs.oasis.dev/general/developer-resources/sapphire-paratime/
[sapphire paratime]: https://docs.oasis.io/dapp/sapphire/

_If your dapp doesn't port in under 10 minutes, it's a bug!_
If you have more than a little trouble, please file an issue.
Expand Down
3 changes: 1 addition & 2 deletions clients/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"build:cjs": "tsc -p ./tsconfig.cjs.json && node scripts/rename-cjs",
"test": "jest",
"coverage": "jest --coverage",
"doc": "typedoc --excludeInternal --excludePrivate src/index.ts",
"prepublishOnly": "pnpm build"
},
"dependencies": {
Expand Down Expand Up @@ -70,7 +69,7 @@
"node-fetch": "^2.6.7",
"prettier": "^2.7.1",
"ts-jest": "^28.0.8",
"typedoc": "^0.23.15",
"typedoc": "^0.25.1",
"typescript": "^4.8.3"
}
}
6 changes: 6 additions & 0 deletions clients/js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@
"sourceMap": true,
"strict": true,
"target": "es6"
},
"typedocOptions": {
"entryPoints": ["src/index.ts"],
"out": "docs/api",
"excludeInternal": true,
"excludePrivate": true
}
}
32 changes: 16 additions & 16 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 bf1c5ef

Please sign in to comment.