Skip to content

Commit

Permalink
Add typedoc (#439)
Browse files Browse the repository at this point in the history
Co-authored-by: Seam Bot <[email protected]>
  • Loading branch information
razor-x and seambot authored Sep 6, 2023
1 parent 0b90aaa commit 95ff327
Show file tree
Hide file tree
Showing 10 changed files with 596 additions and 415 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,30 @@ jobs:
AWS_S3_ENDPOINT: https://${{ vars.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
SOURCE_DIR: package
DEST_DIR: v/${{ steps.version.outputs.result }}
docs:
name: Docs
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Build docs
run: npm run docs:build
- name: Get version
uses: actions/github-script@v6
id: version
with:
result-encoding: string
script: return context.ref.split('/')[2].slice(1)
- name: Sync to R2
uses: jakejarvis/[email protected]
env:
AWS_S3_BUCKET: ${{ vars.CLOUDFLARE_R2_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ vars.CLOUDFLARE_R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ vars.CLOUDFLARE_R2_BUCKET_REGION }}
AWS_S3_ENDPOINT: https://${{ vars.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
SOURCE_DIR: docs
DEST_DIR: v/${{ steps.version.outputs.result }}/docs
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ refreshing data, and performing actions.
- Play with the components live in the interactive [Storybook](https://react.seam.co/)!
- See how the components work with a real Seam sandbox workspace in this [live example app](https://react.seam.co/examples/basic/).
- Clone a [sample app in your preferred framework](https://github.com/seamapi/seam-components-sample-apps).
- [Versioned API reference documentation generated by TypeDoc](https://react.seam.co/v/1.52.1/docs/api-docs).

### Live Examples

Expand Down
929 changes: 520 additions & 409 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"docs:start": "concurrently --raw --kill-others npm:examples:storybook npm:storybook:docs",
"docs:build": "storybook build --docs --output-dir docs",
"predocs:build": "npm run examples:build",
"postdocs:build": "typedoc",
"typecheck": "tsc",
"test": "jest --collect-coverage",
"test:update": "jest --updateSnapshot",
Expand Down Expand Up @@ -182,6 +183,7 @@
"tsc-alias": "^1.8.5",
"tsconfig-paths-webpack-plugin": "^4.0.1",
"tsx": "^3.12.7",
"typedoc": "^0.25.1",
"typescript": "~5.1.0",
"vite": "^4.2.1",
"vite-tsconfig-paths": "^4.0.8",
Expand Down
12 changes: 6 additions & 6 deletions src/lib/seam/SeamProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ declare global {

export interface SeamContext {
client: Seam | null
clientOptions?: AllowedSeamClientOptions | undefined
clientOptions?: SeamProviderClientOptions | undefined
publishableKey?: string | undefined
userIdentifierKey?: string | undefined
clientSessionToken?: string | undefined
Expand All @@ -36,14 +36,14 @@ export interface SeamProviderPropsWithClient extends SeamProviderBaseProps {

export interface SeamProviderPropsWithPublishableKey
extends SeamProviderBaseProps,
AllowedSeamClientOptions {
SeamProviderClientOptions {
publishableKey: string
userIdentifierKey?: string
}

export interface SeamProviderPropsWithClientSessionToken
extends SeamProviderBaseProps,
AllowedSeamClientOptions {
SeamProviderClientOptions {
clientSessionToken: string
}

Expand All @@ -54,7 +54,7 @@ interface SeamProviderBaseProps extends PropsWithChildren {
queryClient?: QueryClient | undefined
}

type AllowedSeamClientOptions = Pick<SeamClientOptions, 'endpoint'>
export type SeamProviderClientOptions = Pick<SeamClientOptions, 'endpoint'>

const defaultQueryClient = new QueryClient()

Expand Down Expand Up @@ -172,7 +172,7 @@ const isSeamProviderPropsWithClient = (

const isSeamProviderPropsWithPublishableKey = (
props: SeamProviderProps
): props is SeamProviderPropsWithPublishableKey & AllowedSeamClientOptions => {
): props is SeamProviderPropsWithPublishableKey & SeamProviderClientOptions => {
if (!('publishableKey' in props)) return false

const { publishableKey } = props
Expand All @@ -196,7 +196,7 @@ const isSeamProviderPropsWithPublishableKey = (
const isSeamProviderPropsWithClientSessionToken = (
props: SeamProviderProps
): props is SeamProviderPropsWithClientSessionToken &
AllowedSeamClientOptions => {
SeamProviderClientOptions => {
if (!('clientSessionToken' in props)) return false

const { clientSessionToken } = props
Expand Down
1 change: 1 addition & 0 deletions src/lib/seam/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export * from './AccessCodeDetails/AccessCodeDetails.js'
export * from './AccessCodeTable/AccessCodeTable.js'
export * from './ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.js'
export * from './ClimateSettingScheduleTable/ClimateSettingScheduleTable.js'
export * from './common-props.js'
export * from './ConnectAccountButton/ConnectAccountButton.js'
export * from './DeviceDetails/DeviceDetails.js'
export * from './DeviceTable/DeviceTable.js'
Expand Down
1 change: 1 addition & 0 deletions src/lib/seam/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ export * from './SeamProvider.js'
export * from './thermostats/climate-setting-schedules/use-climate-setting-schedule.js'
export * from './thermostats/climate-setting-schedules/use-climate-setting-schedules.js'
export * from './use-seam-client.js'
export * from './use-seam-query-result.js'
1 change: 1 addition & 0 deletions src/stories/Introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ refreshing data, and performing actions.
- Play with the components live in the interactive [Storybook](https://react.seam.co/)!
- See how the components work with a real Seam sandbox workspace in this [live example app](https://react.seam.co/examples/basic/).
- Clone a [sample app in your preferred framework](https://github.com/seamapi/seam-components-sample-apps).
- <a href='/api-docs/'>API reference documentation generated by TypeDoc</a>

## Live Examples

Expand Down
10 changes: 10 additions & 0 deletions typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://typedoc.org/schema.json",
"includeVersion": true,
"entryPoints": ["src/index.ts", "src/hooks.ts"],
"out": "docs/api-docs",
"tsconfig": "./tsconfig.build.json",
"navigationLinks": {
"GitHub": "https://github.com/seamapi/react"
}
}
27 changes: 27 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,33 @@
"value": "default-src 'self'; connect-src 'self' https://connect.getseam.com; img-src 'self' https://connect.getseam.com https://seam.co https://www.seam.co; font-src 'self' https://fonts.gstatic.com; style-src 'self' https://fonts.googleapis.com"
}
]
},
{
"source": "/v/(.*)/docs",
"headers": [
{
"key": "Content-Security-Policy",
"value": "default-src 'self'; script-src 'self' 'nonce-storybook'; connect-src 'self' https://connect.getseam.com; img-src 'self' https://connect.getseam.com https://seam.co https://www.seam.co https://img.shields.io https://github.com; font-src 'self' https://fonts.gstatic.com; style-src 'self' 'unsafe-inline' http://fonts.googleapis.com"
}
]
},
{
"source": "/v/(.*)/docs/api-docs",
"headers": [
{
"key": "Content-Security-Policy",
"value": "default-src 'self'; script-src 'self' 'unsafe-inline'; connect-src 'self' data:; img-src 'self' https://img.shields.io https://github.com; style-src 'self' 'unsafe-inline'"
}
]
},
{
"source": "/api-docs/(.*)",
"headers": [
{
"key": "Content-Security-Policy",
"value": "default-src 'self'; script-src 'self' 'unsafe-inline'; connect-src 'self' data:; img-src 'self' https://img.shields.io https://github.com; style-src 'self' 'unsafe-inline'"
}
]
}
]
}

0 comments on commit 95ff327

Please sign in to comment.