Skip to content

Commit c89e3ce

Browse files
authored
Merge branch 'main' into search
2 parents 018cbc8 + 3d751bc commit c89e3ce

Some content is hidden

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

91 files changed

+2186
-1232
lines changed

.cspell.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"reqwest",
2020
"safify",
2121
"supabase",
22-
"swiper"
22+
"swiper",
23+
"lefthook"
2324
],
2425
"dictionaries": [
2526
"softwareTerms",

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
bun-version: latest
6868

6969
- run: make setup-ci
70-
- run: make spell-check
70+
- run: bunx cspell --quiet .
7171

7272
test:
7373
name: Bun Test
@@ -86,7 +86,7 @@ jobs:
8686
- uses: actions/setup-node@v3
8787
- uses: oven-sh/setup-bun@v2
8888
- run: make prepare-deploy-web
89-
- run: test `ls web/out | wc -l` != 0
89+
- run: test `ls web/.next | wc -l` != 0
9090

9191
deploy-test-server:
9292
name: Deploy Test (server)

.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: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +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
98
@echo "auto setup is done. now do:"
109
@echo "- edit server/.env.dev"
1110
@echo "- edit web/.env"
1211
@echo "- run make sync"
1312

14-
setup-ci:
15-
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
1615
make sync
1716
make generate-sql
1817

19-
sync: sync-server sync-web sync-root copy-common
18+
sync: sync-server sync-web sync-root sync-common
19+
lefthook install || true
2020
@echo '----------------------------------------------------------------------------------------------------------'
2121
@echo '| Most work is done. now running prisma-generate-sql (which might fail if .env.dev is not set configured)|'
2222
@echo '----------------------------------------------------------------------------------------------------------'
@@ -42,17 +42,17 @@ test: dev-db
4242
cd ./test; ENV_FILE=../server/.env.dev bun test
4343
docker stop postgres
4444

45-
prepare-deploy-web: copy-common
45+
prepare-deploy-web: sync-common
4646
cd web; bun install; bun run build
47-
prepare-deploy-server: copy-common sync-server generate-sql
47+
prepare-deploy-server: sync-common sync-server generate-sql
4848
deploy-server:
4949
cd server; bun src/main.ts
5050

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

55-
docker-watch: copy-common
55+
docker-watch:
5656
docker compose up --build --watch
5757

5858
seed:
@@ -80,16 +80,6 @@ dev-db:
8080
@make seed;
8181
@echo "Seeding completed."
8282

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

9585
sync-web:
@@ -103,6 +93,8 @@ sync-server:
10393

10494
sync-root:
10595
bun install --frozen-lockfile
96+
sync-common:
97+
cd common; bun install --frozen-lockfile
10698

10799

108100
# Static checks
@@ -127,7 +119,7 @@ format-check:
127119
@exit 1
128120

129121
# type checks
130-
type-check: copy-common
122+
type-check:
131123
make type-check-server
132124
make type-check-web
133125

@@ -143,9 +135,9 @@ type-check-web:
143135
start-all: build-web build-server
144136
make serve-all
145137

146-
build-web: copy-common-to-web
138+
build-web:
147139
cd web; bun run build
148-
build-server: copy-common-to-server
140+
build-server:
149141
cd server; bun run build
150142

151143
serve-all:
@@ -155,17 +147,9 @@ serve-web:
155147
serve-server:
156148
cd server; bun run serve
157149

158-
watch-web: copy-common-to-web
150+
watch-web:
159151
cd web; bun run dev
160-
watch-server: copy-common-to-server
152+
watch-server:
161153
cd server; bun run dev
162154

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

README.md

Lines changed: 1 addition & 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

bun.lockb

-15 KB
Binary file not shown.

common/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# common
2+
3+
To install dependencies:
4+
5+
```bash
6+
bun install
7+
```
8+
9+
To run:
10+
11+
```bash
12+
bun run index.ts
13+
```
14+
15+
This project was created using `bun init` in bun v1.1.29. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.

common/bun.lockb

3.38 KB
Binary file not shown.

common/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "common",
3+
"type": "module",
4+
"devDependencies": {
5+
"@types/bun": "latest"
6+
},
7+
"peerDependencies": {
8+
"typescript": "^5.0.0"
9+
},
10+
"dependencies": {
11+
"zod": "^3.23.8"
12+
}
13+
}

0 commit comments

Comments
 (0)