1

The project is using Drupal 8 composer template to manage dependencies. Some of the packages are defined locally to look like Drupal modules and be installed in a specific location.

An example could be found here

The issue is that Composer does not store the data about these packages and their version within the .lock file. This means that there does not seem to be a meaningful way to update those custom defined modules with composer itself.

Is there a better way than just writing some custom script, probably relates to some post install procedure that would just visit all of the subdirectories that could possibly be these custom modules and would issue the git pull? Or is there a way to just force composer to reinstall these packages on each composer install run?

We fully control the codebase for these packages/modules and master branches should be safe to use.

  • Aren't your custom modules a part of your site repo? – user72672 Aug 22 '19 at 12:20
  • They should be. But I can see a use case for upstream work. See the composer docs on how to maintain repository endpoints. – Kevin Aug 22 '19 at 12:25
  • You can put each module into its own repo. That only makes sense if the module is going to be shared with another project. – Alfred Armstrong Aug 22 '19 at 12:30
  • Some of those modules are to be reused in other projects. Keeping everything in one repo is not a good solution in the long run. The idea was to manage those with Composer as normal dependencies. We could move some of them into a modules on the Drupal infrastructure. That should allow better management of versions, yet it would not allow fast updated to a possibly unstable codebase. I will check out the Composer docs on the matter, but I guessed that it has already been resolved by the teams using Drupal. – Pjotr Aug 22 '19 at 12:52
  • There is some info over at StackOverflow: stackoverflow.com/questions/34784809/… – Hudri Aug 22 '19 at 12:52
0

You do this with requiring the Composer Merge Plugin in your Drupal project's composer.json and then define in which additional locations it should look for composer.json files to be merged.

Composer Merge Plugin is intended to allow easier dependency management for applications which ship a composer.json file and expect some deployments to install additional Composer managed libraries. It does this by allowing the application's top level composer.json file to provide a list of optional additional configuration files. When Composer is run it will parse these files and merge their configuration settings into the base configuration. This combined configuration will then be used when downloading additional libraries and generating the autoloader.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.