Issue #3352635 by Spokje: Run yarn build:css in core/scripts/dev/commit-code-check.sh whenever core/package.json and/or core/package.lock change

merge-requests/3445/merge
nod_ 2023-04-07 10:50:44 +02:00
parent 9e84cb4e52
commit 6f67102542
No known key found for this signature in database
GPG Key ID: 76624892606FA197
1 changed files with 26 additions and 0 deletions

View File

@ -129,6 +129,12 @@ ESLINT_CONFIG_PASSING_FILE_CHANGED=0
# - core/.stylelintrc.json
STYLELINT_CONFIG_FILE_CHANGED=0
# This variable will be set to one when JavaScript packages files are changed.
# changed:
# - core/package.json
# - core/yarn.lock
JAVASCRIPT_PACKAGES_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
@ -160,6 +166,7 @@ for FILE in $FILES; do
if [[ $FILE == "core/package.json" || $FILE == "core/yarn.lock" ]]; then
ESLINT_CONFIG_PASSING_FILE_CHANGED=1;
STYLELINT_CONFIG_FILE_CHANGED=1;
JAVASCRIPT_PACKAGES_CHANGED=1;
fi;
if [[ -f "$TOP_LEVEL/$FILE" ]] && [[ $FILE =~ \.js$ ]] && [[ $FILE =~ ^core/modules/ckeditor5/js/build || $FILE =~ ^core/modules/ckeditor5/js/ckeditor5_plugins ]]; then
@ -317,6 +324,25 @@ if [[ "$DRUPALCI" == "1" ]] && [[ $CKEDITOR5_PLUGINS_CHANGED == "1" ]]; then
printf "\n"
fi
# When JavaScript packages change, then rerun all JavaScript style checks.
if [[ "$JAVASCRIPT_PACKAGES_CHANGED" == "1" ]]; then
cd "$TOP_LEVEL/core"
yarn run build:css --check
CORRECTCSS=$?
if [ "$CORRECTCSS" -ne "0" ]; then
FINAL_STATUS=1
printf "\n${red}ERROR: The compiled CSS from the PCSS files"
printf "\n does not match the current CSS files. Some added"
printf "\n or updated JavaScript package made changes."
printf "\n Recompile the CSS with: yarn run build:css${reset}\n\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.