Keep calm and commit

This commit is contained in:
enoch 2025-04-07 12:11:59 +08:00
parent 255eaae3c8
commit 76cd441956
11 changed files with 145 additions and 0 deletions

1
.husky/pre-commit Normal file
View File

@ -0,0 +1 @@
bun test

13
bun.lock Normal file
View File

@ -0,0 +1,13 @@
{
"lockfileVersion": 1,
"workspaces": {
"": {
"devDependencies": {
"husky": "^9.1.7",
},
},
},
"packages": {
"husky": ["husky@9.1.7", "", { "bin": { "husky": "bin.js" } }, "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA=="],
}
}

1
node_modules/.bin/husky generated vendored Symbolic link
View File

@ -0,0 +1 @@
../husky/bin.js

21
node_modules/husky/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 typicode
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

1
node_modules/husky/README.md generated vendored Normal file
View File

@ -0,0 +1 @@
https://typicode.github.io/husky

26
node_modules/husky/bin.js generated vendored Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env node
import f, { writeFileSync as w } from 'fs'
import i from './index.js'
let p, a, n, s, o, d
p = process
a = p.argv[2]
if (a == 'init') {
n = 'package.json'
s = f.readFileSync(n)
o = JSON.parse(s)
;(o.scripts ||= {}).prepare = 'husky'
w(n, JSON.stringify(o, 0, /\t/.test(s) ? '\t' : 2) + '\n')
p.stdout.write(i())
try { f.mkdirSync('.husky') } catch {}
w('.husky/pre-commit', (p.env.npm_config_user_agent?.split('/')[0] ?? 'npm') + ' test\n')
p.exit()
}
d = c => console.error(`husky - ${c} command is DEPRECATED`)
if (['add', 'set', 'uninstall'].includes(a)) { d(a); p.exit(1) }
if (a == 'install') d(a)
p.stdout.write(i(a == 'install' ? undefined : a))

22
node_modules/husky/husky generated vendored Normal file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env sh
[ "$HUSKY" = "2" ] && set -x
n=$(basename "$0")
s=$(dirname "$(dirname "$0")")/$n
[ ! -f "$s" ] && exit 0
if [ -f "$HOME/.huskyrc" ]; then
echo "husky - '~/.huskyrc' is DEPRECATED, please move your code to ~/.config/husky/init.sh"
fi
i="${XDG_CONFIG_HOME:-$HOME/.config}/husky/init.sh"
[ -f "$i" ] && . "$i"
[ "${HUSKY-}" = "0" ] && exit 0
export PATH="node_modules/.bin:$PATH"
sh -e "$s" "$@"
c=$?
[ $c != 0 ] && echo "husky - $n script failed (code $c)"
[ $c = 127 ] && echo "husky - command not found in PATH=$PATH"
exit $c

1
node_modules/husky/index.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
export default function (dir?: string): string;

25
node_modules/husky/index.js generated vendored Normal file
View File

@ -0,0 +1,25 @@
import c from 'child_process'
import f, { readdir, writeFileSync as w } from 'fs'
import p from 'path'
let l = [ 'pre-commit', 'pre-merge-commit', 'prepare-commit-msg', 'commit-msg', 'post-commit', 'applypatch-msg', 'pre-applypatch', 'post-applypatch', 'pre-rebase', 'post-rewrite', 'post-checkout', 'post-merge', 'pre-push', 'pre-auto-gc' ],
msg = `echo "husky - DEPRECATED\n\nPlease remove the following two lines from $0:\n\n#!/usr/bin/env sh\n. \\"\\$(dirname -- \\"\\$0\\")/_/husky.sh\\"\n\nThey WILL FAIL in v10.0.0\n"`
export default (d = '.husky') => {
if (process.env.HUSKY === '0') return 'HUSKY=0 skip install'
if (d.includes('..')) return '.. not allowed'
if (!f.existsSync('.git')) return `.git can't be found`
let _ = (x = '') => p.join(d, '_', x)
let { status: s, stderr: e } = c.spawnSync('git', ['config', 'core.hooksPath', `${d}/_`])
if (s == null) return 'git command not found'
if (s) return '' + e
f.rmSync(_('husky.sh'), { force: true })
f.mkdirSync(_(), { recursive: true })
w(_('.gitignore'), '*')
f.copyFileSync(new URL('husky', import.meta.url), _('h'))
l.forEach(h => w(_(h), `#!/usr/bin/env sh\n. "\$(dirname "\$0")/h"`, { mode: 0o755 }))
w(_('husky.sh'), msg)
return ''
}

25
node_modules/husky/package.json generated vendored Normal file
View File

@ -0,0 +1,25 @@
{
"name": "husky",
"version": "9.1.7",
"type": "module",
"description": "Modern native Git hooks",
"keywords": [
"git",
"hooks",
"pre-commit"
],
"repository": {
"type": "git",
"url": "git+https://github.com/typicode/husky.git"
},
"funding": "https://github.com/sponsors/typicode",
"license": "MIT",
"author": "typicode",
"bin": {
"husky": "bin.js"
},
"exports": "./index.js",
"engines": {
"node": ">=18"
}
}

9
package.json Normal file
View File

@ -0,0 +1,9 @@
{
"dependencies": {},
"devDependencies": {
"husky": "^9.1.7"
},
"scripts": {
"prepare": "husky"
}
}