Skip to content

Commit dbe8f69

Browse files
committed
merge main
2 parents 9905f2c + 3c0920f commit dbe8f69

File tree

214 files changed

+8290
-4970
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+8290
-4970
lines changed

.cspell.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@
44
"words": [
55
"autoincrement",
66
"bunx",
7+
"chrono",
78
"coursemate",
9+
"daisyui",
810
"datasource",
911
"direnv",
1012
"ECCS",
1113
"isready",
1214
"lockb",
15+
"mytheme",
1316
"notistack",
1417
"psql",
1518
"qiita",
19+
"reqwest",
1620
"safify",
1721
"supabase",
18-
"swiper"
22+
"swiper",
23+
"lefthook"
1924
],
2025
"dictionaries": [
2126
"softwareTerms",
@@ -31,6 +36,7 @@
3136
],
3237
"ignorePaths": [
3338
"flake.*",
39+
"nix/*",
3440
"**/.git/**",
3541
"**/node_modules/**",
3642
"server/target/**",
@@ -39,6 +45,10 @@
3945
"**/bun.lockb",
4046
"**/*.svg",
4147
"**/migration.sql",
42-
"**/data.json"
48+
"**/data.json",
49+
"**/Cargo.*",
50+
"scraper/target",
51+
"**/rust-toolchain.toml",
52+
"web/out"
4353
]
4454
}

.github/pull_request_template.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
1-
<!--変更したい場合は、`/.github/pull_request_template.md` を修正して下さい。-->
21
# PRの概要
32

4-
<!-- 変更の目的 もしくは 関連する Issue 番号 -->
5-
<!-- 以下のように書くと Issue にリンクでき、マージ時に自動で Issue を閉じられる-->
6-
<!-- closes #001 -->
7-
83
## 具体的な変更内容
9-
<!-- ビューの変更がある場合はスクショによる比較などがあるとわかりやすい -->
104

115
## 影響範囲
12-
<!-- この関数を変更したのでこの機能にも影響がある、など -->
136

147
## 動作要件
15-
<!-- 動作に必要な 環境変数 / 依存関係 / DBの更新 など -->
168

179
## 補足
18-
<!-- レビューをする際に見てほしい点、ローカル環境で試す際の注意点、など -->
1910

2011
## レビューリクエストを出す前にチェック!
2112

.github/workflows/ci.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ on:
77

88
env:
99
DATABASE_URL: ${{ secrets.DATABASE_URL_FOR_PRISMA_SQL_GENERATION }}
10+
NEXT_PUBLIC_API_ENDPOINT: "sample"
11+
NEXT_PUBLIC_FIREBASE_API_KEY: "sample"
12+
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: "sample"
13+
NEXT_PUBLIC_FIREBASE_PROJECT_ID: "sample"
14+
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: "sample"
15+
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: "sample"
16+
NEXT_PUBLIC_FIREBASE_APP_ID: "sample"
17+
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: "sample"
1018
jobs:
1119
build:
1220
name: Build
@@ -59,7 +67,7 @@ jobs:
5967
bun-version: latest
6068

6169
- run: make setup-ci
62-
- run: make spell-check
70+
- run: bunx cspell --quiet .
6371

6472
test:
6573
name: Bun Test
@@ -78,7 +86,7 @@ jobs:
7886
- uses: actions/setup-node@v3
7987
- uses: oven-sh/setup-bun@v2
8088
- run: make prepare-deploy-web
81-
- run: test `ls web/dist | wc -l` != 0
89+
- run: test `ls web/.next | wc -l` != 0
8290

8391
deploy-test-server:
8492
name: Deploy Test (server)

.github/workflows/keep-alive.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Keep Alive
22

33
on:
44
schedule:
5-
- cron: "*/5 * * * *"
5+
- cron: "*/2 * * * *"
66
workflow_dispatch:
77

88
env:

.github/workflows/rust.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Rust
2+
on:
3+
pull_request:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
all:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 10
11+
env:
12+
RUSTFLAGS: -D warnings
13+
defaults:
14+
run:
15+
working-directory: scraper
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/cache@v4
19+
with:
20+
path: |
21+
~/.cargo/
22+
~/.rustup/
23+
scraper/target
24+
key: cargo-cache-${{ github.job }}-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
25+
- uses: actions-rust-lang/setup-rust-toolchain@v1
26+
with:
27+
components: clippy,rustfmt
28+
- run: cargo build
29+
- run: cargo build --release
30+
- run: cargo test
31+
- run: cargo clippy
32+
- run: cargo fmt --check

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ dist-ssr
2525

2626
.env
2727
/.direnv
28+
.husky

.husky/pre-commit

Lines changed: 0 additions & 1 deletion
This file was deleted.

Makefile

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,18 @@ LOCAL_DB := postgres://user:password@localhost:5432/database
55
setup:
66
if [ ! `command -v bun` ]; then echo 'ERR: Bun is required!'; exit 1; fi
77
make sync
8-
bunx husky
9-
cd web; if [ ! -f .env ]; then cp ./.env.sample ./.env ; fi
10-
cd server; if [ ! -f .env.dev ]; then cp ./.env.sample ./.env.dev ; fi
118
@echo "auto setup is done. now do:"
129
@echo "- edit server/.env.dev"
1310
@echo "- edit web/.env"
1411
@echo "- run make sync"
1512

16-
setup-ci:
17-
if [ ${DATABASE_URL} == "" ]; then echo 'Please set DATABASE_URL_FOR_SQL_GENERATION!'; exit 1; fi
13+
setup-ci:
14+
if [ "" == ${DATABASE_URL} ]; then echo 'Please set DATABASE_URL_FOR_SQL_GENERATION!'; exit 1; fi
1815
make sync
1916
make generate-sql
2017

21-
sync: sync-server sync-web sync-root copy-common
18+
sync: sync-server sync-web sync-root sync-common
19+
bunx lefthook install || true
2220
@echo '----------------------------------------------------------------------------------------------------------'
2321
@echo '| Most work is done. now running prisma-generate-sql (which might fail if .env.dev is not set configured)|'
2422
@echo '----------------------------------------------------------------------------------------------------------'
@@ -38,23 +36,23 @@ test: export DATABASE_URL=$(LOCAL_DB)
3836
test: export NEVER_LOAD_DOTENV=1
3937
test: export UNSAFE_SKIP_AUTH=1
4038
test: export FIREBASE_PROJECT_ID=mock-proj
39+
test: export CORS_ALLOW_ORIGINS=http://localhost:3000,https://localhost:5173
4140
test: dev-db
4241
cd server/src; ENV_FILE=../.env.dev bun test
4342
cd ./test; ENV_FILE=../server/.env.dev bun test
4443
docker stop postgres
4544

46-
prepare-deploy-web: copy-common
45+
prepare-deploy-web: sync-common
4746
cd web; bun install; bun run build
48-
prepare-deploy-server: copy-common
49-
cd server; bun install; npx prisma generate;
47+
prepare-deploy-server: sync-common sync-server generate-sql
5048
deploy-server:
51-
cd server; bun src/index.ts
49+
cd server; bun src/main.ts
5250

53-
docker: copy-common
51+
docker:
5452
@# deferring `docker compose down`. https://qiita.com/KEINOS/items/532dc395fe0f89c2b574
5553
trap 'docker compose down' EXIT; docker compose up --build
5654

57-
docker-watch: copy-common
55+
docker-watch:
5856
docker compose up --build --watch
5957

6058
seed:
@@ -82,29 +80,21 @@ dev-db:
8280
@make seed;
8381
@echo "Seeding completed."
8482

85-
86-
precommit: check-branch lint-staged spell-check
87-
88-
lint-staged:
89-
bunx lint-staged
90-
check-branch:
91-
@ if [ "$(git branch --show-current)" == "main" ]; then echo "Cannot make commit on main! aborting..."; exit 1; fi
92-
spell-check:
93-
bunx cspell --quiet .
94-
9583
# Sync (install/update packages, generate prisma, etc)
9684

9785
sync-web:
98-
cd web; bun install
86+
cd web; bun install --frozen-lockfile
9987
# copy .env.sample -> .env only if .env is not there
10088

10189
sync-server:
102-
cd server; bun install
90+
cd server; bun install --frozen-lockfile
10391
cd server; bunx prisma generate
10492
# copy .env.sample -> .env only if .env is not there
10593

10694
sync-root:
107-
bun install
95+
bun install --frozen-lockfile
96+
sync-common:
97+
cd common; bun install --frozen-lockfile
10898

10999

110100
# Static checks
@@ -129,7 +119,7 @@ format-check:
129119
@exit 1
130120

131121
# type checks
132-
type-check: copy-common
122+
type-check:
133123
make type-check-server
134124
make type-check-web
135125

@@ -145,9 +135,9 @@ type-check-web:
145135
start-all: build-web build-server
146136
make serve-all
147137

148-
build-web: copy-common-to-web
138+
build-web:
149139
cd web; bun run build
150-
build-server: copy-common-to-server
140+
build-server:
151141
cd server; bun run build
152142

153143
serve-all:
@@ -157,17 +147,9 @@ serve-web:
157147
serve-server:
158148
cd server; bun run serve
159149

160-
watch-web: copy-common-to-web
150+
watch-web:
161151
cd web; bun run dev
162-
watch-server: copy-common-to-server
152+
watch-server:
163153
cd server; bun run dev
164154

165-
copy-common: copy-common-to-server copy-common-to-web
166-
copy-common-to-server:
167-
@ if [ -d server/src/common ]; then rm -r server/src/common; fi
168-
@ cp -r common server/src/common
169-
copy-common-to-web:
170-
@ if [ -d web/src/common ]; then rm -r web/src/common; fi
171-
@ cp -r common web/src/common
172-
173155
.PHONY: test

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ GNU Make が導入されています。以下は、ユーザーが使うこと
1313
- make setup (セットアップします。)
1414
- make start (build -> serve します。)
1515
- make watch (ホットリロードします。)
16-
- make precommit (type-check, format-check, lint を実行します。husky で自動実行されます。)
1716

1817
### 環境構築
1918

@@ -27,6 +26,7 @@ GNU Make が導入されています。以下は、ユーザーが使うこと
2726
- Bun (js)
2827
- GNU Make
2928
- nvm (optional)
29+
- lefthook
3030

3131
- `make setup` を実行します。
3232

@@ -59,3 +59,18 @@ make docker
5959
# または
6060
make docker-watch
6161
```
62+
63+
## Deploy
64+
65+
web:
66+
```sh
67+
NEXT_PUBLIC_ALLOW_ANY_MAIL_ADDR=true # optional
68+
make prepare-deploy-web`
69+
# serve ./web/dist
70+
```
71+
72+
server:
73+
```sh
74+
make prepare-deploy-server
75+
make deploy-server
76+
```

biome.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,28 @@
44
"indentStyle": "space",
55
"indentWidth": 2
66
},
7+
"linter": {
8+
"rules": {
9+
"nursery": {
10+
"useSortedClasses": "warn"
11+
}
12+
}
13+
},
714
"vcs": {
815
"enabled": true,
916
"clientKind": "git",
1017
"useIgnoreFile": true
1118
},
1219
"files": {
13-
"ignore": ["bun.lockb", "server/target", "data.json"]
20+
"ignore": [
21+
"bun.lockb",
22+
"server/target",
23+
"data.json",
24+
"scraper/target",
25+
".next",
26+
"next-env.d.ts",
27+
"out",
28+
"package-lock.json"
29+
]
1430
}
1531
}

0 commit comments

Comments
 (0)