Lando, Composer & jq¶
This commands are meant to be run in a Lando environment for Drupal managed via composer.
Please also install jq prior to running.
lando composer outdated "dru*" --format=json | jq --raw-output '. ["installed"][] | [.name, ((.version | split(".")[0])), ((.latest | split(".")[0])), if (((.version | split(".")[0])) == ((.latest | split(".")[0]))) then "composer update '\''" + .name + "'\'' -W" else "composer require '\''" + .name + ":^" + ((.latest | split(".")[0])) + "'\''" end] | @csv'
lando composer outdated "dru*" --format=json | jq --raw-output '. ["installed"][] | [if (((.version | split(".")[0])) == ((.latest | split(".")[0]))) then "composer update '\''" + .name + "'\'' -W" else "composer require '\''" + .name + ":^" + ((.latest | split(".")[0])) + "'\''" end] | @csv'
lando composer outdated "dru*" --format=json | jq --raw-output '. ["installed"][] | [if (((.version | split(".")[0])) == ((.latest | split(".")[0]))) then "composer update '\''" + .name + "'\'' -W" else "composer require '\''" + .name + ":^" + ((.latest | split(".")[0])) + "'\''" end] | .[]' > update.txt
# Outputs update commands for Drupal
# Please note that sometimes this command
# gives an error mentioned below.
# If this is the case, run the command once again.
lando composer outdated "dru*" --format=json | jq --raw-output '. ["installed"][] | ["git add drupal/composer.lock", "git add drupal/composer.json", "git commit -m \"Upgrade " + .name + " (" + .version + " => " + .latest + ")\"",if (((.version | split(".")[0])) == ((.latest | split(".")[0]))) then "lando composer update '\''" + .name + "'\'' -W" else "lando composer require '\''" + .name + ":^" + ((.latest | split(".")[0])) + "'\'' -W" end, ""] | .[]' > update_$(date +"%Y%m%d_%H%M%S").txt