Skip to content

Commit 021a626

Browse files
Merge pull request #43 from NYCU-SDC/feat/CORE-169-Create-SDK
[CORE-169] Orval sdk generation
2 parents 5c784db + 61b41a5 commit 021a626

23 files changed

Lines changed: 4243 additions & 1185 deletions

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
## Type of changes
2+
23
- Feature/Fix/Docs/Refactor/CI/Test/Chore
34

45
## Purpose
6+
57
- Add XXX
68
- Resolve issue #XXX
79

.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
Build:
12+
name: Build test
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repo
16+
uses: actions/checkout@v4
17+
18+
- name: Setup pnpm
19+
uses: pnpm/action-setup@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 24
25+
26+
- name: Install dependencies
27+
run: pnpm install --frozen-lockfile
28+
29+
- name: Test Compile OpenAPI
30+
run: pnpm compile:openapi
31+
32+
Format:
33+
name: Check formatting with Prettier
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@v4
38+
39+
- name: Setup pnpm
40+
uses: pnpm/action-setup@v4
41+
42+
- name: Set up Node.js
43+
uses: actions/setup-node@v4
44+
with:
45+
node-version: 24
46+
47+
- name: Install dependencies
48+
run: pnpm install --frozen-lockfile
49+
50+
- name: Run Prettier check
51+
run: pnpm prettier --check .

.github/workflows/deploy.yml

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,51 @@
11
name: Deploy API docs
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
88

99
jobs:
10-
deploy:
11-
name: Deploy API docs
12-
runs-on: ubuntu-latest
13-
permissions:
14-
contents: write
15-
steps:
16-
- name: Checkout repo
17-
uses: actions/checkout@v4
18-
19-
- name: Setup pnpm
20-
uses: pnpm/action-setup@v4
21-
22-
- name: Setup Node.js
23-
uses: actions/setup-node@v4
24-
with:
25-
node-version: 22
26-
27-
- name: Install dependencies
28-
run: pnpm install --frozen-lockfile
29-
30-
- name: Build
31-
run: |
32-
pnpm build
33-
34-
- name: Generate Redocly and Swagger UI
35-
run: |
36-
npm i -g @redocly/cli@latest
37-
redocly build-docs tsp-output/schema/openapi.1.0.0.yaml --output redocly.html
38-
39-
- name: Move files
40-
run: |
41-
mkdir -p publish/tsp-output/schema
42-
mv tsp-output/schema/openapi.1.0.0.yaml publish/tsp-output/schema/openapi.1.0.0.yaml
43-
mv index.html publish/index.html
44-
mv swagger.html publish/swagger.html
45-
mkdir -p publish/redocly
46-
mv redocly.html publish/redocly/index.html
47-
48-
- name: Deploy to GitHub Pages
49-
uses: peaceiris/actions-gh-pages@v4
50-
with:
51-
github_token: ${{ secrets.GITHUB_TOKEN }}
52-
publish_dir: ./publish
10+
deploy:
11+
name: Deploy API docs
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
steps:
16+
- name: Checkout repo
17+
uses: actions/checkout@v4
18+
19+
- name: Setup pnpm
20+
uses: pnpm/action-setup@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 24
26+
27+
- name: Install dependencies
28+
run: pnpm install --frozen-lockfile
29+
30+
- name: Build Open API
31+
run: pnpm compile:openapi
32+
33+
- name: Copy OpenAPI spec
34+
run: |
35+
mkdir -p website/tsp-output/schema
36+
cp tsp-output/schema/openapi.1.0.0.yaml website/tsp-output/schema/openapi.1.0.0.yaml
37+
38+
- name: Generate Redocly and Swagger UI
39+
run: pnpm build:redocly
40+
41+
- name: Generate Typedoc documentation
42+
run: |
43+
pnpm build:sdk
44+
pnpm compile:sdk
45+
pnpm build:typedoc
46+
47+
- name: Deploy to GitHub Pages
48+
uses: peaceiris/actions-gh-pages@v4
49+
with:
50+
github_token: ${{ secrets.GITHUB_TOKEN }}
51+
publish_dir: ./website

.github/workflows/sdk.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Release SDK
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
id-token: write
10+
contents: write
11+
packages: write
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Setup pnpm
24+
uses: pnpm/action-setup@v4
25+
with:
26+
version: 9
27+
28+
- name: Setup Node
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 24
32+
cache: pnpm
33+
registry-url: https://registry.npmjs.org
34+
35+
- name: Install deps
36+
run: pnpm install --frozen-lockfile
37+
38+
- name: Generate OpenAPI
39+
run: pnpm compile:openapi
40+
41+
- name: Generate SDK
42+
run: pnpm build:sdk
43+
44+
- name: Build SDK
45+
run: pnpm compile:sdk
46+
47+
- name: Bump version (patch)
48+
working-directory: packages/sdk
49+
run: |
50+
git config user.name "github-actions[bot]"
51+
git config user.email "github-actions[bot]@users.noreply.github.com"
52+
npm version patch
53+
54+
- name: Push version commit & tag
55+
run: git push --follow-tags
56+
57+
- name: Publish to npm
58+
working-directory: packages/sdk
59+
run: pnpm publish --access public --no-git-checks

.gitignore

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@ yaak/
66

77
# Default TypeSpec output
88
tsp-output/
9-
dist/
9+
10+
# Generated documentation
11+
website/tsp-output/
12+
website/sdk/
13+
website/redocly/
1014

1115
# Dependency directories
12-
node_modules/
16+
node_modules/
17+
18+
# Orval generated files
19+
packages/sdk/src/generated/
20+
21+
# Built SDK package
22+
packages/sdk/dist/

.prettierrc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"printWidth": 200,
3+
"tabWidth": 2,
4+
"useTabs": true,
5+
"semi": true,
6+
"singleQuote": false,
7+
"trailingComma": "none",
8+
"bracketSpacing": true,
9+
"arrowParens": "avoid",
10+
"requirePragma": false,
11+
"insertPragma": false,
12+
"proseWrap": "never",
13+
"endOfLine": "lf",
14+
"htmlWhitespaceSensitivity": "ignore",
15+
"embeddedLanguageFormatting": "auto",
16+
"quoteProps": "as-needed",
17+
"jsxSingleQuote": false,
18+
"singleAttributePerLine": false,
19+
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-packagejson", "prettier-plugin-packagejson"],
20+
"overrides": [
21+
{
22+
"files": "*.astro",
23+
"options": {
24+
"parser": "astro"
25+
}
26+
}
27+
]
28+
}

0 commit comments

Comments
 (0)