bun-git-hooks 0.2.10 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli.ts ADDED
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ import process from 'node:process'
3
+ import { CAC } from 'cac'
4
+ import { version } from '../package.json'
5
+ import { removeHooks, setHooksFromConfig } from '../src/git-hooks'
6
+
7
+ const cli = new CAC('git-hooks')
8
+
9
+ // Check if installation should be skipped
10
+ const { SKIP_INSTALL_GIT_HOOKS } = process.env
11
+ if (['1', 'true'].includes(SKIP_INSTALL_GIT_HOOKS || '')) {
12
+ console.log(`[INFO] SKIP_INSTALL_GIT_HOOKS is set to "${SKIP_INSTALL_GIT_HOOKS}", skipping installing hooks.`)
13
+ process.exit(0)
14
+ }
15
+
16
+ cli
17
+ .command('[configPath]', 'Install git hooks, optionally from specified config file')
18
+ .option('--verbose', 'Enable verbose logging')
19
+ .example('bun-git-hooks')
20
+ .example('bun-git-hooks ../src/config.ts')
21
+ .example('bun-git-hooks --verbose')
22
+ .action(async (configPath?: string, options?: { verbose?: boolean }) => {
23
+ try {
24
+ if (options?.verbose) {
25
+ console.log('[DEBUG] Config path:', configPath || 'using default')
26
+ console.log('[DEBUG] Working directory:', process.cwd())
27
+ }
28
+
29
+ setHooksFromConfig(process.cwd(), { configFile: configPath })
30
+ console.log('[INFO] Successfully set all git hooks')
31
+ }
32
+ catch (err) {
33
+ console.error('[ERROR] Was not able to set git hooks. Error:', err)
34
+ process.exit(1)
35
+ }
36
+ })
37
+
38
+ cli
39
+ .command('uninstall', 'Remove all git hooks')
40
+ .alias('remove') // Add alias for uninstall
41
+ .option('--verbose', 'Enable verbose logging')
42
+ .example('bun-git-hooks uninstall')
43
+ .example('bunx bun-git-hooks remove')
44
+ .example('bunx git-hooks uninstall --verbose')
45
+ .action(async (options?: { verbose?: boolean }) => {
46
+ try {
47
+ if (options?.verbose) {
48
+ console.log('[DEBUG] Removing hooks from:', process.cwd())
49
+ }
50
+
51
+ removeHooks(process.cwd(), options?.verbose)
52
+ console.log('[INFO] Successfully removed all git hooks')
53
+ }
54
+ catch (err) {
55
+ console.error('[ERROR] Was not able to remove git hooks. Error:', err)
56
+ process.exit(1)
57
+ }
58
+ })
59
+
60
+ cli.version(version)
61
+ cli.help()
62
+ cli.parse()
package/bin/git-hooks ADDED
Binary file
Binary file
Binary file
package/dist/cli.js CHANGED
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-git-hooks",
3
3
  "type": "module",
4
- "version": "0.2.10",
4
+ "version": "0.2.11",
5
5
  "description": "A modern, zero dependency tool for managing git hooks in Bun projects.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -38,19 +38,19 @@
38
38
  "module": "./dist/index.js",
39
39
  "types": "./dist/index.d.ts",
40
40
  "bin": {
41
- "git-hooks": "./dist/cli.js",
42
- "bun-git-hooks": "./dist/cli.js"
41
+ "git-hooks": "./bin/git-hooks",
42
+ "bun-git-hooks": "./bin/git-hooks"
43
43
  },
44
- "files": ["README.md", "dist"],
44
+ "files": ["README.md", "bin", "dist"],
45
45
  "scripts": {
46
46
  "build": "bun build.ts && bun run compile",
47
- "compile": "bun build ./bin/cli.ts --compile --minify --outfile dist/cli.js",
47
+ "compile": "bun build ./bin/cli.ts --compile --minify --outfile bin/git-hooks",
48
48
  "compile:all": "bun run compile:linux-x64 && bun run compile:linux-arm64 && bun run compile:windows-x64 && bun run compile:darwin-x64 && bun run compile:darwin-arm64",
49
- "compile:linux-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-linux-x64 --outfile dist/git-hooks-linux-x64",
50
- "compile:linux-arm64": "bun build ./bin/cli.ts --compile --minify --target=bun-linux-arm64 --outfile dist/git-hooks-linux-arm64",
51
- "compile:windows-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-windows-x64 --outfile dist/git-hooks-windows-x64.exe",
52
- "compile:darwin-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-darwin-x64 --outfile dist/git-hooks-darwin-x64",
53
- "compile:darwin-arm64": "bun build ./bin/cli.ts --compile --minify --target=bun-darwin-arm64 --outfile dist/git-hooks-darwin-arm64",
49
+ "compile:linux-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-linux-x64 --outfile bin/git-hooks-linux-x64",
50
+ "compile:linux-arm64": "bun build ./bin/cli.ts --compile --minify --target=bun-linux-arm64 --outfile bin/git-hooks-linux-arm64",
51
+ "compile:windows-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-windows-x64 --outfile bin/git-hooks-windows-x64.exe",
52
+ "compile:darwin-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-darwin-x64 --outfile bin/git-hooks-darwin-x64",
53
+ "compile:darwin-arm64": "bun build ./bin/cli.ts --compile --minify --target=bun-darwin-arm64 --outfile bin/git-hooks-darwin-arm64",
54
54
  "postinstall": "bun ./scripts/postinstall.ts",
55
55
  "uninstall": "bun ./scripts/uninstall.ts",
56
56
  "lint": "bunx --bun eslint .",
@@ -66,11 +66,11 @@
66
66
  "typecheck": "bun --bun tsc --noEmit",
67
67
  "zip": "bun run zip:all",
68
68
  "zip:all": "bun run zip:linux-x64 && bun run zip:linux-arm64 && bun run zip:windows-x64 && bun run zip:darwin-x64 && bun run zip:darwin-arm64",
69
- "zip:linux-x64": "zip -j dist/git-hooks-linux-x64.zip dist/git-hooks-linux-x64",
70
- "zip:linux-arm64": "zip -j dist/git-hooks-linux-arm64.zip dist/git-hooks-linux-arm64",
71
- "zip:windows-x64": "zip -j dist/git-hooks-windows-x64.zip dist/git-hooks-windows-x64.exe",
72
- "zip:darwin-x64": "zip -j dist/git-hooks-darwin-x64.zip dist/git-hooks-darwin-x64",
73
- "zip:darwin-arm64": "zip -j dist/git-hooks-darwin-arm64.zip dist/git-hooks-darwin-arm64"
69
+ "zip:linux-x64": "zip -j bin/git-hooks-linux-x64.zip bin/git-hooks-linux-x64",
70
+ "zip:linux-arm64": "zip -j bin/git-hooks-linux-arm64.zip bin/git-hooks-linux-arm64",
71
+ "zip:windows-x64": "zip -j bin/git-hooks-windows-x64.zip bin/git-hooks-windows-x64.exe",
72
+ "zip:darwin-x64": "zip -j bin/git-hooks-darwin-x64.zip bin/git-hooks-darwin-x64",
73
+ "zip:darwin-arm64": "zip -j bin/git-hooks-darwin-arm64.zip bin/git-hooks-darwin-arm64"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@iconify-json/carbon": "^1.2.8",