Skip to content

Commit 1e61188

Browse files
committed
Add ddev config
1 parent 5b6fc53 commit 1e61188

File tree

15 files changed

+590
-0
lines changed

15 files changed

+590
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: ddev-drupal-contrib
2+
repository: ddev/ddev-drupal-contrib
3+
version: 1.1.4
4+
install_date: "2025-10-07T15:03:13-07:00"
5+
project_files:
6+
- commands/host/core-version
7+
- commands/web/eslint
8+
- commands/web/expand-composer-json
9+
- commands/web/nightwatch
10+
- commands/web/phpcbf
11+
- commands/web/phpcs
12+
- commands/web/phpstan
13+
- commands/web/phpunit
14+
- commands/web/poser
15+
- commands/web/stylelint
16+
- commands/web/symlink-project
17+
- config.contrib.yaml
18+
global_files: []
19+
removal_actions: []

.ddev/commands/host/core-version

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
#ddev-generated
4+
## Command provided by https://github.com/ddev/ddev-drupal-contrib
5+
## Description: Switch the core version and rebuild.
6+
## Usage: core-version [version]
7+
## Example: "ddev core-version ^11" or "ddev core-version ~11.1.0"
8+
9+
set -eu -o pipefail
10+
11+
# Handle default values.
12+
DRUPAL_CORE=${1:-default}
13+
if [ "$DRUPAL_CORE" == "default" ]; then
14+
DRUPAL_CORE=""
15+
fi
16+
17+
# Set/clear the env.
18+
ddev dotenv set .ddev/.env.web --drupal-core "${DRUPAL_CORE}"
19+
20+
# Restart and rebuild.
21+
ddev restart
22+
ddev poser

.ddev/commands/web/eslint

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
#ddev-generated
4+
## Command provided by https://github.com/ddev/ddev-drupal-contrib
5+
## Description: Run eslint inside the web container
6+
## Usage: eslint [flags] [args]
7+
## Example: "ddev eslint"
8+
## ExecRaw: true
9+
10+
set -eu -o pipefail
11+
12+
if "$DDEV_DOCROOT/core/node_modules/.bin/eslint" --version >/dev/null ; then
13+
# Configure prettier
14+
test -e .prettierrc.json || ln -s $DDEV_DOCROOT/core/.prettierrc.json .
15+
test -e .prettierignore || echo '*.yml' > .prettierignore
16+
# Change directory to the project root folder
17+
cd "$DDEV_DOCROOT/$DRUPAL_PROJECTS_PATH/${DDEV_SITENAME//-/_}" || exit
18+
"$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 . "$@"
19+
else
20+
echo "eslint is not available. You may need to 'ddev exec \"cd $DDEV_DOCROOT/core && yarn install\"'"
21+
exit 1
22+
fi
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
#ddev-generated
4+
## Command provided by https://github.com/ddev/ddev-drupal-contrib
5+
## Description: Add Drupal core and other needed dependencies.
6+
## Usage: expand-composer-json [flags] [PROJECT_NAME]
7+
## Example: "ddev expand-composer-json ctools"
8+
## ExecRaw: true
9+
## MutagenSync: true
10+
11+
set -eu -o pipefail
12+
13+
# Set the default core version.
14+
export DRUPAL_CORE=${DRUPAL_CORE:-^11}
15+
16+
export _WEB_ROOT=$DDEV_DOCROOT
17+
cd "$DDEV_COMPOSER_ROOT" || exit
18+
curl -OL https://git.drupalcode.org/project/gitlab_templates/-/raw/default-ref/scripts/expand_composer_json.php
19+
_ddev_drupal_contrib_empty_composer=false
20+
if [[ ! -f composer.json ]]; then
21+
echo "{}" > composer.json
22+
_ddev_drupal_contrib_empty_composer=true
23+
fi
24+
php expand_composer_json.php "$DDEV_SITENAME"
25+
rm -f expand_composer_json.php
26+
if [ "$_ddev_drupal_contrib_empty_composer" = true ]; then
27+
rm -f composer.json
28+
fi

.ddev/commands/web/install

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
## Description: Install Drupal and enable the module
4+
## Usage: install
5+
## Example: "ddev install"
6+
7+
vendor/bin/drush site:install --yes
8+
vendor/bin/drush pm:enable ubc_cwl_auth --yes
9+
vendor/bin/drush user:password admin admin --yes

.ddev/commands/web/nightwatch

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
#ddev-generated
4+
## Command provided by https://github.com/ddev/ddev-drupal-contrib
5+
## Description: Run nightwatch inside the web container
6+
## Usage: nightwatch [flags] [args]
7+
## Example: "ddev nightwatch"
8+
## ExecRaw: true
9+
10+
set -eu -o pipefail
11+
12+
yarn --cwd "$DDEV_DOCROOT/core" test:nightwatch "$DDEV_APPROOT/$DDEV_DOCROOT/$DRUPAL_PROJECTS_PATH/" "$@"

.ddev/commands/web/phpcbf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
#ddev-generated
4+
## Command provided by https://github.com/ddev/ddev-drupal-contrib
5+
## Description: Run phpcbf inside the web container
6+
## Usage: phpcbf [flags] [args]
7+
## Example: "ddev phpcbf" or "ddev phpcbf -n"
8+
## ExecRaw: true
9+
10+
set -eu -o pipefail
11+
12+
if ! command -v phpcbf >/dev/null; then
13+
echo "phpcbf is not available. You may need to 'ddev composer install'"
14+
exit 1
15+
fi
16+
test -e phpcs.xml.dist || curl -OL https://git.drupalcode.org/project/gitlab_templates/-/raw/default-ref/assets/phpcs.xml.dist
17+
phpcbf -s --report-full --report-summary --report-source $DDEV_DOCROOT/$DRUPAL_PROJECTS_PATH "$@"

.ddev/commands/web/phpcs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
#ddev-generated
4+
## Command provided by https://github.com/ddev/ddev-drupal-contrib
5+
## Description: Run phpcs inside the web container
6+
## Usage: phpcs [flags] [args]
7+
## Example: "ddev phpcs" or "ddev phpcs -n"
8+
## ExecRaw: true
9+
10+
set -eu -o pipefail
11+
12+
if ! command -v phpcs >/dev/null; then
13+
echo "phpcs is not available. You may need to 'ddev composer install'"
14+
exit 1
15+
fi
16+
test -e phpcs.xml.dist || curl -OL https://git.drupalcode.org/project/gitlab_templates/-/raw/default-ref/assets/phpcs.xml.dist
17+
phpcs -s --report-full --report-summary --report-source $DDEV_DOCROOT/$DRUPAL_PROJECTS_PATH --ignore=*/.ddev/* "$@"

.ddev/commands/web/phpstan

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
#ddev-generated
4+
## Command provided by https://github.com/ddev/ddev-drupal-contrib
5+
## Description: Run phpstan inside the web container
6+
## Usage: phpstan [flags] [args]
7+
## Example: "ddev phpstan" or "ddev phpstan -n"
8+
## ExecRaw: true
9+
## MutagenSync: true
10+
11+
set -eu -o pipefail
12+
13+
if ! command -v phpstan >/dev/null; then
14+
echo "phpstan is not available. You may need to 'ddev poser'"
15+
exit 1
16+
fi
17+
test -e phpstan.neon || curl -OL https://git.drupalcode.org/project/gitlab_templates/-/raw/default-ref/assets/phpstan.neon
18+
# See https://git.drupalcode.org/project/gitlab_templates/-/commit/a107b7f1f79af12e0b09f70be47b68e3f69b4504
19+
sed -i 's/BASELINE_PLACEHOLDER/phpstan-baseline.neon/g' phpstan.neon
20+
# Add an empty baseline file to ensure it exists.
21+
test -e phpstan-baseline.neon || touch phpstan-baseline.neon
22+
23+
EXTENSION_DIRECTORY=$DDEV_DOCROOT/$DRUPAL_PROJECTS_PATH/${DDEV_SITENAME//-/_}
24+
cd "$EXTENSION_DIRECTORY" || exit 1
25+
# Ensure PHPStan configuration is symlinked from project root.
26+
ln -s $DDEV_DOCROOT/phpstan.neon 2>/dev/null || true
27+
ln -s $DDEV_DOCROOT/phpstan-baseline.neon 2>/dev/null || true
28+
phpstan analyze . "$@"

.ddev/commands/web/phpunit

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
3+
#ddev-generated
4+
## Command provided by https://github.com/ddev/ddev-drupal-contrib
5+
## Description: Run phpunit inside the web container
6+
## Usage: phpunit [flags] [args]
7+
## Example: "ddev phpunit" or "ddev phpunit --stop-on-failure"
8+
## Example: "ddev phpunit web/modules/custom/mymodule/tests/src/Unit/MyTest.php"
9+
## Example: "ddev phpunit --filter testMyFunction"
10+
## ExecRaw: true
11+
12+
set -eu -o pipefail
13+
14+
if ! command -v phpunit >/dev/null; then
15+
echo "phpunit is not available. You may need to 'ddev composer install'"
16+
exit 1
17+
fi
18+
19+
# CHECK for local config.
20+
if [ -f "phpunit.xml" ]; then
21+
# Defer to local config
22+
phpunit "$@"
23+
else
24+
# Check if we are running a specific test or test folder.
25+
if [ $# -gt 0 ] && [ -e "$1" ]; then
26+
TEST_PATH="$1"
27+
shift
28+
phpunit --bootstrap $PWD/$DDEV_DOCROOT/core/tests/bootstrap.php "$TEST_PATH" "$@"
29+
else
30+
# Run all custom module tests.
31+
phpunit --bootstrap $PWD/$DDEV_DOCROOT/core/tests/bootstrap.php $DDEV_DOCROOT/$DRUPAL_PROJECTS_PATH "$@"
32+
fi
33+
fi

0 commit comments

Comments
 (0)