Skip to content

Commit

Permalink
fix: 🐛 adjust cz calls
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgrv committed Jun 23, 2024
1 parent c241b8b commit 8871223
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/githooks/_prepare-commit-msg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ fi
# Install commitizen plugins
PLUGINS=$(cat package.json | npx jqn '.config.commitizen.path' | tr -d "'[]:")
npm list --global $PLUGINS 2>/dev/null 1>&2 || npm install --global $PLUGINS 2>/dev/null 1>&2
npm list --global commitizen 2>/dev/null 1>&2 || npm install --global commitizen 2>/dev/null 1>&2

# Edit commit message
if [ $(grep -cv -e '^#' -e '^$' .git/COMMIT_EDITMSG) -eq 0 ]; then
(exec </dev/tty && npx --package commitizen -- cz --hook || npx chalk-cli --no-stdin -t "{red !} Unable to start commitizen.") || npx chalk-cli --no-stdin -t "{red !} Commitizen failed."
(exec </dev/tty && npx cz --hook || npx chalk-cli --no-stdin -t "{red !} Unable to start commitizen.") || npx chalk-cli --no-stdin -t "{red !} Commitizen failed."
else
npx chalk-cli --no-stdin -t "{blue →} Commitizen not relevant. Skipping..."
fi
3 changes: 2 additions & 1 deletion src/githooks/configure-hooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
set -e

### Define current script directory as hook directory
git config hooks.hookDir $source
git config hooks.hooksPath $source

### Make a symbolic link to the hook directory for each hook starting with '_' and ending with '.sh'
find $source -name '_*.sh' | sort | while read file; do
hook=$(basename $file | sed 's/^_//;s/\.sh$//')
Expand Down
2 changes: 1 addition & 1 deletion src/githooks/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Git Hooks",
"id": "githooks",
"version": "1.2.1",
"version": "1.2.2",
"description": "A feature to add useful Git hooks to your project",
"installsAfter": ["ghcr.io/devcontainers/features/common-utils"],
"dependsOn": {
Expand Down

0 comments on commit 8871223

Please sign in to comment.