Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: モノレポの整備 #42

Merged
merged 9 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/kcms/renovate.json → .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>poporonnet/renovate-config"]
}
}
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

on:
pull_request:

jobs:
backend_build:
name: "Build & Check (backend)"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Nodejs v20
uses: actions/setup-node@v4

- uses: pnpm/action-setup@v2
with:
version: 9

- name: Cache
uses: actions/cache@v4
with:
path: ~/.cache/install/cache
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-

- name: Install packages
run: pnpm i --frozen-lockfile
- name: Code Check
run: pnpm backend check
- name: Lint
run: pnpm backend lint
- name: Test
run: pnpm backend test

frontend_build:
name: "Build & Check (frontend)"
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install
run: bun install --frozen-lockfile

- name: Lint bun lint
run: bun run --cwd packages/kcmsf lint

- name: Test
run: bun run --cwd packages/kcmsf test:ci
23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "kcmsx",
"private": true,
"author": {
"name": "Poporon Network"
},
"scripts": {
"backend": "pnpm -F \"kcms\"",
"frontend": "pnpm -F \"kcmsf\"",
"start:backend": "pnpm backend start",
"start:frontend": "pnpm frontend start",
"dev:backend": "pnpm backend dev",
"dev:frontend": "pnpm frontend dev",
"format": "pnpm frontend format && pnpm backend format",
"lint": "pnpm frontend lint && pnpm backend lint",
"test:backend": "pnpm backend t",
"test:frontend": "pnpm frontend t"
},
"version": "0.0.1",
"workspaces": [
"packages/*"
]
}
32 changes: 16 additions & 16 deletions packages/kcms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ bun dev

| <img src="https://github.com/laminne.png" width="100px"> | <img src="https://github.com/kiharu3112.png" width="100px"> | <img src="https://github.com/tufusa.png" width="100px"> |
| :------------------------------------------------------: | :---------------------------------------------------------: | :-----------------------------------------------------: |
| **laminne (T. YAMAMOTO)**<br>🔧 🦀 | **kiharu3112**<br>🔧 🦀 | **tufusa**<br>🔧 🦀 |
| **laminne (T. YAMAMOTO)**<br>🔧 🦀 | **kiharu3112**<br>🔧 🦀 | **tufusa**<br>🔧 🦀 |

| <img src="https://github.com/speak-mentaiko.png" width="100px"> | <img src="https://github.com/suzune2741.png" width="100px"> | <img src="https://github.com/C4N4242.png" width="100px"> |
| :------------------------------------------------------: | :---------------------------------------------------------: | :-----------------------------------------------------: |
| **speak-mentaiko**<br>🔧 | **suzune2741**<br>🔧 | **C4N4242**<br>🔧 |
| :-------------------------------------------------------------: | :---------------------------------------------------------: | :------------------------------------------------------: |
| **speak-mentaiko**<br>🔧 | **suzune2741**<br>🔧 | **C4N4242**<br>🔧 |

🔧: KCMS/KCMSFの開発
🦀: 書き込みツール開発
Expand Down Expand Up @@ -176,14 +176,14 @@ body: `application/json`
"id": "30495883404",
"teamName": "ニカ.reverse()",
"isMultiWalk": false,
"category": "Elementary"
"category": "Elementary",
},
{
"id": "93454093",
"teamName": "カニ.reverse()",
"isMultiWalk": false,
"category": "Elementary"
}
"category": "Elementary",
},
],
// 対戦の種類
"matchType": "primary",
Expand All @@ -193,8 +193,8 @@ body: `application/json`
// チームごとのゴール時間(秒)
"time": [50, 61],
// 勝利チームのID
"winnerID": "93454093"
}
"winnerID": "93454093",
},
]
```

Expand Down Expand Up @@ -238,15 +238,15 @@ body: `application/json`
"id": "30495883404",
"teamName": "ニカ.reverse()",
"isMultiWalk": false,
"category": "Elementary"
"category": "Elementary",
},
// コート右側チーム
"right": {
"id": "93454093",
"teamName": "カニ.reverse()",
"isMultiWalk": false,
"category": "Elementary"
}
"category": "Elementary",
},
},
// 対戦の種類
"matchType": "primary",
Expand All @@ -256,20 +256,20 @@ body: `application/json`
"left": {
"teamID": "30495883404",
"points": 0,
"time": 300
"time": 300,
},
// 右チームの結果
"right": {
"teamID": "93454093",
"points": 7,
"time": 60
}
"time": 60,
},
},
// コース番号(0始まり)
"courseIndex": 1,
// 勝利チームのID
"winnerID": "93454093"
}
"winnerID": "93454093",
},
]
```

Expand Down
Binary file removed packages/kcms/bun.lockb
Binary file not shown.
4 changes: 2 additions & 2 deletions packages/kcms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"type": "module",
"main": "main.js",
"scripts": {
"start": "bun ./build/main.js",
"dev": "bun run --hot ./src/main.ts",
"start": "node ./build/main.js",
"dev": "tsx ./src/main.ts",
"build": "esbuild ./src/main.ts --bundle --sourcemap --platform=node --target=node16 --format=esm --packages=external --outfile=build/main.js",
"lint": "eslint --cache 'src/**/**.ts'",
"format": "prettier . --write",
Expand Down
10 changes: 5 additions & 5 deletions packages/kcms/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/*
KCMS - Matz葉ガニロボコン 大会運営支援ツール
(C) 2023 Poporon Network & Other Contributors
(C) 2023-2024 Poporon Network & Other Contributors
MIT License.
*/
import { Hono } from 'hono';
import { serve } from '@hono/node-server';
import { entryHandler } from './entry/main.js';
import { cors } from 'hono/cors';
import { matchHandler } from './match/main.js';
Expand All @@ -14,7 +15,6 @@ app.use('*', cors());
app.route('/entry', entryHandler);
app.route('/match', matchHandler);

export default {
port: 3000,
fetch: app.fetch,
};
serve(app, (p) => {
console.log(`server started at http://${p.address}:${p.port}`);
});
2 changes: 1 addition & 1 deletion packages/kcms/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"moduleResolution": "Node16",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"pretty": true,
"pretty": true
},
"include": ["**/*.ts"],
"exclude": ["node_modules"]
Expand Down
2 changes: 1 addition & 1 deletion packages/kcms/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from 'vite';
import { defineConfig } from 'vitest/config';

export default defineConfig({
define: {
Expand Down
4 changes: 0 additions & 4 deletions packages/kcmsf/renovate.json

This file was deleted.

Loading
Loading