Skip to content

Commit 61b41a5

Browse files
core: add prettier
1 parent bf898dc commit 61b41a5

14 files changed

Lines changed: 2101 additions & 1910 deletions

File tree

.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/sdk.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ jobs:
2020
with:
2121
fetch-depth: 0
2222

23+
- name: Setup pnpm
24+
uses: pnpm/action-setup@v4
25+
with:
26+
version: 9
27+
2328
- name: Setup Node
2429
uses: actions/setup-node@v4
2530
with:
2631
node-version: 24
2732
cache: pnpm
2833
registry-url: https://registry.npmjs.org
2934

30-
- name: Setup pnpm
31-
uses: pnpm/action-setup@v4
32-
with:
33-
version: 9
34-
3535
- name: Install deps
3636
run: pnpm install --frozen-lockfile
3737

.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+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Compiles TypeSpec files to OpenAPI specification and applies patches. Output wil
4545
pnpm build:yaak
4646
```
4747

48-
Generates Yaak API collection from the OpenAPI specification.
48+
Generates Yaak API collection from the OpenAPI specification.
4949

5050
> **Note:** You must run `pnpm compile:openapi` before building Yaak collection.
5151

package.json

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
{
22
"name": "core-system-api",
33
"version": "1.0.0",
4+
"private": true,
45
"description": "Core System API defined using TypeSpec",
56
"author": "NYCU SDC",
6-
"private": true,
77
"type": "module",
8-
"packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34",
98
"scripts": {
9+
"build:redocly": "redocly build-docs tsp-output/schema/openapi.1.0.0.yaml --output website/redocly/index.html",
10+
"build:sdk": "orval --config orval.config.js",
11+
"build:typedoc": "typedoc --entryPoints packages/sdk/src/index.ts --out website/sdk --tsconfig packages/sdk/tsconfig.json --plugin typedoc-rhineai-theme",
12+
"build:yaak": "node scripts/generate-yaak.js",
1013
"clean": "rm -rf tsp-output yaak packages/sdk/src/generated packages/sdk/docs",
11-
"format": "tsp format **/*.tsp",
1214
"compile:openapi": "tsp compile . && node scripts/patch-openapi.js",
13-
"build:yaak": "node scripts/generate-yaak.js",
14-
"build:sdk": "orval --config orval.config.js",
1515
"compile:sdk": "pnpm --filter @nycu-sdc/core-system-sdk run build",
16-
"start:mock": "pnpm exec prism mock tsp-output/schema/openapi.1.0.0.yaml --port 4010 --host 0.0.0.0",
17-
"build:redocly": "redocly build-docs tsp-output/schema/openapi.1.0.0.yaml --output website/redocly/index.html",
18-
"build:typedoc": "typedoc --entryPoints packages/sdk/src/index.ts --out website/sdk --tsconfig packages/sdk/tsconfig.json --plugin typedoc-rhineai-theme"
16+
"format": "prettier --write .",
17+
"start:mock": "pnpm exec prism mock tsp-output/schema/openapi.1.0.0.yaml --port 4010 --host 0.0.0.0"
1918
},
2019
"dependencies": {
2120
"@redocly/cli": "^2.15.0",
21+
"orval": "^8.1.0",
2222
"typedoc": "^0.28.16",
23-
"typedoc-rhineai-theme": "^1.2.0",
24-
"orval": "^8.1.0"
23+
"typedoc-rhineai-theme": "^1.2.0"
2524
},
2625
"devDependencies": {
27-
"js-yaml": "^4.1.0",
26+
"@stoplight/prism-cli": "^5.14.2",
2827
"@typespec/compiler": "^1.4.0",
2928
"@typespec/http": "^1.4.0",
3029
"@typespec/openapi3": "^1.4.0",
3130
"@typespec/rest": "^0.74.0",
3231
"@typespec/versioning": "^0.74.0",
33-
"@stoplight/prism-cli": "^5.14.2"
34-
}
32+
"js-yaml": "^4.1.0",
33+
"prettier": "^3.8.1",
34+
"prettier-plugin-organize-imports": "^4.3.0",
35+
"prettier-plugin-packagejson": "^3.0.0"
36+
},
37+
"packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34"
3538
}

packages/sdk/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
22
"name": "@nycu-sdc/core-system-sdk",
33
"version": "0.1.4",
4-
"author": {
5-
"name": "NYCU SDC",
6-
"email": "contact@sdc.nycu.club",
7-
"url": "https://sdc.nycu.club"
8-
},
9-
"license": "Apache-2.0",
4+
"private": false,
5+
"description": "Auto-generated SDK from TypeSpec / OpenAPI",
106
"repository": {
117
"type": "git",
128
"url": "https://github.com/NYCU-SDC/core-system-api.git",
139
"directory": "packages/sdk"
1410
},
15-
"description": "Auto-generated SDK from TypeSpec / OpenAPI",
16-
"private": false,
11+
"license": "Apache-2.0",
12+
"author": {
13+
"name": "NYCU SDC",
14+
"email": "contact@sdc.nycu.club",
15+
"url": "https://sdc.nycu.club"
16+
},
1717
"main": "dist/index.js",
1818
"types": "dist/index.d.ts",
1919
"files": [

packages/sdk/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export * from './generated'
1+
export * from "./generated";
22

33
// Re-export specific models
4-
export { AuthOAuthProviders } from './generated/model/authOAuthProviders'
4+
export { AuthOAuthProviders } from "./generated/model/authOAuthProviders";

packages/sdk/tsconfig.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
{
2-
"compilerOptions": {
3-
"target": "ES2019",
4-
"lib": ["ES2019", "DOM"],
5-
"useDefineForClassFields": true,
2+
"compilerOptions": {
3+
"target": "ES2019",
4+
"lib": ["ES2019", "DOM"],
5+
"useDefineForClassFields": true,
66

7-
"module": "ESNext",
8-
"moduleResolution": "Bundler",
7+
"module": "ESNext",
8+
"moduleResolution": "Bundler",
99

10-
"rootDir": "src",
11-
"outDir": "dist",
12-
"declaration": true,
13-
"declarationMap": true,
14-
"emitDeclarationOnly": false,
15-
"sourceMap": true,
10+
"rootDir": "src",
11+
"outDir": "dist",
12+
"declaration": true,
13+
"declarationMap": true,
14+
"emitDeclarationOnly": false,
15+
"sourceMap": true,
1616

17-
"strict": true,
18-
"exactOptionalPropertyTypes": true,
19-
"noUncheckedIndexedAccess": true,
17+
"strict": true,
18+
"exactOptionalPropertyTypes": true,
19+
"noUncheckedIndexedAccess": true,
2020

21-
"skipLibCheck": true,
22-
"forceConsistentCasingInFileNames": true
23-
},
24-
"include": ["src"]
21+
"skipLibCheck": true,
22+
"forceConsistentCasingInFileNames": true
23+
},
24+
"include": ["src"]
2525
}

0 commit comments

Comments
 (0)