From 56ce94e63f385471a5c098a2c64256994245caf2 Mon Sep 17 00:00:00 2001 From: James Wilson Date: Mon, 28 Apr 2025 03:00:16 -0500 Subject: [PATCH] feat: use DRUPAL_PROJECTS_PATH for all commands --- commands/web/eslint | 3 ++- commands/web/nightwatch | 3 ++- commands/web/phpcbf | 3 ++- commands/web/phpcs | 3 ++- commands/web/phpstan | 3 ++- commands/web/phpunit | 3 ++- commands/web/stylelint | 3 ++- commands/web/symlink-project | 2 +- 8 files changed, 15 insertions(+), 8 deletions(-) diff --git a/commands/web/eslint b/commands/web/eslint index 9afbe70..000ce64 100755 --- a/commands/web/eslint +++ b/commands/web/eslint @@ -7,12 +7,13 @@ ## Example: "ddev eslint" ## ExecRaw: true +DRUPAL_PROJECTS_PATH=${DRUPAL_PROJECTS_PATH:-modules/custom} if "$DDEV_DOCROOT/core/node_modules/.bin/eslint" --version >/dev/null ; then # Configure prettier test -e .prettierrc.json || ln -s $DDEV_DOCROOT/core/.prettierrc.json . test -e .prettierignore || echo '*.yml' > .prettierignore # Change directory to the project root folder - cd "$DDEV_DOCROOT/modules/custom/${DDEV_SITENAME//-/_}" || exit + cd "$DDEV_DOCROOT/$DRUPAL_PROJECTS_PATH/${DDEV_SITENAME//-/_}" || exit "$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/core/node_modules/.bin/eslint" --config="../../../core/.eslintrc.passing.json" --no-error-on-unmatched-pattern --ignore-pattern="*.es6.js" --resolve-plugins-relative-to=$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/core --ext=.js,.yml . "$@" else echo "eslint is not available. You may need to 'ddev exec \"cd $DDEV_DOCROOT/core && yarn install\"'" diff --git a/commands/web/nightwatch b/commands/web/nightwatch index 99089b5..99c3f19 100755 --- a/commands/web/nightwatch +++ b/commands/web/nightwatch @@ -7,4 +7,5 @@ ## Example: "ddev nightwatch" ## ExecRaw: true -yarn --cwd "$DDEV_DOCROOT/core" test:nightwatch "$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/modules/custom/" "$@" +DRUPAL_PROJECTS_PATH=${DRUPAL_PROJECTS_PATH:-modules/custom} +yarn --cwd "$DDEV_DOCROOT/core" test:nightwatch "$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/$DRUPAL_PROJECTS_PATH/" "$@" diff --git a/commands/web/phpcbf b/commands/web/phpcbf index 48ab77a..465d8ac 100755 --- a/commands/web/phpcbf +++ b/commands/web/phpcbf @@ -7,9 +7,10 @@ ## Example: "ddev phpcbf" or "ddev phpcbf -n" ## ExecRaw: true +DRUPAL_PROJECTS_PATH=${DRUPAL_PROJECTS_PATH:-modules/custom} if ! command -v phpcbf >/dev/null; then echo "phpcbf is not available. You may need to 'ddev composer install'" exit 1 fi test -e phpcs.xml.dist || curl -OL https://git.drupalcode.org/project/gitlab_templates/-/raw/default-ref/assets/phpcs.xml.dist -phpcbf -s --report-full --report-summary --report-source $DDEV_DOCROOT/modules/custom "$@" +phpcbf -s --report-full --report-summary --report-source $DDEV_DOCROOT/$DRUPAL_PROJECTS_PATH "$@" diff --git a/commands/web/phpcs b/commands/web/phpcs index 8e34f9f..87002a0 100755 --- a/commands/web/phpcs +++ b/commands/web/phpcs @@ -7,9 +7,10 @@ ## Example: "ddev phpcs" or "ddev phpcs -n" ## ExecRaw: true +DRUPAL_PROJECTS_PATH=${DRUPAL_PROJECTS_PATH:-modules/custom} if ! command -v phpcs >/dev/null; then echo "phpcs is not available. You may need to 'ddev composer install'" exit 1 fi test -e phpcs.xml.dist || curl -OL https://git.drupalcode.org/project/gitlab_templates/-/raw/default-ref/assets/phpcs.xml.dist -phpcs -s --report-full --report-summary --report-source $DDEV_DOCROOT/modules/custom --ignore=*/.ddev/* "$@" +phpcs -s --report-full --report-summary --report-source $DDEV_DOCROOT/$DRUPAL_PROJECTS_PATH --ignore=*/.ddev/* "$@" diff --git a/commands/web/phpstan b/commands/web/phpstan index 11edce8..f1b1037 100755 --- a/commands/web/phpstan +++ b/commands/web/phpstan @@ -7,6 +7,7 @@ ## Example: "ddev phpstan" or "ddev phpstan -n" ## ExecRaw: true +DRUPAL_PROJECTS_PATH=${DRUPAL_PROJECTS_PATH:-modules/custom} if ! command -v phpstan >/dev/null; then echo "phpstan is not available. You may need to 'ddev poser'" exit 1 @@ -16,4 +17,4 @@ test -e phpstan.neon || curl -OL https://git.drupalcode.org/project/gitlab_templ sed -i 's/BASELINE_PLACEHOLDER/phpstan-baseline.neon/g' phpstan.neon # Add an empty baseline file to ensure it exists. test -e phpstan-baseline.neon || touch phpstan-baseline.neon -phpstan analyse $DDEV_DOCROOT/modules/custom "$@" +phpstan analyse $DDEV_DOCROOT/$DRUPAL_PROJECTS_PATH "$@" diff --git a/commands/web/phpunit b/commands/web/phpunit index 8d936a8..993fc3a 100755 --- a/commands/web/phpunit +++ b/commands/web/phpunit @@ -7,6 +7,7 @@ ## Example: "ddev phpunit" or "ddev phpunit --stop-on-failure" ## ExecRaw: true +DRUPAL_PROJECTS_PATH=${DRUPAL_PROJECTS_PATH:-modules/custom} if ! command -v phpunit >/dev/null; then echo "phpunit is not available. You may need to 'ddev composer install'" exit 1 @@ -18,5 +19,5 @@ if [ -f "phpunit.xml" ]; then phpunit "$@" else # Bootstrap Drupal tests and run all custom module tests. - phpunit --bootstrap $PWD/$DDEV_DOCROOT/core/tests/bootstrap.php $DDEV_DOCROOT/modules/custom "$@" + phpunit --bootstrap $PWD/$DDEV_DOCROOT/core/tests/bootstrap.php $DDEV_DOCROOT/$DRUPAL_PROJECTS_PATH "$@" fi diff --git a/commands/web/stylelint b/commands/web/stylelint index 677c270..eef30a2 100755 --- a/commands/web/stylelint +++ b/commands/web/stylelint @@ -7,9 +7,10 @@ ## Example: "ddev stylelint" ## ExecRaw: true +DRUPAL_PROJECTS_PATH=${DRUPAL_PROJECTS_PATH:-modules/custom} if $DDEV_DOCROOT/core/node_modules/.bin/stylelint --version >/dev/null ; then # Change directory to the project root folder - cd "$DDEV_DOCROOT/modules/custom/${DDEV_SITENAME//-/_}" || exit + cd "$DDEV_DOCROOT/$DRUPAL_PROJECTS_PATH/${DDEV_SITENAME//-/_}" || exit "$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/core/node_modules/.bin/stylelint" --color --config "$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/core/.stylelintrc.json" "./**/*.css" "$@" else echo "stylelint is not available. You may need to 'ddev exec \"cd $DDEV_DOCROOT/core && yarn install\"'" diff --git a/commands/web/symlink-project b/commands/web/symlink-project index 0a4b296..4b64015 100755 --- a/commands/web/symlink-project +++ b/commands/web/symlink-project @@ -2,7 +2,7 @@ #ddev-generated ## Command provided by https://github.com/ddev/ddev-drupal-contrib -## Description: Symlink all root files/dirs into web.modules/custom/[PROJECT_NAME] +## Description: Symlink all root files/dirs into web/modules/custom/[PROJECT_NAME] ## Usage: symlink-project [flags] [args] ## Example: "ddev symlink-project" ## ExecRaw: true