Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions commands/web/dev-cspell
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
5 changes: 3 additions & 2 deletions commands/web/dev-eslint
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
5 changes: 3 additions & 2 deletions commands/web/dev-stylelint
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
8 changes: 5 additions & 3 deletions commands/web/dev-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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' ' '
Expand Down Expand Up @@ -94,4 +96,4 @@ get_files() {
fi

echo "$files"
}
}