Gathering detailed insights and metrics for @sehaj23/commit-craft
Gathering detailed insights and metrics for @sehaj23/commit-craft
Gathering detailed insights and metrics for @sehaj23/commit-craft
Gathering detailed insights and metrics for @sehaj23/commit-craft
npm install @sehaj23/commit-craft
Typescript
Module System
Min. Node Version
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
4
A Git hook utility for formatting commit messages with conventional commit types. This tool helps you maintain consistent commit message formatting by prompting you to select a commit type and automatically prefixing your commit messages.
1npm install -g commit-craft
1npm install --save-dev commit-craft
The hook will be automatically set up when you install the package! 🎉
When you install CommitCraft, it automatically:
prepare-commit-msg
hookYou should see output like:
🔍 Setting up CommitCraft in: /path/to/your/project
🔍 Husky detected: true
📝 Creating Husky hook at: /path/to/your/project/.husky/prepare-commit-msg
✅ Husky prepare-commit-msg hook created successfully!
🎉 CommitCraft is ready to use! Try making a commit.
If automatic setup doesn't work, you can set up manually:
1# Run the setup command 2npx commit-craft-setup
If you're using Husky for Git hooks:
1npm install --save-dev commit-craft husky
1npx husky install
1npx husky add .husky/prepare-commit-msg "exec < /dev/tty && npx commit-craft \$1 \$2"
Your .husky/prepare-commit-msg
file should look like:
1#!/usr/bin/env sh 2exec < /dev/tty && npx commit-craft $1 $2
For traditional Git hooks, the hook will be automatically created at .git/hooks/prepare-commit-msg
:
1#!/bin/sh 2exec < /dev/tty && npx commit-craft "$1" "$2"
You can also use CommitCraft manually:
1commit-craft <commit-file-path> [commit-source]
CommitCraft supports the following conventional commit types:
When you make a commit, CommitCraft will prompt you:
? Choose a commit type: (Use arrow keys)
❯ ✨ feat
🐛 fix
📝 docs
💄 style
♻️ refactor
✅ test
🔧 chore
────────────────
🚪 Exit (abort commit)
Your commit message will be automatically formatted:
Original: "add user authentication"
Result: "feat: add user authentication"
✅ Commit message formatted: feat: add user authentication
If the prompt appears but doesn't wait for your input, the hook might be missing TTY redirection. Ensure your hook includes:
1exec < /dev/tty && npx commit-craft $1 $2
Check if the hook exists:
1# For Husky 2ls -la .husky/prepare-commit-msg 3 4# For Git hooks 5ls -la .git/hooks/prepare-commit-msg
Ensure it's executable:
1chmod +x .husky/prepare-commit-msg 2# or 3chmod +x .git/hooks/prepare-commit-msg
Re-run setup:
1npx commit-craft-setup
If you see Husky deprecation warnings, update your hook to use the modern format (without the deprecated husky.sh
sourcing). CommitCraft automatically creates hooks in the correct format.
Here's a complete example of integrating CommitCraft with other common tools:
1{ 2 "scripts": { 3 "prepare": "husky install" 4 }, 5 "devDependencies": { 6 "commit-craft": "^1.0.0", 7 "husky": "^8.0.0", 8 "lint-staged": "^13.0.0" 9 } 10}
Husky hooks:
.husky/pre-commit
: npx lint-staged
.husky/prepare-commit-msg
: exec < /dev/tty && npx commit-craft $1 $2
CommitCraft can be used as a lightweight alternative to Commitizen for teams that prefer a simpler setup with automatic installation.
To install CommitCraft from a local directory in another project:
1# Install as dev dependency from local path 2npm install --save-dev /path/to/CommitCraft 3 4# The hook will be automatically set up!
commit-craft
: Main command for formatting commit messagescommit-craft-setup
: Manual setup command for hooks1npm run build
1npm run dev
1# Test the setup script 2npm run build 3node dist/setup.js 4 5# Test the main script 6echo "test message" > test-commit.txt 7node dist/index.js test-commit.txt 8cat test-commit.txt
MIT
Contributions are welcome! Please feel free to submit a Pull Request.
No vulnerabilities found.
No security vulnerabilities found.