UNPKG

validate-branch

Version:

A CLI tool to validate Git branch names using Conventional Branch guidelines.

8 lines (7 loc) 542 B
#!/usr/bin/env node import{a as r}from"./chunk-FKCFOIAA.js";import{execSync as o}from"node:child_process";var e;try{e=o("git rev-parse --abbrev-ref HEAD",{encoding:"utf8"}).trim()}catch{console.error("Error: Not a Git repository or Git is not installed."),process.exit(1)}r(e)?(console.log(`\u2705 Branch "${e}" is valid!`),process.exit(0)):(console.error(`\u274C Branch "${e}" is invalid. Please use: - main, master, develop - feature/branch-name - bugfix/branch-name - hotfix/branch-name - release/branch-name`),process.exit(1));