From f094c667ce1ec33b1506670a025738f74dc9944c Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Sat, 15 Feb 2025 15:15:27 +0900 Subject: [PATCH 1/9] github/workflows: create build --- .github/workflows/build.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..62f9a0dc --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ +name: build +on: + pull_request: + push: + branches: + - main +jobs: + web: + name: Web + runs-on: ubuntu-latest + timeout-minutes: 10 + defaults: + run: + working-directory: web + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + with: + bun-version: 1.2.2 + - run: bun install --frozen-lockfile + - run: bun run build + server: + name: Server + runs-on: ubuntu-latest + timeout-minutes: 10 + defaults: + run: + working-directory: server + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + with: + bun-version: 1.2.2 + - run: bun install --frozen-lockfile + - run: bun run build From 1953a0a819a331312d0c700e69ad1dda94a1b96d Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Sat, 15 Feb 2025 15:21:33 +0900 Subject: [PATCH 2/9] fix: make server.build run --- server/bun.lock | 12 ++---------- server/package.json | 5 +++-- server/tsconfig.json | 6 +++++- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/server/bun.lock b/server/bun.lock index 25f5f3c3..9934f5fa 100644 --- a/server/bun.lock +++ b/server/bun.lock @@ -7,21 +7,13 @@ "hono": "^4.7.1", }, "devDependencies": { - "@types/bun": "latest", + "typescript": "^5.7.3", }, }, }, "packages": { - "@types/bun": ["@types/bun@1.2.2", "", { "dependencies": { "bun-types": "1.2.2" } }, "sha512-tr74gdku+AEDN5ergNiBnplr7hpDp3V1h7fqI2GcR/rsUaM39jpSeKH0TFibRvU0KwniRx5POgaYnaXbk0hU+w=="], - - "@types/node": ["@types/node@22.13.4", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-ywP2X0DYtX3y08eFVx5fNIw7/uIv8hYUKgXoK8oayJlLnKcRfEYCxWMVE1XagUdVtCJlZT1AU4LXEABW+L1Peg=="], - - "@types/ws": ["@types/ws@8.5.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw=="], - - "bun-types": ["bun-types@1.2.2", "", { "dependencies": { "@types/node": "*", "@types/ws": "~8.5.10" } }, "sha512-RCbMH5elr9gjgDGDhkTTugA21XtJAy/9jkKe/G3WR2q17VPGhcquf9Sir6uay9iW+7P/BV0CAHA1XlHXMAVKHg=="], - "hono": ["hono@4.7.1", "", {}, "sha512-V3eWoPkBxoNgFCkSc5Y5rpLF6YoQQx1pkYO4qrF6YfOw8RZbujUNlJLZCxh0z9gZct70+je2Ih7Zrdpv21hP9w=="], - "undici-types": ["undici-types@6.20.0", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="], + "typescript": ["typescript@5.7.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw=="], } } diff --git a/server/package.json b/server/package.json index f1be7b1c..4981d75f 100644 --- a/server/package.json +++ b/server/package.json @@ -1,12 +1,13 @@ { "name": "server", "scripts": { - "dev": "bun run --env-file=../.env --hot index.ts" + "dev": "bun run --env-file=../.env --hot index.ts", + "build": "bun tsc" }, "dependencies": { "hono": "^4.7.1" }, "devDependencies": { - "@types/bun": "latest" + "typescript": "^5.7.3" } } diff --git a/server/tsconfig.json b/server/tsconfig.json index 9136c143..fbd35d2d 100644 --- a/server/tsconfig.json +++ b/server/tsconfig.json @@ -1,7 +1,11 @@ { "compilerOptions": { + "target": "es2015", + "module": "nodenext", + "moduleResolution": "nodenext", "strict": true, "jsx": "react-jsx", - "jsxImportSource": "hono/jsx" + "jsxImportSource": "hono/jsx", + "noEmit": true } } From fdf66091d84a63da33a31050385d987ee909fee6 Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Sat, 15 Feb 2025 15:24:32 +0900 Subject: [PATCH 3/9] stricter tsconfig for server --- server/index.ts | 2 +- server/tsconfig.json | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/server/index.ts b/server/index.ts index a2cab628..ecc6d833 100644 --- a/server/index.ts +++ b/server/index.ts @@ -1,4 +1,4 @@ -import { Context, Hono, Next } from "hono"; +import { Hono } from "hono"; import cors from "./middlewares/cors"; import hello from "./routes/hello"; diff --git a/server/tsconfig.json b/server/tsconfig.json index fbd35d2d..ad305cf0 100644 --- a/server/tsconfig.json +++ b/server/tsconfig.json @@ -3,9 +3,15 @@ "target": "es2015", "module": "nodenext", "moduleResolution": "nodenext", - "strict": true, "jsx": "react-jsx", "jsxImportSource": "hono/jsx", - "noEmit": true + "noEmit": true, + "skipLibCheck": true, + "allowImportingTsExtensions": true, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true } } From d4b2f8e3a15cae7723d25be510ca61b6955f845b Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Sat, 15 Feb 2025 15:28:55 +0900 Subject: [PATCH 4/9] script: add check, check:fix, and build at root --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index fb24d62b..5f96f175 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,9 @@ "scripts": { "prepare": "lefthook install", "dev": "bun --env-file=./.env :dev", - ":dev": "trap 'kill 0' EXIT; (cd web && bun dev) & (cd server && bun dev) & wait" + ":dev": "trap 'kill 0' EXIT; (cd web && bun dev) & (cd server && bun dev) & wait", + "check:fix": "bun biome check . --fix --unsafe", + "check": "bun biome check .", + "build": "(cd web && bun run build) && (cd server && bun run build)" } } From 1fb1a492d93a42af4136bf202cf18737886d9f3a Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Sat, 15 Feb 2025 15:30:20 +0900 Subject: [PATCH 5/9] action: fix build --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 62f9a0dc..87d530c6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,5 +31,7 @@ jobs: - uses: oven-sh/setup-bun@v2 with: bun-version: 1.2.2 + - run: bun install --frozen-lockfile + working-directory: server - run: bun install --frozen-lockfile - run: bun run build From b9164c229d3944d6cabdd66e73b74adb6ad84b8d Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Sat, 15 Feb 2025 15:32:44 +0900 Subject: [PATCH 6/9] script: add clean --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 5f96f175..2f2a7c6d 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ ":dev": "trap 'kill 0' EXIT; (cd web && bun dev) & (cd server && bun dev) & wait", "check:fix": "bun biome check . --fix --unsafe", "check": "bun biome check .", - "build": "(cd web && bun run build) && (cd server && bun run build)" + "build": "(cd web && bun run build) && (cd server && bun run build)", + "clean": "rm -r node_modules && rm -r **/node_modules && rm web/dist -r" } } From b8b5f5652f8bc6a2051eca9978ea934dfb1826a1 Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Sat, 15 Feb 2025 15:33:31 +0900 Subject: [PATCH 7/9] fix(actions): fix build --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 87d530c6..16e637d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,6 +17,8 @@ jobs: - uses: oven-sh/setup-bun@v2 with: bun-version: 1.2.2 + - run: bun install --frozen-lockfile + working-directory: server - run: bun install --frozen-lockfile - run: bun run build server: @@ -31,7 +33,5 @@ jobs: - uses: oven-sh/setup-bun@v2 with: bun-version: 1.2.2 - - run: bun install --frozen-lockfile - working-directory: server - run: bun install --frozen-lockfile - run: bun run build From 3eff7cb2887d5aa3df669523150f36f493639ac6 Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Sat, 15 Feb 2025 15:34:44 +0900 Subject: [PATCH 8/9] fix: biome failing to detect web/.gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c2f88b6f..3a053dfe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules /.env +web/dist # Nix + Direnv /.direnv From f758f0b9bd1fb828d7ae4c8dd2c810488b7656ac Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Sat, 15 Feb 2025 15:35:44 +0900 Subject: [PATCH 9/9] script: add build in check --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2f2a7c6d..71f0630d 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "prepare": "lefthook install", "dev": "bun --env-file=./.env :dev", ":dev": "trap 'kill 0' EXIT; (cd web && bun dev) & (cd server && bun dev) & wait", - "check:fix": "bun biome check . --fix --unsafe", - "check": "bun biome check .", + "check:fix": "bun biome check . --fix --unsafe && bun run build", + "check": "bun biome check . && bun run build", "build": "(cd web && bun run build) && (cd server && bun run build)", "clean": "rm -r node_modules && rm -r **/node_modules && rm web/dist -r" }