Is there a way to update custom packages with composer? 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.
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.