- ๐จ๐ทCosta Rica robertarias
I worked a on adding an unpack composer plugin into core.
This plugin will unpack a recipe's dependencies into the root
composer.json
and update thecomposer.lock
as well. If a recipe has other recipes as dependencies, those will also be unpacked.I created the code working around the idea proposed by @thejimbirch of adding unpacking support for other types of projects (i.e, modules or themes). This way, creating other unpackers should be easy.
Pending tasks:
- Add support to also unpack patches
- Add tests
I will working on the unpack patches during next week and work as feedback is provided, then start adding tests to core for this plugin.
How to test manually
- Make your project support recipes
- Add the plugin repository in your composer.json:
{ "type": "path", "version": "dev-master", "url": "composer/Plugin/Unpack" },
- Require and enable the plugin:
composer config allow-plugins.drupal/core-composer-unpack true
composer require drupal/core-composer-unpack
- Install a recipe!
Upon installing it, its dependencies must be unpacked into your root composer.json. If your recipe depends on other recipes, those recipes should be unpacked as well.
Shout out to @yonas.legesse - I used part of its plugin to create this, thanks!
- ๐จ๐ทCosta Rica robertarias
Per the new requirements (see Slack thread):
The recipe unpack plugin should unpack a recipe upon running
composer require drupal/a-recipe
composer require
would only unpack a recipe's dependencies and it will up to the user whether they apply the recipe or not. What we're trying to avoid is adding a recipe as a dependency, as that's the whole premise of recipes.About how we want to handle a recipe removal, that's another discussion. With this approach, the recipe package reference wouldn't exist in composer.json so
composer remove
would not find it. The remove functionality could be either added into the composer plugin, as a new drush command, or part of the drupal script. - @robert-arias opened merge request.
- ๐จ๐ทCosta Rica robertarias
robert-arias โ made their first commit to this issueโs fork.