From da12af1477184a98e7e16241d71a2145adeeaa58 Mon Sep 17 00:00:00 2001 From: Lauri Eskola Date: Tue, 15 Mar 2022 20:15:22 +0200 Subject: Issue #3267721 by nod_, Wim Leers: Add DrupalCI step for ensuring that CKEditor 5 build files are build correctly --- core/scripts/dev/commit-code-check.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'core/scripts/dev/commit-code-check.sh') diff --git a/core/scripts/dev/commit-code-check.sh b/core/scripts/dev/commit-code-check.sh index d09af83e5e6e..2d434fa7201e 100755 --- a/core/scripts/dev/commit-code-check.sh +++ b/core/scripts/dev/commit-code-check.sh @@ -128,6 +128,10 @@ ESLINT_CONFIG_PASSING_FILE_CHANGED=0 # - core/.stylelintrc.json STYLELINT_CONFIG_FILE_CHANGED=0 +# This variable will be set when a Drupal-specific CKEditor 5 plugin has changed +# it is used to make sure the compiled JS is valid. +CKEDITOR5_PLUGINS_CHANGED=0 + # Build up a list of absolute file names. ABS_FILES= for FILE in $FILES; do @@ -156,6 +160,10 @@ for FILE in $FILES; do ESLINT_CONFIG_PASSING_FILE_CHANGED=1; STYLELINT_CONFIG_FILE_CHANGED=1; fi; + + if [[ -f "$TOP_LEVEL/$FILE" ]] && [[ $FILE =~ \.js$ ]] && [[ $FILE =~ ^core/modules/ckeditor5/js/build || $FILE =~ ^core/modules/ckeditor5/js/ckeditor5_plugins ]]; then + CKEDITOR5_PLUGINS_CHANGED=1; + fi; done # Exit early if there are no files. @@ -285,6 +293,27 @@ if [[ $STYLELINT_CONFIG_FILE_CHANGED == "1" ]]; then printf "\n" fi +# When a Drupal-specific CKEditor 5 plugin changed ensure that it is compiled +# properly. Only check on DrupalCI, since we're concerned about the build being +# run with the expected package versions and making sure the result of the build +# is in sync and conform to expectations. +if [[ "$DRUPALCI" == "1" ]] && [[ $CKEDITOR5_PLUGINS_CHANGED == "1" ]]; then + cd "$TOP_LEVEL/core" + yarn run -s check:ckeditor5 + if [ "$?" -ne "0" ]; then + # If there are failures set the status to a number other than 0. + FINAL_STATUS=1 + printf "\nDrupal-specific CKEditor 5 plugins: ${red}failed${reset}\n" + else + printf "\nDrupal-specific CKEditor 5 plugins: ${green}passed${reset}\n" + fi + cd $TOP_LEVEL + # Add a separator line to make the output easier to read. + printf "\n" + printf -- '-%.0s' {1..100} + printf "\n" +fi + for FILE in $FILES; do STATUS=0; # Print a line to separate spellcheck output from per file output. -- cgit v1.2.3