Problem/Motivation

The recipe unpacker is, in effect, a version lock. When you unpack a recipe and remove it from Composer's awareness, you are pinning it to that specific version.

That's all well and good, but it means we have no way to interrogate Composer to ask which version of the recipe was installed -- which is very much necessary for, say, downloading the correct translation of the recipe.

Normally you'd use the version field in composer.json for that, but there is no guarantee that will be set, because Composer can and does infer versions from things like Git tags and such.

Proposed resolution

The recipe unpacker should alter the unpacked recipe's composer.json file and write the version field explicitly. It has access to the version because it has access to the PackageInterface object and its getPrettyVersion() method.

Issue fork drupal-3607162

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

phenaproxima created an issue. See original summary.

phenaproxima’s picture

Status: Active » Needs review
smustgrave’s picture

Should I see a version key added to the recipe?

phenaproxima’s picture

To the recipe's composer.json, yeah.

smustgrave’s picture

Sorry trying to help test this one.

I applied the MR, downloaded a recipe via composer, but not seeing VERSION key.