Create empty composer.json in scoped directory

When installing composer based tools in a scoped directory with old composer versions it breaks if a composer.json is not present in the scoped directory
This commit is contained in:
Shivam Mathur 2022-05-02 11:22:58 +05:30
parent 32d20248ae
commit 846135c190
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -142,6 +142,7 @@ add_composertool_helper() {
scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)" scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)"
if ! [ -d "$scoped_dir" ]; then if ! [ -d "$scoped_dir" ]; then
mkdir -p "$scoped_dir" mkdir -p "$scoped_dir"
echo '{}' | tee "$scoped_dir/composer.json" >/dev/null
composer require "$prefix$release" -d "$scoped_dir" "$composer_args" >/dev/null 2>&1 composer require "$prefix$release" -d "$scoped_dir" "$composer_args" >/dev/null 2>&1
composer show "$prefix$tool" -d "$scoped_dir" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1 composer show "$prefix$tool" -d "$scoped_dir" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
fi fi