branch-validator-pro 1.0.1 → 1.1.0
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.md +24 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,19 +32,19 @@ npm install branch-validator-pro
|
|
|
32
32
|
### Basic Usage
|
|
33
33
|
```bash
|
|
34
34
|
# Validate branch names
|
|
35
|
-
validate-git branch feature/
|
|
36
|
-
validate-git branch bugfix/
|
|
37
|
-
validate-git branch hotfix/
|
|
35
|
+
validate-git branch feature/TASK-1234-add-user-authentication
|
|
36
|
+
validate-git branch bugfix/TASK-5678-fix-login-bug
|
|
37
|
+
validate-git branch hotfix/TASK-9012-critical-security-patch
|
|
38
38
|
|
|
39
39
|
# Validate commit messages
|
|
40
|
-
validate-git commit
|
|
41
|
-
validate-git commit
|
|
40
|
+
validate-git commit TASK-1234-add-user-authentication
|
|
41
|
+
validate-git commit TASK-5678-fix-login-bug
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
### Output
|
|
45
45
|
```
|
|
46
|
-
✅ Branch name is valid: feature/
|
|
47
|
-
✅ Commit message is valid:
|
|
46
|
+
✅ Branch name is valid: feature/TASK-1234-add-user-authentication
|
|
47
|
+
✅ Commit message is valid: TASK-1234-fix-login-bug
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
## 📖 Programmatic Usage
|
|
@@ -53,12 +53,12 @@ validate-git commit SHOP-5678-fix-login-bug
|
|
|
53
53
|
const { validateBranchName, validateCommitMessage } = require('branch-validator-pro');
|
|
54
54
|
|
|
55
55
|
// Validate branch name
|
|
56
|
-
const branchResult = validateBranchName('feature/
|
|
56
|
+
const branchResult = validateBranchName('feature/TASK-1234-new-feature');
|
|
57
57
|
console.log(branchResult.valid); // true/false
|
|
58
58
|
console.log(branchResult.message); // validation message
|
|
59
59
|
|
|
60
60
|
// Validate commit message
|
|
61
|
-
const commitResult = validateCommitMessage('
|
|
61
|
+
const commitResult = validateCommitMessage('TASK-1234-new-feature');
|
|
62
62
|
console.log(commitResult.valid); // true/false
|
|
63
63
|
console.log(commitResult.message); // validation message
|
|
64
64
|
```
|
|
@@ -72,36 +72,36 @@ console.log(commitResult.message); // validation message
|
|
|
72
72
|
- `hotfix/` - for critical fixes
|
|
73
73
|
- `release/` - for release branches
|
|
74
74
|
- `chore/` - for maintenance tasks
|
|
75
|
-
- Must contain a ticket pattern: `
|
|
75
|
+
- Must contain a ticket pattern: `TASK-XXXX` (where XXXX is a number)
|
|
76
76
|
- Description must be lowercase
|
|
77
77
|
- Use dashes (-) only, no spaces or underscores
|
|
78
|
-
- **Pattern:** `^[a-z]+/
|
|
78
|
+
- **Pattern:** `^[a-z]+/TASK-\d+-[a-z0-9-]+$`
|
|
79
79
|
|
|
80
80
|
**Valid Examples:**
|
|
81
|
-
- `feature/
|
|
82
|
-
- `bugfix/
|
|
83
|
-
- `hotfix/
|
|
81
|
+
- `feature/TASK-1234-add-payment-gateway`
|
|
82
|
+
- `bugfix/TASK-5678-fix-validation-error`
|
|
83
|
+
- `hotfix/TASK-9012-security-patch`
|
|
84
84
|
|
|
85
85
|
**Invalid Examples:**
|
|
86
86
|
- `feature/add-payment` (missing ticket)
|
|
87
|
-
- `Feature/
|
|
88
|
-
- `feature/
|
|
89
|
-
- `feature/
|
|
87
|
+
- `Feature/TASK-1234-payment` (uppercase prefix)
|
|
88
|
+
- `feature/TASK-1234_payment_gateway` (underscores not allowed)
|
|
89
|
+
- `feature/TASK-1234-Payment Gateway` (spaces not allowed)
|
|
90
90
|
|
|
91
91
|
### Commit Messages
|
|
92
|
-
- Must follow the pattern: `
|
|
92
|
+
- Must follow the pattern: `TASK-XXXX-description`
|
|
93
93
|
- Use lowercase letters, numbers, and dashes only
|
|
94
94
|
- No spaces or underscores allowed
|
|
95
|
-
- **Pattern:** `^
|
|
95
|
+
- **Pattern:** `^TASK-\d+-[a-z0-9-]+$`
|
|
96
96
|
|
|
97
97
|
**Valid Examples:**
|
|
98
|
-
- `
|
|
99
|
-
- `
|
|
100
|
-
- `
|
|
98
|
+
- `TASK-1234-implement-user-registration`
|
|
99
|
+
- `TASK-5678-fix-database-connection`
|
|
100
|
+
- `TASK-9012-update-security-headers`
|
|
101
101
|
|
|
102
102
|
**Invalid Examples:**
|
|
103
|
-
- `
|
|
104
|
-
- `
|
|
103
|
+
- `TASK-1234 implement user registration` (spaces not allowed)
|
|
104
|
+
- `TASK-1234_implement_user_registration` (underscores not allowed)
|
|
105
105
|
- `implement user registration` (missing ticket)
|
|
106
106
|
|
|
107
107
|
## 🪝 Git Hook Integration
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "branch-validator-pro",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Professional Git branch and commit validator for consistent naming conventions. Validates format and ensures proper ticket ID patterns without external API dependencies. Perfect for teams worldwide.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|