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

古びたタスク類を整理 #863

Merged
merged 4 commits into from
Dec 18, 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
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ ictsc-outlands/
├── charts/ (K8デプロイ用Helmチャート)
└── Makefile (全体共通のタスク定義)
└── Taskfile (全体共通のタスク定義)
```

各フォルダ以下に関しては、それぞれのフォルダにある`README.md`を参照して下さい。

## 開発の始め方

`sh init.sh`をすると、`task`のインストールを要求されるのでインストールする。
その後は、`task`コマンドで各種操作を行う。
99 changes: 9 additions & 90 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -1,101 +1,20 @@
version: 3

# タスク定義の順番
#
# 1.
# desc
#
# 2.
# internal
# dir
# silent
#
# 3.
# vars
# status / sources / generates / methods / preconditions
# deps
#
# 4.
# cmds

tasks:
check-binary:
desc: 指定されたバイナリがインストールされているか確認
internal: true
silent: true
cmds:
- |
if ! (type {{.BINARY}} >/dev/null 2>&1); then
echo "下記公式ドキュメントを参考に、{{.BINARY}}をインストールした後、もう一度実行してください"
echo {{.INSTALL_DOC}}
exit 1
fi

init:
desc: ワークスペースを初期化
cmds:
- cp .vscode/settings-sample.json .vscode/settings.json
- cp backend/.vscode/settings-sample.json backend/.vscode/settings.json

init-buf:
desc: bufの初期化
internal: true
deps:
- task: check-binary
vars:
BINARY: buf
INSTALL_DOC: https://buf.build/docs/installation

init-oapi:
desc: OpenAPI Generatorの初期化
internal: true
deps:
- task: check-binary
vars:
BINARY: go
INSTALL_DOC: https://go.dev/doc/install
cmds:
- go install github.com/oapi-codegen/oapi-codegen/v2/cmd/[email protected]

generate:
desc: 自動生成ファイルをすべて生成
cmds:
- rm -rf backend/internal/proto
- task: generate-buf
- task: generate-oapi
- task: generate-backend
- task: generate-frontend

generate-buf:
desc: Protobuf & Connectの自動生成ファイルを生成
generate-backend:
internal: true
dir: proto
deps:
- init-buf
dir: backend
cmds:
- buf generate --template buf.gen-backend.yaml
- go generate -x ./...

generate-oapi:
desc: OpenAPIの自動生成ファイルを生成
generate-frontend:
internal: true
dir: proto
deps:
- init-oapi
cmds:
- for: ["admin", "contestant"]
cmd: |-
mkdir -p ../backend/internal/proto/{{ .ITEM }}/v1/v1oapi
oapi-codegen -package v1oapi -generate chi-server {{ .ITEM }}/v1/file.yaml \
> ../backend/internal/proto/{{ .ITEM }}/v1/v1oapi/file-server.oapi.go
oapi-codegen -package v1oapi -generate client {{ .ITEM }}/v1/file.yaml \
> ../backend/internal/proto/{{ .ITEM }}/v1/v1oapi/file-client.oapi.go

up:
desc: ローカル開発環境を立ち上げる
dir: dev/docker
cmds:
- docker compose up --build -d

down:
desc: ローカル開発環境を終了する
dir: dev/docker
dir: frontend
cmds:
- docker compose down
- pnpm install
- pnpm run --recursive --parallel --aggregate-output generate
3 changes: 0 additions & 3 deletions dev/README.md

This file was deleted.

51 changes: 0 additions & 51 deletions dev/docker/compose.yaml

This file was deleted.

1 change: 0 additions & 1 deletion dev/docker/init.sql

This file was deleted.

8 changes: 0 additions & 8 deletions init.sh

This file was deleted.

24 changes: 24 additions & 0 deletions proto/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Protobuf

フロントエンドとバックエンド間で共有される API 定義

## 構成

- `admin/v1`: 運営用 API
- `contestant/v1`: 競技者用 API

## 開発方法

[Buf](https://buf.build/) を使っています。[Buf CLI のインストール手順](https://buf.build/docs/installation/)に従ってインストールしてください。

### フォーマット

```console
$ buf format -w
```

### リント

```console
$ buf lint
```
Loading