diff --git a/commands/host/xb-setup b/commands/host/xb-setup index 43fd339..522149c 100755 --- a/commands/host/xb-setup +++ b/commands/host/xb-setup @@ -82,6 +82,9 @@ ddev start printf '\n# Allow test modules and themes to be installed.\n$settings["extension_discovery_scan_tests"] = TRUE;' \ >> web/sites/default/settings.ddev.php +# Install Drupal core NPM packages. +ddev exec --dir /var/www/html/web/core -- npm install + # Build front-end assets. ddev xb-npm-build diff --git a/commands/web/xb-stylelint b/commands/web/xb-stylelint new file mode 100755 index 0000000..c58a5cd --- /dev/null +++ b/commands/web/xb-stylelint @@ -0,0 +1,14 @@ +#!/bin/bash + +## #ddev-generated +## Description: Check Experience Builder code for standards compliance with PHPCS. +## Example: ddev xb-stylelint +## Aliases: stylelint,css + +UI_DIR="$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/modules/contrib/experience_builder/ui" +cd "$UI_DIR" || exit 1 + +npx stylelint \ + --config "$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/core/.stylelintrc.json" \ + --ignore-pattern "dist/**/*" \ + "$UI_DIR/**/*.css" diff --git a/commands/web/xb-stylelint-fix b/commands/web/xb-stylelint-fix new file mode 100755 index 0000000..e573716 --- /dev/null +++ b/commands/web/xb-stylelint-fix @@ -0,0 +1,15 @@ +#!/bin/bash + +## #ddev-generated +## Description: Check Experience Builder code for standards compliance with PHPCS. +## Example: ddev xb-stylelint-fix +## Aliases: stylelint-fix,stylelint:fix,css-fix,css:fix + +UI_DIR="$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/modules/contrib/experience_builder/ui" +cd "$UI_DIR" || exit 1 + +npx stylelint \ + --config "$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/core/.stylelintrc.json" \ + --ignore-pattern "dist/**/*" \ + "$UI_DIR/**/*.css" \ + --fix diff --git a/install.yaml b/install.yaml index 62c5ef5..21244d3 100644 --- a/install.yaml +++ b/install.yaml @@ -17,6 +17,8 @@ project_files: - commands/web/xb-phpcs - commands/web/xb-phpstan - commands/web/xb-phpunit + - commands/web/xb-stylelint + - commands/web/xb-stylelint-fix - config.drupal-xb-dev.yaml post_install_actions: