diff options
author | Lee Rowlands <lee.rowlands@previousnext.com.au> | 2021-05-22 17:47:25 +1000 |
---|---|---|
committer | Lee Rowlands <lee.rowlands@previousnext.com.au> | 2021-05-22 17:47:25 +1000 |
commit | 98a653c2ff214ccba4aa5fca9427280b0b4eaec9 (patch) | |
tree | 2fa4b053065d4ff6b878fef77af86102b5b298df /core/scripts/dev/commit-code-check.sh | |
parent | 40dabffe254f075d9076102e4612b951d1327eb3 (diff) | |
download | drupal-98a653c2ff214ccba4aa5fca9427280b0b4eaec9.tar.gz drupal-98a653c2ff214ccba4aa5fca9427280b0b4eaec9.zip |
Issue #3195888 by alexpott, quietone: Check dependencies are correct in core/scripts/dev/commit-code-check.sh
Diffstat (limited to 'core/scripts/dev/commit-code-check.sh')
-rwxr-xr-x | core/scripts/dev/commit-code-check.sh | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/core/scripts/dev/commit-code-check.sh b/core/scripts/dev/commit-code-check.sh index 7252c9364bd3..4e1211b2657c 100755 --- a/core/scripts/dev/commit-code-check.sh +++ b/core/scripts/dev/commit-code-check.sh @@ -123,8 +123,31 @@ fi; # run and all dependencies are updated. FINAL_STATUS=0 -# Check all files for spelling in one go for better performance. +DEPENDENCIES_NEED_INSTALLING=0 +# Ensure PHP development dependencies are installed. +# @todo https://github.com/composer/composer/issues/4497 Improve this to +# determine if dependencies in the lock file match the installed versions. +# Using composer install --dry-run is not valid because it would depend on +# user-facing strings in Composer. +if ! [[ -f 'vendor/bin/phpcs' ]]; then + printf "Drupal's PHP development dependencies are not installed. Run 'composer install' from the root directory.\n" + DEPENDENCIES_NEED_INSTALLING=1; +fi + cd "$TOP_LEVEL/core" + +# Ensure JavaScript development dependencies are installed. +yarn check -s 2>/dev/null +if [ "$?" -ne "0" ]; then + printf "Drupal's JavaScript development dependencies are not installed. Run 'yarn install' inside the core directory.\n" + DEPENDENCIES_NEED_INSTALLING=1; +fi + +if [ $DEPENDENCIES_NEED_INSTALLING -ne 0 ]; then + exit 1; +fi + +# Check all files for spelling in one go for better performance. yarn run -s spellcheck -c $TOP_LEVEL/core/.cspell.json $ABS_FILES if [ "$?" -ne "0" ]; then # If there are failures set the status to a number other than 0. |