@gracefullight/validate-branch 1.1.2 → 1.1.4

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/README.ko.md CHANGED
@@ -30,8 +30,8 @@
30
30
  ## 설치
31
31
 
32
32
  ```bash
33
- # pnpm 사용
34
- pnpm add @gracefullight/validate-branch
33
+ # bun 사용
34
+ bun add @gracefullight/validate-branch
35
35
 
36
36
  # npm 사용
37
37
  npm install @gracefullight/validate-branch
@@ -411,19 +411,19 @@ git clone https://github.com/gracefullight/saju.git
411
411
  cd packages/validate-branch
412
412
 
413
413
  # 의존성 설치
414
- pnpm install
414
+ bun install
415
415
 
416
416
  # 빌드
417
- pnpm build
417
+ bun build
418
418
 
419
419
  # 테스트
420
- pnpm test
420
+ bun test
421
421
 
422
422
  # 린트
423
- pnpm lint
423
+ bun lint
424
424
 
425
425
  # 포맷
426
- pnpm lint:fix
426
+ bun lint:fix
427
427
  ```
428
428
 
429
429
  ### 로컬에서 CLI 테스트
@@ -463,6 +463,18 @@ MIT © [gracefullight](https://github.com/gracefullight)
463
463
  - [Commander.js](https://commander.js/) - Node.js CLI 프레임워크
464
464
  - [Chalk](https://chalk.js.org/) - 터미널 문자열 스타일링
465
465
 
466
+ ## 후원
467
+
468
+ 이 프로젝트가 도움이 되셨다면 커피 한 잔 부탁드립니다!
469
+
470
+ <a href="https://www.buymeacoffee.com/gracefullight" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
471
+
472
+ 또는 스타를 눌러주세요:
473
+
474
+ ```bash
475
+ gh api --method PUT /user/starred/gracefullight/pkgs
476
+ ```
477
+
466
478
  ## 지원
467
479
 
468
480
  - [문서](https://github.com/gracefullight/saju#readme)
package/README.md CHANGED
@@ -30,8 +30,8 @@ By default, the following branch names are allowed:
30
30
  ## Installation
31
31
 
32
32
  ```bash
33
- # Using pnpm
34
- pnpm add @gracefullight/validate-branch
33
+ # Using bun
34
+ bun add @gracefullight/validate-branch
35
35
 
36
36
  # Using npm
37
37
  npm install @gracefullight/validate-branch
@@ -411,19 +411,19 @@ git clone https://github.com/gracefullight/saju.git
411
411
  cd packages/validate-branch
412
412
 
413
413
  # Install dependencies
414
- pnpm install
414
+ bun install
415
415
 
416
416
  # Build
417
- pnpm build
417
+ bun build
418
418
 
419
419
  # Test
420
- pnpm test
420
+ bun test
421
421
 
422
422
  # Lint
423
- pnpm lint
423
+ bun lint
424
424
 
425
425
  # Format
426
- pnpm lint:fix
426
+ bun lint:fix
427
427
  ```
428
428
 
429
429
  ### Test CLI Locally
@@ -463,6 +463,18 @@ MIT © [gracefullight](https://github.com/gracefullight)
463
463
  - [Commander.js](https://commander.js/) - Node.js CLI framework
464
464
  - [Chalk](https://chalk.js.org/) - Terminal string styling
465
465
 
466
+ ## Sponsors
467
+
468
+ If this project helped you, please consider buying me a coffee!
469
+
470
+ <a href="https://www.buymeacoffee.com/gracefullight" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
471
+
472
+ Or leave a star:
473
+
474
+ ```bash
475
+ gh api --method PUT /user/starred/gracefullight/pkgs
476
+ ```
477
+
466
478
  ## Support
467
479
 
468
480
  - [Documentation](https://github.com/gracefullight/saju#readme)
package/dist/cli.js CHANGED
@@ -49,15 +49,30 @@ async function loadConfig() {
49
49
 
50
50
  // src/validate-branch-name.ts
51
51
  import * as fs from "fs";
52
+ import { readFileSync } from "fs";
53
+ import { resolve as resolvePath } from "path";
52
54
  import { cwd as cwd2 } from "process";
53
55
  import * as git from "isomorphic-git";
56
+ function resolveGitdir(startDir) {
57
+ const dotGit = resolvePath(startDir, ".git");
58
+ const stat = fs.statSync(dotGit);
59
+ if (stat.isFile()) {
60
+ const content = readFileSync(dotGit, "utf-8");
61
+ const match = content.match(/gitdir:\s*(.+)/);
62
+ if (match) {
63
+ return resolvePath(match[1].trim());
64
+ }
65
+ }
66
+ return dotGit;
67
+ }
54
68
  var GITFLOW_PATTERN = /^(main|master|develop|stage|feature\/[A-Za-z0-9_-]+|fix\/[A-Za-z0-9_-]+|hotfix\/[A-Za-z0-9_-]+|release\/[A-Za-z0-9_.-]+)$/;
55
69
  var JIRA_PATTERN = /^(main|master|develop|stage|[A-Z]+-[0-9]+)$/;
56
70
  async function getCurrentBranchName() {
57
71
  try {
72
+ const gitdir = resolveGitdir(cwd2());
58
73
  const branch = await git.currentBranch({
59
74
  fs,
60
- dir: cwd2(),
75
+ gitdir,
61
76
  fullname: false
62
77
  });
63
78
  return branch ?? null;
package/dist/index.js CHANGED
@@ -43,8 +43,22 @@ async function loadConfig() {
43
43
 
44
44
  // src/validate-branch-name.ts
45
45
  import * as fs from "fs";
46
+ import { readFileSync } from "fs";
47
+ import { resolve as resolvePath } from "path";
46
48
  import { cwd as cwd2 } from "process";
47
49
  import * as git from "isomorphic-git";
50
+ function resolveGitdir(startDir) {
51
+ const dotGit = resolvePath(startDir, ".git");
52
+ const stat = fs.statSync(dotGit);
53
+ if (stat.isFile()) {
54
+ const content = readFileSync(dotGit, "utf-8");
55
+ const match = content.match(/gitdir:\s*(.+)/);
56
+ if (match) {
57
+ return resolvePath(match[1].trim());
58
+ }
59
+ }
60
+ return dotGit;
61
+ }
48
62
  var GITFLOW_PATTERN = /^(main|master|develop|stage|feature\/[A-Za-z0-9_-]+|fix\/[A-Za-z0-9_-]+|hotfix\/[A-Za-z0-9_-]+|release\/[A-Za-z0-9_.-]+)$/;
49
63
  var JIRA_PATTERN = /^(main|master|develop|stage|[A-Z]+-[0-9]+)$/;
50
64
  function validateBranchName(branchName, options) {
@@ -57,9 +71,10 @@ function validateBranchName(branchName, options) {
57
71
  }
58
72
  async function getCurrentBranchName() {
59
73
  try {
74
+ const gitdir = resolveGitdir(cwd2());
60
75
  const branch = await git.currentBranch({
61
76
  fs,
62
- dir: cwd2(),
77
+ gitdir,
63
78
  fullname: false
64
79
  });
65
80
  return branch ?? null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gracefullight/validate-branch",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Git branch name validation tool with custom regexp support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -19,6 +19,14 @@
19
19
  "files": [
20
20
  "dist"
21
21
  ],
22
+ "scripts": {
23
+ "build": "tsup",
24
+ "dev": "tsx src/cli.ts",
25
+ "test": "vitest",
26
+ "lint": "biome check src",
27
+ "lint:fix": "biome check --write src",
28
+ "format": "biome format --write src"
29
+ },
22
30
  "keywords": [
23
31
  "git",
24
32
  "branch",
@@ -59,20 +67,12 @@
59
67
  "@types/node": "^24.10.9",
60
68
  "tsup": "^8.5.1",
61
69
  "tsx": "^4.21.0",
62
- "typescript": "^5",
70
+ "typescript": "^6",
63
71
  "vitest": "^4.0.17"
64
72
  },
65
73
  "dependencies": {
66
74
  "chalk": "^5.6.2",
67
75
  "commander": "^14.0.2",
68
76
  "isomorphic-git": "^1.36.1"
69
- },
70
- "scripts": {
71
- "build": "tsup",
72
- "dev": "tsx src/cli.ts",
73
- "test": "vitest",
74
- "lint": "biome check src",
75
- "lint:fix": "biome check --write src",
76
- "format": "biome format --write src"
77
77
  }
78
- }
78
+ }