···11+# shellcheck shell=bash
22+13declare -g version
24declare -g -i composerStrictValidation="${composerStrictValidation:-0}"
3546setComposerRootVersion() {
55- if [[ -n $version ]]; then
66- echo -e "\e[32mSetting COMPOSER_ROOT_VERSION to $version\e[0m"
77- export COMPOSER_ROOT_VERSION="$version"
88- fi
77+ if [[ -n $version ]]; then
88+ echo -e "\e[32mSetting COMPOSER_ROOT_VERSION to $version\e[0m"
99+ export COMPOSER_ROOT_VERSION="$version"
1010+ fi
911}
10121113setComposerEnvVariables() {
1212- echo -e "\e[32mSetting some required environment variables for Composer...\e[0m"
1313- export COMPOSER_MIRROR_PATH_REPOS=1
1414- export COMPOSER_HTACCESS_PROTECT=0
1515- export COMPOSER_FUND=0
1414+ echo -e "\e[32mSetting some required environment variables for Composer...\e[0m"
1515+ export COMPOSER_MIRROR_PATH_REPOS=1
1616+ export COMPOSER_HTACCESS_PROTECT=0
1717+ export COMPOSER_FUND=0
1618}
17191820checkComposerValidate() {
1919- command="composer validate --strict --quiet --no-interaction --no-check-all --no-check-lock"
2020- if ! $command; then
2121- if [[ "${composerStrictValidation}" == "1" ]]; then
2222- echo
2323- echo -e "\e[31mERROR: composer files validation failed\e[0m"
2424- echo
2525- echo -e '\e[31mThe validation of the composer.json failed.\e[0m'
2626- echo -e '\e[31mMake sure that the file composer.json is valid.\e[0m'
2727- echo
2828- echo -e '\e[31mTo address the issue efficiently, follow one of these steps:\e[0m'
2929- echo -e '\e[31m 1. File an issue in the project'\''s issue tracker with detailed information, and apply any available remote patches as a temporary solution '\('with fetchpatch'\)'.\e[0m'
3030- echo -e '\e[31m 2. If an immediate fix is needed or if reporting upstream isn'\''t suitable, develop a temporary local patch.\e[0m'
3131- echo
3232- exit 1
3333- else
3434- echo
3535- echo -e "\e[33mWARNING: composer files validation failed\e[0m"
3636- echo
3737- echo -e '\e[33mThe validation of the composer.json failed.\e[0m'
3838- echo -e '\e[33mMake sure that the file composer.json is valid.\e[0m'
3939- echo
4040- echo -e '\e[33mTo address the issue efficiently, follow one of these steps:\e[0m'
4141- echo -e '\e[33m 1. File an issue in the project'\''s issue tracker with detailed information, and apply any available remote patches as a temporary solution with '\('with fetchpatch'\)'.\e[0m'
4242- echo -e '\e[33m 2. If an immediate fix is needed or if reporting upstream isn'\''t suitable, develop a temporary local patch.\e[0m'
4343- echo
4444- echo -e '\e[33mThis check is not blocking, but it is recommended to fix the issue.\e[0m'
4545- echo
4646- fi
2121+ command="composer validate --strict --quiet --no-interaction --no-check-all --no-check-lock"
2222+ if ! $command; then
2323+ echo
2424+ echo -e "\e[31mERROR: composer files validation failed\e[0m"
2525+ echo
2626+ echo -e '\e[31mThe validation of the composer.json failed.\e[0m'
2727+ echo -e '\e[31mMake sure that the file composer.json is valid.\e[0m'
2828+ echo
2929+ echo -e '\e[31mTo address the issue efficiently, follow one of these steps:\e[0m'
3030+ echo -e '\e[31m 1. File an issue in the project'\''s issue tracker with detailed information, and apply any available remote patches as a temporary solution '\('with fetchpatch'\)'.\e[0m'
3131+ echo -e '\e[31m 2. If an immediate fix is needed or if reporting upstream isn'\''t suitable, develop a temporary local patch.\e[0m'
3232+ echo
3333+3434+ if [[ "${composerStrictValidation}" == "1" ]]; then
3535+ echo
3636+ echo -e '\e[33mThis check is blocking, set the attribute composerStrictValidation to false to make it not blocking.\e[0m'
3737+ echo
3838+ exit 1
3939+ else
4040+ echo
4141+ echo -e '\e[33mThis check is not blocking, but it is recommended to fix the issue.\e[0m'
4242+ echo
4743 fi
4444+ fi
48454949- command="composer validate --strict --no-ansi --no-interaction --quiet --no-check-all --check-lock"
5050- if ! $command; then
5151- if [[ "${composerStrictValidation}" == "1" ]]; then
5252- echo
5353- echo -e "\e[31mERROR: composer files validation failed\e[0m"
5454- echo
5555- echo -e '\e[31mThe validation of the composer.json and composer.lock failed.\e[0m'
5656- echo -e '\e[31mMake sure that the file composer.lock is consistent with composer.json.\e[0m'
5757- echo
5858- echo -e '\e[31mThis often indicates an issue with the upstream project, which can typically be resolved by reporting the issue to the relevant project maintainers.\e[0m'
5959- echo
6060- echo -e '\e[31mTo address the issue efficiently, follow one of these steps:\e[0m'
6161- echo -e '\e[31m 1. File an issue in the project'\''s issue tracker with detailed information '\('run '\''composer update --lock --no-install'\'' to fix the issue'\)', and apply any available remote patches as a temporary solution with '\('with fetchpatch'\)'.\e[0m'
6262- echo -e '\e[31m 2. If an immediate fix is needed or if reporting upstream isn'\''t suitable, develop a temporary local patch.\e[0m'
6363- echo
6464- exit 1
6565- else
6666- echo
6767- echo -e "\e[33mWARNING: composer files validation failed\e[0m"
6868- echo
6969- echo -e '\e[33mThe validation of the composer.json and composer.lock failed.\e[0m'
7070- echo -e '\e[33mMake sure that the file composer.lock is consistent with composer.json.\e[0m'
7171- echo
7272- echo -e '\e[33mThis often indicates an issue with the upstream project, which can typically be resolved by reporting the issue to the relevant project maintainers.\e[0m'
7373- echo
7474- echo -e '\e[33mTo address the issue efficiently, follow one of these steps:\e[0m'
7575- echo -e '\e[33m 1. File an issue in the project'\''s issue tracker with detailed information '\('run '\''composer update --lock --no-install'\'' to fix the issue'\)', and apply any available remote patches as a temporary solution with '\('with fetchpatch'\)'.\e[0m'
7676- echo -e '\e[33m 2. If an immediate fix is needed or if reporting upstream isn'\''t suitable, develop a temporary local patch.\e[0m'
7777- echo
7878- echo -e '\e[33mThis check is not blocking, but it is recommended to fix the issue.\e[0m'
7979- echo
8080- fi
4646+ command="composer validate --strict --no-ansi --no-interaction --quiet --no-check-all --check-lock"
4747+ if ! $command; then
4848+ echo
4949+ echo -e "\e[31mERROR: composer files validation failed\e[0m"
5050+ echo
5151+ echo -e '\e[31mThe validation of the composer.json and composer.lock failed.\e[0m'
5252+ echo -e '\e[31mMake sure that the file composer.lock is consistent with composer.json.\e[0m'
5353+ echo
5454+ echo -e '\e[31mThis often indicates an issue with the upstream project, which can typically be resolved by reporting the issue to the relevant project maintainers.\e[0m'
5555+ echo
5656+ echo -e '\e[31mTo address the issue efficiently, follow one of these steps:\e[0m'
5757+ echo -e '\e[31m 1. File an issue in the project'\''s issue tracker with detailed information '\('run '\''composer update --lock --no-install'\'' to fix the issue'\)', and apply any available remote patches as a temporary solution with '\('with fetchpatch'\)'.\e[0m'
5858+ echo -e '\e[31m 2. If an immediate fix is needed or if reporting upstream isn'\''t suitable, develop a temporary local patch.\e[0m'
5959+ echo
6060+6161+ if [[ "${composerStrictValidation}" == "1" ]]; then
6262+ echo
6363+ echo -e '\e[33mThis check is blocking, set the attribute composerStrictValidation to false to make it not blocking.\e[0m'
6464+ echo
6565+ exit 1
6666+ else
6767+ echo
6868+ echo -e '\e[33mThis check is not blocking, but it is recommended to fix the issue.\e[0m'
6969+ echo
8170 fi
7171+ fi
8272}