bun-git-hooks 0.3.0 → 0.3.2

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.
@@ -26,7 +26,6 @@ export declare const HOOK_NAME_MAP: {
26
26
  'postCheckout': 'post-checkout';
27
27
  'preRebase': 'pre-rebase';
28
28
  'postRewrite': 'post-rewrite';
29
- // Reverse mapping
30
29
  'pre-commit': 'preCommit';
31
30
  'prepare-commit-msg': 'prepareCommitMsg';
32
31
  'commit-msg': 'commitMsg';
@@ -41,19 +40,6 @@ export declare const HOOK_NAME_MAP: {
41
40
  * Enhanced staged lint processor with configurable auto-restaging
42
41
  */
43
42
  export declare class StagedLintProcessor {
44
- private projectRoot: string;
45
- private verbose: boolean;
46
- private autoRestage: boolean;
47
43
  constructor(projectRoot?: string, verbose?: boolean, autoRestage?: boolean);
48
44
  process(config: StagedLintConfig): Promise<boolean>;
49
- private getStagedFiles(): string[];
50
- private captureStagedContent(files: string[]): Map<string, string>;
51
- private getMatchingFiles(files: string[], pattern: string): string[];
52
- private expandBracePattern(pattern: string): string[];
53
- private matchesGlob(file: string, pattern: string): boolean;
54
- private runLintCommand(command: string, files: string[]): Promise<boolean>;
55
- private getModifiedFiles(originalContent: Map<string, string>): string[];
56
- private restageFiles(files: string[]): void;
57
- private validateStagedFiles(config: StagedLintConfig): Promise<boolean>;
58
- private log(message: string): void;
59
- }
45
+ }
package/dist/types.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import type { VALID_GIT_HOOKS } from './git-hooks';
2
2
  export declare interface StagedLintConfig {
3
-
3
+ [pattern: string]: StagedLintTask
4
4
  }
5
5
  export declare interface SetHooksFromConfigOptions {
6
6
  configFile?: GitHooksConfig
7
7
  verbose?: boolean
8
8
  }
9
- export type StagedLintTask = string | string[]
9
+ export type StagedLintTask = string | string[];
10
10
  // Define camelCase hook names
11
11
  declare type CamelCaseHooks = | 'preCommit'
12
12
  | 'prepareCommitMsg'
@@ -16,7 +16,7 @@ declare type CamelCaseHooks = | 'preCommit'
16
16
  | 'postMerge'
17
17
  | 'postCheckout'
18
18
  | 'preRebase'
19
- | 'postRewrite'
19
+ | 'postRewrite';
20
20
  export type GitHooksConfig = {
21
21
  // Support both kebab-case (from VALID_GIT_HOOKS) and camelCase
22
22
  [K in typeof VALID_GIT_HOOKS[number] | CamelCaseHooks]?: string | {
@@ -30,4 +30,4 @@ export type GitHooksConfig = {
30
30
  'stagedLint'?: StagedLintConfig
31
31
  'staged-lint'?: StagedLintConfig // Legacy support
32
32
  'autoRestage'?: boolean // Global autoRestage setting
33
- }
33
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-git-hooks",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.3.2",
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",
@@ -58,13 +58,14 @@
58
58
  "postinstall": "bun ./scripts/postinstall.ts",
59
59
  "uninstall": "bun ./scripts/uninstall.ts",
60
60
  "fresh": "bunx rimraf node_modules/ bun.lock && bun i",
61
- "prepublishOnly": "bun --bun run build && bun run compile:all",
61
+ "prepublishOnly": "bun --bun run build && bun run compile:all && bun run zip",
62
62
  "test": "bun test",
63
- "lint": "bunx --bun eslint .",
64
- "lint:fix": "bunx --bun eslint . --fix",
63
+ "lint": "bunx --bun pickier .",
64
+ "lint:fix": "bunx --bun pickier . --fix",
65
65
  "changelog": "bunx logsmith --verbose",
66
66
  "changelog:generate": "bunx logsmith --output CHANGELOG.md",
67
- "release": "bunx bumpx prompt --recursive --all",
67
+ "release": "bunx --bun bumpx prompt --recursive --all",
68
+ "release:patch": "bun --bun run changelog:generate && bunx --bun bumpx patch --recursive --all --yes",
68
69
  "dev:docs": "bun --bun vitepress dev docs",
69
70
  "build:docs": "bun --bun vitepress build docs",
70
71
  "preview:docs": "bun --bun vitepress preview docs",
@@ -75,32 +76,21 @@
75
76
  "zip:linux-arm64": "zip -j bin/git-hooks-linux-arm64.zip bin/git-hooks-linux-arm64",
76
77
  "zip:windows-x64": "zip -j bin/git-hooks-windows-x64.zip bin/git-hooks-windows-x64.exe",
77
78
  "zip:darwin-x64": "zip -j bin/git-hooks-darwin-x64.zip bin/git-hooks-darwin-x64",
78
- "zip:darwin-arm64": "zip -j bin/git-hooks-darwin-arm64.zip bin/git-hooks-darwin-arm64"
79
+ "zip:darwin-arm64": "zip -j bin/git-hooks-darwin-arm64.zip bin/git-hooks-darwin-arm64",
80
+ "format": "bunx --bun pickier . --format",
81
+ "format:fix": "bunx --bun pickier . --format --write"
79
82
  },
80
83
  "devDependencies": {
81
- "@stacksjs/bumpx": "^0.1.84",
82
- "@stacksjs/clarity": "^0.3.23",
83
- "@stacksjs/docs": "^0.70.23",
84
- "@stacksjs/eslint-config": "^4.14.0-beta.3",
85
- "@stacksjs/gitlint": "^0.1.5",
86
- "@stacksjs/logsmith": "^0.1.18",
87
- "@types/bun": "^1.2.22",
88
- "buddy-bot": "^0.9.7",
89
- "bun-plugin-dtsx": "0.9.5",
90
- "bunfig": "^0.15.0",
91
- "cac": "^6.7.14",
92
- "typescript": "^5.9.2"
84
+ "@stacksjs/clapp": "^0.2.0",
85
+ "better-dx": "^0.2.7"
93
86
  },
94
87
  "git-hooks": {
95
88
  "pre-commit": {
96
- "stagedLint": {
97
- "*.{js,ts,json,yaml,yml,md}": "bunx --bun eslint --fix"
89
+ "staged-lint": {
90
+ "*.{js,ts,json,yaml,yml,md}": "bunx --bun pickier {files} --fix"
98
91
  },
99
92
  "autoRestage": true
100
93
  },
101
- "commit-msg": "bunx gitlint --edit .git/COMMIT_EDITMSG"
102
- },
103
- "overrides": {
104
- "unconfig": "0.3.10"
94
+ "commit-msg": "bunx gitlint .git/COMMIT_EDITMSG"
105
95
  }
106
96
  }
@@ -12,8 +12,8 @@ async function postinstall() {
12
12
  let projectDirectory
13
13
 
14
14
  /* When script is run after install, the process.cwd() would be like <project_folder>/node_modules/simple-git-hooks
15
- Here we try to get the original project directory by going upwards by 2 levels
16
- If we were not able to get new directory we assume, we are already in the project root */
15
+ Here we try to get the original project directory by going upwards by 2 levels
16
+ If we were not able to get new directory we assume, we are already in the project root */
17
17
  const parsedProjectDirectory = getProjectRootDirectoryFromNodeModules(process.cwd())
18
18
  if (parsedProjectDirectory !== undefined) {
19
19
  projectDirectory = parsedProjectDirectory