I am using https://packagist.drupal-composer.org/ as Packagist repository for Drupal modules, and I get the version information inside the .info.yml file of the modules I require with
I first added the new repository with
composer config repositories.drupal composer https://packagist.drupal-composer.org/. After, I can add any modules, for example the Focal Point module with a command like the following.
composer require drupal/focal_point 8.1.*@dev
The command install the module and its dependencies, producing the following output.
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing drupal/crop (8.1.0)
- Installing drupal/focal_point (8.1.0-beta3)
drupal/crop suggests installing drupal/media_entity (Required by drupal/crop_media_entity)
Writing lock file
Generating autoload files
If then I check the content of modules/focal_point/focal_point.info.yml and modules/crop/crop.info.yml, I get the following output.
name: Focal Point
description: Allows users to specify the focal point of an image for use during cropping.
# core: 8.x
# version: VERSION
- crop (>=8.x-1.0-alpha2)
# Information added by Drupal.org packaging script on 2016-09-01
name: Crop API
description: 'Provides storage and API for image crops.'
# core: 8.x
# Information added by Drupal.org packaging script on 2016-05-25
In both the cases, the information added from the Drupal.org packaging script is present for both the modules (the one I directly required, and it's dependency). I am using this method for all the module I need in my site, and I have never had problems with the version strings.
To update the modules, I just run
composer update, and Composer updates all the modules with a new version that respects the restriction I set for each module.