@digitoimistodude/code-quality-checks 2.1.0 → 2.1.2

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.
Files changed (2) hide show
  1. package/.husky/pre-commit +23 -10
  2. package/package.json +1 -1
package/.husky/pre-commit CHANGED
@@ -2,7 +2,7 @@
2
2
  # Ref: DEV-177, DEV-373, DEV-623
3
3
 
4
4
  # Version:
5
- VERSION="2.1.0 (2026-01-08)"
5
+ VERSION="2.1.2 (2026-01-09)"
6
6
 
7
7
  # Load configuration
8
8
  # First check for local project config, then fall back to package default
@@ -391,13 +391,15 @@ if [ "$CONTEXT" = "dudestack" ]; then
391
391
  # Check Theme Name line
392
392
  theme_name_line=$(grep "^Theme Name:" "${theme_dir}style.css" 2>/dev/null || echo "")
393
393
  if [ -n "$theme_name_line" ]; then
394
- # Check if theme name contains lowercase theme name
395
- if echo "$theme_name_line" | grep -qi "Theme Name:.*$theme_name"; then
394
+ # Extract the actual theme name value after "Theme Name:"
395
+ theme_name_value=$(echo "$theme_name_line" | sed 's/^Theme Name:[[:space:]]*//')
396
+
397
+ # Check if theme name starts with lowercase letter (should be capitalized)
398
+ if echo "$theme_name_value" | grep -q "^[a-z]"; then
396
399
  echo "${RED}${CROSS} FAILED${NC}"
397
- echo " ${RED}Theme Name contains lowercase theme name '$theme_name'${NC}"
400
+ echo " ${RED}Theme Name should start with a capital letter${NC}"
398
401
  echo " ${YELLOW}Found: $theme_name_line${NC}"
399
- echo " ${YELLOW}Should contain a clear theme name in sentence case${NC}"
400
- echo " ${YELLOW}Example: Theme Name: My Website Theme${NC}"
402
+ echo " ${YELLOW}Should be properly capitalized${NC}"
401
403
  echo " ${BLUE}nano ${theme_dir}style.css${NC}"
402
404
  exit 1
403
405
  fi
@@ -677,16 +679,19 @@ scss_files=$(git diff --cached --name-only --diff-filter=ACM | grep '\.scss$' |
677
679
  if [ -n "$scss_files" ]; then
678
680
  printf " ${ARROW} Running stylelint on changed SCSS files... "
679
681
 
680
- # Find stylelint config
682
+ # Find stylelint config and binary
681
683
  stylelint_config=""
684
+ stylelint_bin=""
682
685
  if [ "$CONTEXT" = "dudestack" ]; then
683
- # Find stylelint config in theme directories
686
+ # Find stylelint config and binary in theme directories
684
687
  for theme_dir in content/themes/*/; do
685
688
  if [ -f "${theme_dir}.stylelintrc" ]; then
686
689
  stylelint_config="${theme_dir}.stylelintrc"
690
+ stylelint_bin="${theme_dir}node_modules/.bin/stylelint"
687
691
  break
688
692
  elif [ -f "${theme_dir}.stylelintrc.json" ]; then
689
693
  stylelint_config="${theme_dir}.stylelintrc.json"
694
+ stylelint_bin="${theme_dir}node_modules/.bin/stylelint"
690
695
  break
691
696
  fi
692
697
  done
@@ -701,10 +706,18 @@ if [ -n "$scss_files" ]; then
701
706
  elif [ -f ".stylelintrc.yml" ]; then
702
707
  stylelint_config=".stylelintrc.yml"
703
708
  fi
709
+ stylelint_bin="./node_modules/.bin/stylelint"
704
710
  fi
705
711
 
706
712
  if [ -n "$stylelint_config" ]; then
707
- if ! npx stylelint --config "$stylelint_config" $scss_files 2>/dev/null; then
713
+ # Use local stylelint if available, fall back to npx
714
+ if [ -x "$stylelint_bin" ]; then
715
+ stylelint_cmd="$stylelint_bin"
716
+ else
717
+ stylelint_cmd="npx stylelint"
718
+ fi
719
+
720
+ if ! $stylelint_cmd --config "$stylelint_config" $scss_files 2>/dev/null; then
708
721
  echo "${RED}${CROSS} FAILED${NC}"
709
722
  echo " ${RED}Stylelint found errors in SCSS files${NC}"
710
723
  echo " ${YELLOW}Please fix the following files:${NC}"
@@ -712,7 +725,7 @@ if [ -n "$scss_files" ]; then
712
725
  echo " ${YELLOW}• $file${NC}"
713
726
  done
714
727
  echo " ${YELLOW}To see detailed errors:${NC}"
715
- echo " ${BLUE}npx stylelint --config \"$stylelint_config\" $scss_files${NC}"
728
+ echo " ${BLUE}$stylelint_cmd --config \"$stylelint_config\" $scss_files${NC}"
716
729
  exit 1
717
730
  fi
718
731
  echo "${GREEN}${CHECK} OK${NC}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitoimistodude/code-quality-checks",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Code quality definitions and Husky pre-commit hooks for Dude WordPress projects",
5
5
  "main": "index.js",
6
6
  "files": [