Skip to content

feat: use DRUPAL_PROJECTS_PATH for all commands. fixes #111 #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
3 changes: 2 additions & 1 deletion commands/web/eslint
Original file line number Diff line number Diff line change
Expand Up @@ -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\"'"
Expand Down
3 changes: 2 additions & 1 deletion commands/web/nightwatch
Original file line number Diff line number Diff line change
Expand Up @@ -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/" "$@"
3 changes: 2 additions & 1 deletion commands/web/phpcbf
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"
3 changes: 2 additions & 1 deletion commands/web/phpcs
Original file line number Diff line number Diff line change
Expand Up @@ -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/* "$@"
3 changes: 2 additions & 1 deletion commands/web/phpstan
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 "$@"
3 changes: 2 additions & 1 deletion commands/web/phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
3 changes: 2 additions & 1 deletion commands/web/stylelint
Original file line number Diff line number Diff line change
Expand Up @@ -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\"'"
Expand Down
2 changes: 1 addition & 1 deletion commands/web/symlink-project
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down