From 31145735aa263382f63190665ad2188297934edf Mon Sep 17 00:00:00 2001 From: sripwoud Date: Tue, 18 Feb 2025 10:13:32 +0100 Subject: [PATCH] feat: replace `lefthook` by `hk` --- .lefthook.yml | 13 ------------- README.md | 32 ++++++++++++++++---------------- hk.pkl | 17 +++++++++++++++++ mise.toml | 2 ++ setup | 2 +- 5 files changed, 36 insertions(+), 30 deletions(-) delete mode 100644 .lefthook.yml create mode 100644 hk.pkl diff --git a/.lefthook.yml b/.lefthook.yml deleted file mode 100644 index d9b1bb6..0000000 --- a/.lefthook.yml +++ /dev/null @@ -1,13 +0,0 @@ -assert_lefthook_installed: true -output: [execution, failure, summary] -pre-commit: - parallel: true - commands: - format: - run: bun dprint fmt - stage_fixed: true - lint: - run: bun biome lint --config-path=.biome.jsonc --no-errors-on-unmatched - typecheck: - glob: "*.{cjs,js,jsx,mjs,ts,tsx}" - run: bun tsc-files --noEmit diff --git a/README.md b/README.md index 8b2f6d9..d638dcc 100644 --- a/README.md +++ b/README.md @@ -3,22 +3,22 @@ ![main GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/sripwoud/web-app-template/main.yml?branch=main&label=main) -| Feature | With | Configuration File | -| ---------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | -| Build tool | [vite](https://vite.dev/) | [vite.config.ts](./web/vite.config.ts) | -| Routing | [@tanstack/react-router](https://tanstack.com/router/latest) | | -| Form | [@tanstack/react-form](https://tanstack.com/form/latest) | | -| State management | [jotai](https://jotai.org/) | | -| Css | [tailwind](https://tailwindcss.com/) | | -| Runtime, tests runner | [bun](https://bun.sh) | [bunfig.toml](./bunfig.toml) | -| Tasks runner, environment & runtime management | [mise](https://mise.dev/) | [mise.toml](./mise.toml) | -| Typings | [typescript](https://www.typescriptlang.org/) | [tsconfig.json](./tsconfig.json) | -| Formatting | [dprint](https://dprint.dev/) | [.dprint.jsonc](./.biome.json) | -| Linting | [biome](https://biomejs.dev/) | [.biome.jsonc](./.biome.jsonc) | -| Continuous Integration | [github workflow](https://docs.github.com/en/actions/using-workflows) | [.github/workflows](./.github/workflows) | -| Import aliases | [typescript paths](https://www.typescriptlang.org/tsconfig#paths) | [tsconfig.json](https://github.com/r1oga/ts-template/blob/5d6983a6d28429b9dd256edf40bad5ee48c33d9c/tsconfig.json#L26) | -| Git hooks management | [lefthook](https://github.com/evilmartians/lefthook/) | [.lefthook.yml](./.lefthook.yml) | -| Conventional Commits | [convco](https://github.com/convco/convco) | [.convco](./.convco) | +| Feature | With | Configuration File | +| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| Build | [vite](https://vite.dev/) | [vite.config.ts](./web/vite.config.ts) | +| Css | [tailwind](https://tailwindcss.com/) | | +| Continuous Integration | [github workflow](https://docs.github.com/en/actions/using-workflows) | [.github/workflows](./.github/workflows) | +| Conventional Commits | [convco](https://github.com/convco/convco) | [.convco](./.convco) | +| Git Hooks | [hk](https://hk.jdx.dev/) | [hk.pkl](./hk.pkl) | +| Formatting | [dprint](https://dprint.dev/) | [.dprint.jsonc](./.biome.json) | +| Form | [@tanstack/react-form](https://tanstack.com/form/latest) | | +| Import Aliases | [typescript paths](https://www.typescriptlang.org/tsconfig#paths), [vite-tsconfig-paths](https://github.com/aleclarson/vite-tsconfig-paths) | [tsconfig.json](./web/tsconfig.json), [tsconfig.app.json](./web/tsconfig.app.json), [vite.config.ts](./web/vite.config.ts) | +| Linting | [biome](https://biomejs.dev/) | [.biome.jsonc](./.biome.jsonc) | +| Routing | [@tanstack/react-router](https://tanstack.com/router/latest) | [router.ts](./web/src/lib/router.ts) | +| Runtime, tests runner | [bun](https://bun.sh) | [bunfig.toml](./bunfig.toml) | +| State | [jotai](https://jotai.org/) | | +| Tasks Runner, Environment & Runtime Management | [mise](https://mise.dev/) | [mise.toml](./mise.toml) | +| Typings | [typescript](https://www.typescriptlang.org/) | [tsconfig.json](./tsconfig.json) | ## Develop diff --git a/hk.pkl b/hk.pkl new file mode 100644 index 0000000..66ee5c6 --- /dev/null +++ b/hk.pkl @@ -0,0 +1,17 @@ +amends "https://hk.jdx.dev/v0/hk.pkl" +// import "https://hk.jdx.dev/v0/builtins/prettier.pkl" + +min_hk_version = "0.2.3" + +`pre-commit` { + ["format"] { + fix_all = "bun dprint fmt" + } + ["lint"] { + check = "bun biome lint --config-path=.biome.jsonc --no-errors-on-unmatched {{files}}" + } + + ["typecheck"] { + check_all = "bun tsc-files web/src/**/*.{ts,tsx} --noEmit -p web/tsconfig.json -p web/tsconfig.app.json -p web/tsconfig.node.json" + } +} diff --git a/mise.toml b/mise.toml index 20c38e6..f82e6fc 100644 --- a/mise.toml +++ b/mise.toml @@ -22,4 +22,6 @@ quiet = true [tools] bun = "latest" "cargo:convco" = "latest" +hk = "latest" lefthook = "latest" +pkl = "latest" diff --git a/setup b/setup index 893ca5b..db203aa 100755 --- a/setup +++ b/setup @@ -72,7 +72,7 @@ main() { maybe_install_mise mise install integrate_convco_with_git - lefthook install >/dev/null && log "✅ Configured git hooks" + hk install >/dev/null && log "✅ Configured git hooks" } main