From 8a61a8d690ae236c9cd3bce53289c045c8e3dbeb Mon Sep 17 00:00:00 2001 From: Yazan Majadba Date: Mon, 17 Nov 2025 12:28:48 +0300 Subject: [PATCH 1/4] Make file search script use project root dynamically - Read docroot from .ddev/config.yaml - Support both docroot and web directories - Prevent unbound variable errors in scripts --- commands/web/dev-utils.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/commands/web/dev-utils.sh b/commands/web/dev-utils.sh index 09f3f7a..4f6dd50 100644 --- a/commands/web/dev-utils.sh +++ b/commands/web/dev-utils.sh @@ -7,7 +7,8 @@ get_changed_files() { local extensions=("$@") local ext_pattern=$(IFS='|'; echo "${extensions[*]}") - local custom_path_pattern="docroot/(modules|themes)/custom/.*" + local docroot=$(grep '^docroot:' .ddev/config.yaml | awk '{print $2}') || docroot="docroot" + local custom_path_pattern="$docroot/(modules|themes)/custom/.*" local changed_files="" # If we're in Bitbucket Pipelines @@ -35,8 +36,9 @@ get_changed_files() { get_all_files() { local extensions=("$@") local ext_pattern=$(IFS='|'; echo "${extensions[*]}") + local docroot=$(grep '^docroot:' .ddev/config.yaml | awk '{print $2}') || docroot="docroot" - find docroot/modules/custom docroot/themes/custom -type f \ + find $docroot/modules/custom $docroot/themes/custom -type f \ -regextype posix-extended \ -regex ".*\.($ext_pattern)$" \ -not -path "*/node_modules/*" | tr '\n' ' ' @@ -94,4 +96,4 @@ get_files() { fi echo "$files" -} \ No newline at end of file +} From 9d50f854c9cea48be35c2c97b13a764b41925617 Mon Sep 17 00:00:00 2001 From: Yazan Majadba Date: Mon, 17 Nov 2025 15:49:18 +0300 Subject: [PATCH 2/4] Update dev-cspell --- commands/web/dev-cspell | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/web/dev-cspell b/commands/web/dev-cspell index ab1be55..4d72dcb 100755 --- a/commands/web/dev-cspell +++ b/commands/web/dev-cspell @@ -10,6 +10,7 @@ source "${0%/*}/dev-utils.sh" # "ddev dev-cspell --files=file1.php,file2.js" (checks specific files) set -euo pipefail +docroot=$(grep '^docroot:' .ddev/config.yaml | awk '{print $2}') || docroot="docroot" # Define extensions for text files EXTENSIONS=("php" "module" "js" "css" "twig" "yml" "yaml" "json" "md" "txt") @@ -35,7 +36,7 @@ if [ -f "./.cspell.json" ]; then echo "Using local .cspell.json" CONFIG="./.cspell.json" else - CONFIG="docroot/core/.cspell.json" + CONFIG="$docroot/core/.cspell.json" fi -node docroot/core/node_modules/cspell/bin.mjs --config "$CONFIG" --color $FILES +node $docroot/core/node_modules/cspell/bin.mjs --config "$CONFIG" --color $FILES From 44cba5066efee7584f98e9621fbed92f4a4d57ba Mon Sep 17 00:00:00 2001 From: Yazan Majadba Date: Mon, 17 Nov 2025 15:49:54 +0300 Subject: [PATCH 3/4] Update dev-eslint --- commands/web/dev-eslint | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/web/dev-eslint b/commands/web/dev-eslint index 5cd2f12..d5cb56e 100755 --- a/commands/web/dev-eslint +++ b/commands/web/dev-eslint @@ -10,6 +10,7 @@ source "${0%/*}/dev-utils.sh" # "ddev dev-eslint --files=file1.js,file2.js" (checks specific files) set -euo pipefail +docroot=$(grep '^docroot:' .ddev/config.yaml | awk '{print $2}') || docroot="docroot" # Define extensions for JS files EXTENSIONS=("js") @@ -35,8 +36,8 @@ if [ -f "./.eslintrc.json" ]; then echo "Using local .eslintrc.json" CONFIG="./.eslintrc.json" else - CONFIG="docroot/core/.eslintrc.json" + CONFIG="$docroot/core/.eslintrc.json" fi # Run ESLint -node docroot/core/node_modules/eslint/bin/eslint.js --config="$CONFIG" --no-eslintrc -f stylish --color $FILES +node $docroot/core/node_modules/eslint/bin/eslint.js --config="$CONFIG" --no-eslintrc -f stylish --color $FILES From f5a4df97e9672d3381755ccc21410a3657e76ac3 Mon Sep 17 00:00:00 2001 From: Yazan Majadba Date: Mon, 17 Nov 2025 15:50:26 +0300 Subject: [PATCH 4/4] Update dev-stylelint --- commands/web/dev-stylelint | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/web/dev-stylelint b/commands/web/dev-stylelint index f2fb79f..307c8d3 100755 --- a/commands/web/dev-stylelint +++ b/commands/web/dev-stylelint @@ -10,6 +10,7 @@ source "${0%/*}/dev-utils.sh" # "ddev dev-stylelint --files=file1.css,file2.css" (checks specific files) set -euo pipefail +docroot=$(grep '^docroot:' .ddev/config.yaml | awk '{print $2}') || docroot="docroot" # Define extensions for CSS files EXTENSIONS=("css") @@ -35,7 +36,7 @@ if [ -f "./.stylelintrc.json" ]; then echo "Using local .stylelintrc.json" CONFIG="./.stylelintrc.json" else - CONFIG="docroot/core/.stylelintrc.json" + CONFIG="$docroot/core/.stylelintrc.json" fi -node docroot/core/node_modules/stylelint/bin/stylelint.mjs --config "$CONFIG" --color --allow-empty-input $FILES +node $docroot/core/node_modules/stylelint/bin/stylelint.mjs --config "$CONFIG" --color --allow-empty-input $FILES