@digitoimistodude/code-quality-checks 2.1.0 → 2.1.1

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 +16 -5
  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.1 (2026-01-09)"
6
6
 
7
7
  # Load configuration
8
8
  # First check for local project config, then fall back to package default
@@ -677,16 +677,19 @@ scss_files=$(git diff --cached --name-only --diff-filter=ACM | grep '\.scss$' |
677
677
  if [ -n "$scss_files" ]; then
678
678
  printf " ${ARROW} Running stylelint on changed SCSS files... "
679
679
 
680
- # Find stylelint config
680
+ # Find stylelint config and binary
681
681
  stylelint_config=""
682
+ stylelint_bin=""
682
683
  if [ "$CONTEXT" = "dudestack" ]; then
683
- # Find stylelint config in theme directories
684
+ # Find stylelint config and binary in theme directories
684
685
  for theme_dir in content/themes/*/; do
685
686
  if [ -f "${theme_dir}.stylelintrc" ]; then
686
687
  stylelint_config="${theme_dir}.stylelintrc"
688
+ stylelint_bin="${theme_dir}node_modules/.bin/stylelint"
687
689
  break
688
690
  elif [ -f "${theme_dir}.stylelintrc.json" ]; then
689
691
  stylelint_config="${theme_dir}.stylelintrc.json"
692
+ stylelint_bin="${theme_dir}node_modules/.bin/stylelint"
690
693
  break
691
694
  fi
692
695
  done
@@ -701,10 +704,18 @@ if [ -n "$scss_files" ]; then
701
704
  elif [ -f ".stylelintrc.yml" ]; then
702
705
  stylelint_config=".stylelintrc.yml"
703
706
  fi
707
+ stylelint_bin="./node_modules/.bin/stylelint"
704
708
  fi
705
709
 
706
710
  if [ -n "$stylelint_config" ]; then
707
- if ! npx stylelint --config "$stylelint_config" $scss_files 2>/dev/null; then
711
+ # Use local stylelint if available, fall back to npx
712
+ if [ -x "$stylelint_bin" ]; then
713
+ stylelint_cmd="$stylelint_bin"
714
+ else
715
+ stylelint_cmd="npx stylelint"
716
+ fi
717
+
718
+ if ! $stylelint_cmd --config "$stylelint_config" $scss_files 2>/dev/null; then
708
719
  echo "${RED}${CROSS} FAILED${NC}"
709
720
  echo " ${RED}Stylelint found errors in SCSS files${NC}"
710
721
  echo " ${YELLOW}Please fix the following files:${NC}"
@@ -712,7 +723,7 @@ if [ -n "$scss_files" ]; then
712
723
  echo " ${YELLOW}• $file${NC}"
713
724
  done
714
725
  echo " ${YELLOW}To see detailed errors:${NC}"
715
- echo " ${BLUE}npx stylelint --config \"$stylelint_config\" $scss_files${NC}"
726
+ echo " ${BLUE}$stylelint_cmd --config \"$stylelint_config\" $scss_files${NC}"
716
727
  exit 1
717
728
  fi
718
729
  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.1",
4
4
  "description": "Code quality definitions and Husky pre-commit hooks for Dude WordPress projects",
5
5
  "main": "index.js",
6
6
  "files": [