Skip to content
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
3 changes: 2 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"reqwest",
"safify",
"supabase",
"swiper"
"swiper",
"lefthook"
],
"dictionaries": [
"softwareTerms",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
bun-version: latest

- run: make setup-ci
- run: make spell-check
- run: bunx cspell --quiet .

test:
name: Bun Test
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ dist-ssr

.env
/.direnv
.husky
1 change: 0 additions & 1 deletion .husky/pre-commit

This file was deleted.

12 changes: 1 addition & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ LOCAL_DB := postgres://user:password@localhost:5432/database
setup:
if [ ! `command -v bun` ]; then echo 'ERR: Bun is required!'; exit 1; fi
make sync
bunx husky
@echo "auto setup is done. now do:"
@echo "- edit server/.env.dev"
@echo "- edit web/.env"
Expand All @@ -17,6 +16,7 @@ setup-ci:
make generate-sql

sync: sync-server sync-web sync-root copy-common
lefthook install || true
@echo '----------------------------------------------------------------------------------------------------------'
@echo '| Most work is done. now running prisma-generate-sql (which might fail if .env.dev is not set configured)|'
@echo '----------------------------------------------------------------------------------------------------------'
Expand Down Expand Up @@ -80,16 +80,6 @@ dev-db:
@make seed;
@echo "Seeding completed."


precommit: check-branch lint-staged spell-check

lint-staged:
bunx lint-staged
check-branch:
@ if [ "$(git branch --show-current)" == "main" ]; then echo "Cannot make commit on main! aborting..."; exit 1; fi
spell-check:
bunx cspell --quiet .

# Sync (install/update packages, generate prisma, etc)

sync-web:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ GNU Make が導入されています。以下は、ユーザーが使うこと
- make setup (セットアップします。)
- make start (build -> serve します。)
- make watch (ホットリロードします。)
- make precommit (type-check, format-check, lint を実行します。husky で自動実行されます。)

### 環境構築

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

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

Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
biome
pkg-config
openssl
lefthook
] ++ [
rust-pkgs
];
shellHook = ''
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.stdenv.cc.cc.lib}/lib
lefthook install
'' + prisma.shellHook;
};
});
Expand Down
16 changes: 16 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Lefthook: Precommit Hook
# docs: https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
# 必須: Lefthook
# 必須: `lefthook install`
pre-commit:
parallel: true
commands:
biome:
glob: "*"
run: biome check --write --no-errors-on-unmatched --files-ignore-unknown=true -- {staged_files}
stage_fixed: true
prevent-commit-on-main:
run: if [ "$(git branch --show-current)" == "main" ]; then echo "Cannot make commit on main! aborting..."; exit 1; fi
cspell:
glob: "*"
run: bunx cspell --quiet -- {staged_files}
8 changes: 1 addition & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,19 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prepare": "husky"
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@biomejs/biome": "^1.9.1",
"husky": "^9.1.4",
"lint-staged": "^15.2.10",
"typescript": "^5.6.2"
},
"dependencies": {
"@types/bun": "^1.1.10",
"cspell": "^8.14.4",
"zod": "^3.23.8"
},
"lint-staged": {
"*.{js,jsx,ts,tsx,json}": ["biome check --write"]
},
"trustedDependencies": ["@biomejs/biome"]
}