@digitoimistodude/code-quality-checks 2.1.9 → 2.1.11
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.
- package/.husky/pre-commit +33 -8
- package/package.json +1 -1
package/.husky/pre-commit
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
# Pre commit hooks for Dude projects
|
|
2
2
|
# Ref: DEV-177, DEV-373, DEV-623
|
|
3
3
|
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
# Load configuration
|
|
5
|
+
# First check for local project config, then fall back to package default
|
|
6
|
+
SCRIPT_DIR="$(dirname "$0")"
|
|
7
|
+
|
|
8
|
+
# Version: dynamically read from code-quality-checks package CHANGELOG.md
|
|
9
|
+
PACKAGE_CHANGELOG="$SCRIPT_DIR/../CHANGELOG.md"
|
|
10
|
+
if [ -f "$PACKAGE_CHANGELOG" ]; then
|
|
11
|
+
CHANGELOG_LINE=$(head -n 1 "$PACKAGE_CHANGELOG")
|
|
7
12
|
VERSION_NUM=$(echo "$CHANGELOG_LINE" | sed 's/### //' | sed 's/:.*//')
|
|
8
13
|
VERSION_DATE=$(echo "$CHANGELOG_LINE" | sed 's/.*: //')
|
|
9
14
|
VERSION="$VERSION_NUM ($VERSION_DATE)"
|
|
10
15
|
else
|
|
11
16
|
VERSION="unknown"
|
|
12
17
|
fi
|
|
13
|
-
|
|
14
|
-
# Load configuration
|
|
15
|
-
# First check for local project config, then fall back to package default
|
|
16
|
-
SCRIPT_DIR="$(dirname "$0")"
|
|
17
18
|
if [ -f ".husky/pre-commit-config" ]; then
|
|
18
19
|
. ".husky/pre-commit-config"
|
|
19
20
|
elif [ -f "$SCRIPT_DIR/pre-commit-config" ]; then
|
|
@@ -602,6 +603,30 @@ if [ "$CONTEXT" = "standalone" ]; then
|
|
|
602
603
|
echo "${GREEN}${CHECK} OK${NC}"
|
|
603
604
|
fi
|
|
604
605
|
|
|
606
|
+
# Check for newer version of code-quality-checks
|
|
607
|
+
printf " ${ARROW} Checking for code-quality-checks updates... "
|
|
608
|
+
current_version=$(grep '"version":' "$(npm root -g 2>/dev/null || echo node_modules)/@digitoimistodude/code-quality-checks/package.json" 2>/dev/null | head -1 | sed 's/.*"version": "\(.*\)".*/\1/' || echo "")
|
|
609
|
+
if [ -z "$current_version" ]; then
|
|
610
|
+
# Try local node_modules if global not found
|
|
611
|
+
current_version=$(grep '"version":' "node_modules/@digitoimistodude/code-quality-checks/package.json" 2>/dev/null | head -1 | sed 's/.*"version": "\(.*\)".*/\1/' || echo "unknown")
|
|
612
|
+
fi
|
|
613
|
+
|
|
614
|
+
if [ "$current_version" != "unknown" ]; then
|
|
615
|
+
# Check npm for latest version with 2 second timeout
|
|
616
|
+
latest_version=$(timeout 2s npm view @digitoimistodude/code-quality-checks version 2>/dev/null || echo "")
|
|
617
|
+
|
|
618
|
+
if [ -n "$latest_version" ] && [ "$current_version" != "$latest_version" ]; then
|
|
619
|
+
echo "${YELLOW}⚠️ UPDATE AVAILABLE${NC}"
|
|
620
|
+
echo " ${YELLOW}Current: $current_version | Latest: $latest_version${NC}"
|
|
621
|
+
echo " ${YELLOW}Update with: ${BLUE}npm install -g @digitoimistodude/code-quality-checks@latest${NC}"
|
|
622
|
+
else
|
|
623
|
+
echo "${GREEN}${CHECK} OK${NC}"
|
|
624
|
+
fi
|
|
625
|
+
else
|
|
626
|
+
echo "${YELLOW}⚠️ SKIPPED${NC}"
|
|
627
|
+
echo " ${YELLOW}Could not determine current version${NC}"
|
|
628
|
+
fi
|
|
629
|
+
|
|
605
630
|
echo ""
|
|
606
631
|
echo "${CYAN}${SEARCH} Checking staged files for issues...${NC}"
|
|
607
632
|
|
|
@@ -763,7 +788,7 @@ if [ -n "$scss_files" ]; then
|
|
|
763
788
|
echo "${GREEN}${CHECK} OK${NC}"
|
|
764
789
|
else
|
|
765
790
|
echo "${YELLOW}⚠️ SKIPPED${NC}"
|
|
766
|
-
echo " ${YELLOW}No SCSS files in theme directory${NC}"
|
|
791
|
+
echo " ${YELLOW}No staged SCSS files found in theme directory ($theme_prefix)${NC}"
|
|
767
792
|
fi
|
|
768
793
|
else
|
|
769
794
|
# Standalone: run from current directory
|