Skip to content

Commit a930767

Browse files
committed
chore: release v0.2.3
1 parent 1150f8c commit a930767

File tree

5 files changed

+35
-4
lines changed

5 files changed

+35
-4
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11

2+
## v0.2.1...v0.2.1
3+
4+
[compare changes](https://github.com/stacksjs/bun-git-hooks/compare/v0.2.1...v0.2.1)
5+
6+
## v0.2.1...v0.2.1
7+
8+
[compare changes](https://github.com/stacksjs/bun-git-hooks/compare/v0.2.1...v0.2.1)
9+
210
## v0.2.0...main
311

412
[compare changes](https://github.com/stacksjs/bun-git-hooks/compare/v0.2.0...main)

bin/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ cli
1717
.command('[configPath]', 'Install git hooks, optionally from specified config file')
1818
.option('--verbose', 'Enable verbose logging')
1919
.example('bun-git-hooks')
20-
.example('bun-git-hooks ./config.ts')
20+
.example('bun-git-hooks ../src/config.ts')
2121
.example('bun-git-hooks --verbose')
2222
.action(async (configPath?: string, options?: { verbose?: boolean }) => {
2323
try {

build.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
import { mkdir } from 'node:fs/promises'
12
import { dts } from 'bun-plugin-dtsx'
23

4+
// Ensure dist/bin directory exists
5+
await mkdir('./dist/bin', { recursive: true })
6+
37
await Bun.build({
48
entrypoints: ['src/index.ts'],
59
target: 'browser',
@@ -10,6 +14,6 @@ await Bun.build({
1014
await Bun.build({
1115
entrypoints: ['bin/cli.ts'],
1216
target: 'bun',
13-
outdir: './dist',
17+
outdir: './dist/bin',
1418
plugins: [dts()],
1519
})

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bun-git-hooks",
33
"type": "module",
4-
"version": "0.2.1",
4+
"version": "0.2.3",
55
"description": "A modern, zero dependency tool for managing git hooks in Bun projects.",
66
"author": "Chris Breuer <chris@stacksjs.org>",
77
"license": "MIT",

scripts/postinstall.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#!/usr/bin/env bun
2+
3+
import { mkdir, symlink } from 'node:fs/promises'
4+
import { dirname, join } from 'node:path'
25
import process from 'node:process'
36
import { checkBunGitHooksInDependencies, getProjectRootDirectoryFromNodeModules, setHooksFromConfig } from '../src/git-hooks'
47

58
/**
69
* Creates the pre-commit from command in config by default
710
*/
8-
function postinstall() {
11+
async function postinstall() {
912
let projectDirectory
1013

1114
/* When script is run after install, the process.cwd() would be like <project_folder>/node_modules/simple-git-hooks
@@ -19,6 +22,22 @@ function postinstall() {
1922
projectDirectory = process.cwd()
2023
}
2124

25+
// Link the binary
26+
const binDir = join(projectDirectory, 'node_modules', '.bin')
27+
await mkdir(binDir, { recursive: true })
28+
29+
const sourcePath = join(process.cwd(), 'dist', 'bin', 'cli.js')
30+
const targetPath = join(binDir, 'bun-git-hooks')
31+
32+
try {
33+
await symlink(sourcePath, targetPath, 'file')
34+
}
35+
catch (err) {
36+
if ((err as NodeJS.ErrnoException).code !== 'EEXIST') {
37+
console.error(`[ERROR] Failed to link binary: ${err}`)
38+
}
39+
}
40+
2241
if (checkBunGitHooksInDependencies(projectDirectory)) {
2342
try {
2443
setHooksFromConfig(projectDirectory)

0 commit comments

Comments
 (0)