diff --git a/README.md b/README.md index 1cfd21a..36a5401 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,10 @@ Commands ============ This project provides the following DDEV container commands. -- [ddev poser](https://github.com/ddev/ddev-drupal-contrib/blob/main/commands/web/poser). This edits composer.json so that `drupal/core-recommended` becomes a dev dependency. then, it runs `composer install`. It is perfectly acceptable to skip this command and edit the require-dev of composer.json by hand. +- [ddev poser](https://github.com/ddev/ddev-drupal-contrib/blob/main/commands/web/poser). + - Edits composer.json so that `drupal/core-recommended` becomes a dev dependency. + - Runs `composer install` AND `yarn install` so that dependencies are available. + - Note: it is perfectly acceptable to skip this command and edit the require-dev of composer.json by hand. - [ddev symlink-project](https://github.com/ddev/ddev-drupal-contrib/blob/main/commands/web/symlink-project). This symlinks the top level files of your project into web/modules/custom so that Drupal finds your module. This command runs automatically on every `ddev start`. See codebase image below. - `ddev phpunit`. Run phpunit tests on the web/modules/custom directory. - `ddev nightwatch`. Run nightwatch tests on the web/modules/custom directory. diff --git a/commands/web/eslint b/commands/web/eslint index 26b0b70..e7d234f 100755 --- a/commands/web/eslint +++ b/commands/web/eslint @@ -9,7 +9,12 @@ ## ExecRaw: true if "$DDEV_DOCROOT/core/node_modules/.bin/eslint" --version >/dev/null ; then - "$DDEV_DOCROOT/core/node_modules/.bin/eslint" --no-error-on-unmatched-pattern --ignore-pattern "*.es6.js" --config "$DDEV_DOCROOT/core/.eslintrc.legacy.json" --resolve-plugins-relative-to "$DDEV_DOCROOT/core" "$DDEV_DOCROOT/modules/custom/**/*.js" + # 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 + "$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/core/node_modules/.bin/eslint" --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 yarn --cwd $DDEV_DOCROOT/core install'" exit 1 diff --git a/commands/web/phpunit b/commands/web/phpunit index 9bf9cb9..e4c5ddc 100755 --- a/commands/web/phpunit +++ b/commands/web/phpunit @@ -12,4 +12,4 @@ if ! command -v phpunit >/dev/null; then echo "phpunit is not available. You may need to 'ddev composer install'" exit 1 fi -phpunit --printer="\Drupal\Tests\Listeners\HtmlOutputPrinter" --bootstrap web/core/tests/bootstrap.php --testdox web/modules/custom "$@" +phpunit --printer="\Drupal\Tests\Listeners\HtmlOutputPrinter" --bootstrap $PWD/$DDEV_DOCROOT/core/tests/bootstrap.php --testdox web/modules/custom "$@" diff --git a/tests/test.bats b/tests/test.bats index b8fc3e8..a750b22 100644 --- a/tests/test.bats +++ b/tests/test.bats @@ -34,6 +34,5 @@ teardown() { ddev yarn --cwd web/core install ddev exec touch web/core/.env ddev stylelint --version - # Awaiting resolution of eslint-plugin-prettier missing error https://drupal.slack.com/archives/CGKLP028K/p1682724930680409 - # ddev eslint --version -} \ No newline at end of file + ddev eslint --version +}