Updating Varbase to work with Composer 2.0
Recommended to read:
Recommended to build all new Varbase Projects with Composer 2.0
If the site was built recently with the listed latest releases Varbase 8.8.8 or Varbase 9.0.0-rc1, but the project was built using the Composer 1.0 version. The site is ready to start using Composer 2.0
Only update the Composer from 1.0 to 2.0
Do a
composer update
to update the autoloaders, namespaces map, and classes map.If the site was built with Varbase 8.8.7 and older, Follow the following steps:
Step #1: Update composer to latest composer 1.0 bycomposer self-update --1Step #2: Update Varbase projectcomposer.josn
fileChange the following:"composer/installers": "~1.0","oomphinc/composer-installers-extender": "~1.0","cweagans/composer-patches": "~1.0","drupal/drupal-library-installer-plugin": "^0.3",To:"composer/installers": "~2.0","oomphinc/composer-installers-extender": "~2.0","cweagans/composer-patches": "~1.0",Remove drupal/drupal-library-installer-pluginStep #3: Update Varbase to 8.8.8 or 9.0.0-rc1 with Composer 1.0cd /PATH_TO_THE_PROJECTcomposer update -vvvRepeat this composer update 2 or 3 times to make sure that their are no updatesStep #4: Update composer to latest composer 2.0 bycomposer self-update --2Step #5: Rebuild the autoloader for map of classes and namespacescd /PATH_TO_THE_PROJECTrm -rf composer.lock bin/ vendor/ docroot/modules/contrib/ docroot/themes/contrib/ docroot/profiles/varbase/ docroot/libraries/composer install -vvvcd docroot/drush crAt this point the autoload and real autoload files + mapping should be changed.
When having any custom composer plugins or still having issues.
Or if modules are using the old way of autoloading
Custom Composer plugins must have"composer-plugin-api": "^1.1 || ^2"
Make sure that the rootcomposer.json
file do not have invalidPSR-0
/PSR-4
. And the class configurations will not autoload anymore inoptimized-autoloader
mode, as per the warnings introduced in 1.10
Known issues:
Update the root
composer.json
file with the following composer config "config": {
"bin-dir": "bin/",
"secure-http": false,
"optimize-autoloader": true,
"preferred-install": {
"drupal/core": "dist"
},
"allow-plugins": {
"composer/installers": true,
"cweagans/composer-patches": true,
"oomphinc/composer-installers-extender": true,
"drupal/core-composer-scaffold": true,
"drupal/core-project-message": true,
"vardot/varbase-updater": true
}
},
Rebuild the autoloader for map of classes and namespaces
cd /PATH_TO_YOUR_PROJECT
rm -rf composer.lock bin/ vendor/ docroot/modules/contrib/ docroot/themes/contrib/ docroot/profiles/varbase/ docroot/libraries/
composer install -vvv
cd docroot/
drush cr