Updating a Composer Package - NCIOCPL/cgov-digital-platform GitHub Wiki
- ¡¡¡¡¡NEVER RUN `composer update` EVER!!!!!
- ¡¡¡¡¡NEVER try to update a composer package without having done an install first!!!!!
- Make sure the package that you are updating does not have any patches defined in our composer.json.
- If it does, abort and document how to re-roll the patch...
- Checkout your develop branch
-
composer cgov-clean
to remove current packages -
composer install
to install a fresh set of packages - Checkout a new branch e.g
git checkout -b ticket/123-update-pkg-name
- Install the drupal site (
blt cgov:reinstall --no-interaction
) - Upgrade your package:
composer require <PACKAGE_NAME>:<VERSION> --update-with-dependencies
- E.g.
composer require drupal/acquia_connector:^1.16 --update-with-dependencies
- E.g.
- Run
drush updb --yes
to run any update hooks for the module.- These update hooks CAN modify the configurations, so it is important that we update the configurations in
config/install
- Do not run
blt drupal:update
it will overwrite any updated configs
- These update hooks CAN modify the configurations, so it is important that we update the configurations in
- Run
drush features:list:packages
and export any packages that have changed.Warning Any configs in
profiles/custom/cgov_site/config/install
or in a module that does not have a<module>.features.yml
file will not be exported. You need to update those configs by hand. - Test, including, but not limited to:
- Review the changes to
composer.lock.json
at a high-level. Check and see if only those items you expected were updated. (e.g. if you update the acquia connector module you should not see an update to Drupal core.) -
blt cgov:rebuild-feq && blt cgov:reinstall --no-interaction
- Did drupal install correctly, did the content load?
- Does the site look like a web site?
-
blt paratest
- Did the tests pass?
- If testing works, commit your code and submit a PR
Composer may sometimes fail on some commands with this message:
PHP Fatal error: Allowed memory size of XXXXXX bytes exhausted <...>
In this case, the PHP memory_limit should be increased:
- Find
php.ini
. It should be in/usr/local/etc/php/7.2/php.ini
, but to be sure, runphp -i | grep php.ini
to find the path. - Open php.ini and find the line that says
memory_limit = <some_number>
. Change the number to the desired value or-1
for unlimited.