feat: use bun and lefthook
This commit is contained in:
parent
a02589936c
commit
22a958c673
8 changed files with 132 additions and 8078 deletions
57
.husky/_/pre-commit
Executable file
57
.husky/_/pre-commit
Executable file
|
|
@ -0,0 +1,57 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$LEFTHOOK" = "0" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
call_lefthook()
|
||||||
|
{
|
||||||
|
if test -n "$LEFTHOOK_BIN"
|
||||||
|
then
|
||||||
|
"$LEFTHOOK_BIN" "$@"
|
||||||
|
elif lefthook -h >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
lefthook "$@"
|
||||||
|
else
|
||||||
|
dir="$(git rev-parse --show-toplevel)"
|
||||||
|
osArch=$(uname | tr '[:upper:]' '[:lower:]')
|
||||||
|
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
|
||||||
|
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook"
|
||||||
|
then
|
||||||
|
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@"
|
||||||
|
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook"
|
||||||
|
then
|
||||||
|
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@"
|
||||||
|
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook"
|
||||||
|
then
|
||||||
|
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@"
|
||||||
|
elif test -f "$dir/node_modules/lefthook/bin/index.js"
|
||||||
|
then
|
||||||
|
"$dir/node_modules/lefthook/bin/index.js" "$@"
|
||||||
|
|
||||||
|
elif bundle exec lefthook -h >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
bundle exec lefthook "$@"
|
||||||
|
elif yarn lefthook -h >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
yarn lefthook "$@"
|
||||||
|
elif pnpm lefthook -h >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
pnpm lefthook "$@"
|
||||||
|
elif swift package plugin lefthook >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
swift package --disable-sandbox plugin lefthook "$@"
|
||||||
|
elif command -v mint >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
mint run csjones/lefthook-plugin "$@"
|
||||||
|
else
|
||||||
|
echo "Can't find lefthook in PATH"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
call_lefthook run "pre-commit" "$@"
|
||||||
57
.husky/_/prepare-commit-msg
Executable file
57
.husky/_/prepare-commit-msg
Executable file
|
|
@ -0,0 +1,57 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$LEFTHOOK" = "0" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
call_lefthook()
|
||||||
|
{
|
||||||
|
if test -n "$LEFTHOOK_BIN"
|
||||||
|
then
|
||||||
|
"$LEFTHOOK_BIN" "$@"
|
||||||
|
elif lefthook -h >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
lefthook "$@"
|
||||||
|
else
|
||||||
|
dir="$(git rev-parse --show-toplevel)"
|
||||||
|
osArch=$(uname | tr '[:upper:]' '[:lower:]')
|
||||||
|
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
|
||||||
|
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook"
|
||||||
|
then
|
||||||
|
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@"
|
||||||
|
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook"
|
||||||
|
then
|
||||||
|
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@"
|
||||||
|
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook"
|
||||||
|
then
|
||||||
|
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@"
|
||||||
|
elif test -f "$dir/node_modules/lefthook/bin/index.js"
|
||||||
|
then
|
||||||
|
"$dir/node_modules/lefthook/bin/index.js" "$@"
|
||||||
|
|
||||||
|
elif bundle exec lefthook -h >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
bundle exec lefthook "$@"
|
||||||
|
elif yarn lefthook -h >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
yarn lefthook "$@"
|
||||||
|
elif pnpm lefthook -h >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
pnpm lefthook "$@"
|
||||||
|
elif swift package plugin lefthook >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
swift package --disable-sandbox plugin lefthook "$@"
|
||||||
|
elif command -v mint >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
mint run csjones/lefthook-plugin "$@"
|
||||||
|
else
|
||||||
|
echo "Can't find lefthook in PATH"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
call_lefthook run "prepare-commit-msg" "$@"
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
pnpm lint-staged
|
|
||||||
|
|
@ -6,10 +6,8 @@ A minimalism, personal blog theme for Astro.
|
||||||
|
|
||||||
[](https://astro.build) [](https://app.netlify.com/sites/astro-air/deploys)
|
[](https://astro.build) [](https://app.netlify.com/sites/astro-air/deploys)
|
||||||
|
|
||||||
|
|
||||||
<img style="border-radius: 10px;" src="https://cdn.jsdelivr.net/gh/sun0225SUN/astro-air/public/preview.png" alt="Astro Air">
|
<img style="border-radius: 10px;" src="https://cdn.jsdelivr.net/gh/sun0225SUN/astro-air/public/preview.png" alt="Astro Air">
|
||||||
|
|
||||||
|
|
||||||
## Showcase
|
## Showcase
|
||||||
|
|
||||||
- [Astro Air](https://astro-air.guoqi.dev)
|
- [Astro Air](https://astro-air.guoqi.dev)
|
||||||
|
|
@ -40,7 +38,6 @@ A minimalism, personal blog theme for Astro.
|
||||||
|
|
||||||
[](https://app.netlify.com/start/deploy?repository=https://github.com/sun0225SUN/astro-air)
|
[](https://app.netlify.com/start/deploy?repository=https://github.com/sun0225SUN/astro-air)
|
||||||
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
- Open `src/config/index.ts` and customize your site settings
|
- Open `src/config/index.ts` and customize your site settings
|
||||||
|
|
|
||||||
BIN
bun.lockb
Executable file
BIN
bun.lockb
Executable file
Binary file not shown.
14
lefthook.yml
Normal file
14
lefthook.yml
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
pre-commit:
|
||||||
|
commands:
|
||||||
|
prettier-js:
|
||||||
|
glob: "*.{js,jsx,ts,tsx,astro}"
|
||||||
|
run: prettier --write {staged_files}
|
||||||
|
eslint-fix:
|
||||||
|
glob: "*.{js,jsx,ts,tsx,astro}"
|
||||||
|
run: eslint --fix {staged_files}
|
||||||
|
eslint:
|
||||||
|
glob: "*.{js,jsx,ts,tsx,astro}"
|
||||||
|
run: eslint {staged_files}
|
||||||
|
prettier-other:
|
||||||
|
glob: "*.{json,css,md}"
|
||||||
|
run: prettier --write {staged_files}
|
||||||
17
package.json
17
package.json
|
|
@ -7,8 +7,7 @@
|
||||||
"build": "astro check && astro build",
|
"build": "astro check && astro build",
|
||||||
"preview": "astro preview",
|
"preview": "astro preview",
|
||||||
"astro": "astro",
|
"astro": "astro",
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write ."
|
||||||
"prepare": "husky"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/check": "^0.9.4",
|
"@astrojs/check": "^0.9.4",
|
||||||
|
|
@ -23,10 +22,10 @@
|
||||||
"astro-google-analytics": "^1.0.3",
|
"astro-google-analytics": "^1.0.3",
|
||||||
"astro-og-canvas": "^0.5.5",
|
"astro-og-canvas": "^0.5.5",
|
||||||
"canvaskit-wasm": "^0.39.1",
|
"canvaskit-wasm": "^0.39.1",
|
||||||
|
"lefthook": "^1.10.0",
|
||||||
"lucide-react": "^0.468.0",
|
"lucide-react": "^0.468.0",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"sanitize-html": "^2.13.1",
|
|
||||||
"tailwindcss": "^3.4.16",
|
"tailwindcss": "^3.4.16",
|
||||||
"twikoo": "^1.6.40",
|
"twikoo": "^1.6.40",
|
||||||
"typescript": "^5.7.2"
|
"typescript": "^5.7.2"
|
||||||
|
|
@ -40,21 +39,9 @@
|
||||||
"eslint": "^9.17.0",
|
"eslint": "^9.17.0",
|
||||||
"eslint-plugin-astro": "^1.3.1",
|
"eslint-plugin-astro": "^1.3.1",
|
||||||
"eslint-plugin-jsx-a11y": "^6.10.2",
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
||||||
"husky": "^9.1.7",
|
|
||||||
"lint-staged": "^15.2.11",
|
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"prettier-plugin-astro": "^0.14.1",
|
"prettier-plugin-astro": "^0.14.1",
|
||||||
"prettier-plugin-tailwindcss": "^0.6.9",
|
"prettier-plugin-tailwindcss": "^0.6.9",
|
||||||
"sass": "^1.83.0"
|
"sass": "^1.83.0"
|
||||||
},
|
|
||||||
"lint-staged": {
|
|
||||||
"*/**/*.{js,jsx,ts,tsx,astro}": [
|
|
||||||
"prettier --write",
|
|
||||||
"eslint --fix",
|
|
||||||
"eslint"
|
|
||||||
],
|
|
||||||
"*/**/*.{json,css,md}": [
|
|
||||||
"prettier --write"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
8057
pnpm-lock.yaml
generated
8057
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue