Try to parse version in composer if not in .info.yml

Created on 16 May 2024, about 1 year ago

Problem/Motivation

From #3440128: version in info.yml for general project β†’ , when using an installation profile, there is no "version" put automatically in .info.yml file of the profile and in its modules/themes .info.yml files.

This will provoke a fatal error on status report page due to:

TypeError: Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in /project/app/core/lib/Drupal/Component/Render/FormattableMarkup.php on line 256 in Drupal\Component\Utility\Html::escape() (line 431 of core/lib/Drupal/Component/Utility/Html.php).
Drupal\Component\Render\FormattableMarkup::placeholderEscape(NULL) (Line: 229)
Drupal\Component\Render\FormattableMarkup::placeholderFormat('%profile_name (%profile-%version)', Array) (Line: 195)
Drupal\Core\StringTranslation\TranslatableMarkup->render() (Line: 15)
Drupal\Core\StringTranslation\TranslatableMarkup->__toString() (Line: 336)
Twig\Template->render(Array) (Line: 38)
Twig\TemplateWrapper->render(Array) (Line: 39)
twig_render_template('core/themes/claro/templates/status-report-grouped.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('status_report_grouped', Array) (Line: 446)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 203)
Drupal\Core\Render\Renderer->render(Array) (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 80)
__TwigTemplate_71280d5a17f166e234dcd7a30c6eb76d->doDisplay(Array, Array) (Line: 360)
Twig\Template->yield(Array) (Line: 335)
Twig\Template->render(Array) (Line: 38)
Twig\TemplateWrapper->render(Array) (Line: 39)
twig_render_template('core/themes/claro/templates/status-report-page.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('status_report_page', Array) (Line: 446)
...

Also it would be nice that this kind of information would be handled with Composer data directly. Not only for installation profile, but also for modules and themes.

Steps to reproduce

Install a module in dev version using composer composer require drupal/address:2.0.x-dev.
On admin/modules, there is no indicated version for the module.

Proposed resolution

Try to get data from Composer.

Remaining tasks

- POC: MR incoming
- handle sub-extensions
- if possible make the hardcoded 'drupal/' dynamic.

User interface changes

Versions of extensions not present in .info.yml but handled with Composer will be displayed on the admin pages.

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component
ExtensionΒ  β†’

Last updated 3 days ago

No maintainer
Created by

πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Grimreaper
  • Pipeline finished with Canceled
    about 1 year ago
    Total: 18s
    #174525
  • Issue was unassigned.
  • Status changed to Needs work about 1 year ago
  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

    Attaching patch for Composer usage.

  • Pipeline finished with Failed
    about 1 year ago
    Total: 666s
    #174526
  • Status changed to Needs review about 1 year ago
  • πŸ‡΅πŸ‡°Pakistan isalmanhaider

    +1
    @grimreaper, I support the proposed resolution to parse version information from Composer when not available in .info.yml.

    This change will improve consistency and prevent errors on the status report page, ensuring that version information is reliably available. Leveraging Composer for this purpose aligns with best practices in dependency management and enhances the overall reliability of the system.

  • Status changed to Needs work about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Didn't check the Unit failure to see if related but definitely something that will need test coverage.

  • Pipeline finished with Success
    about 1 year ago
    Total: 693s
    #175731
  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

    @isalmanhaider thanks for your interest in the proposed resolution.

    @smustgrave the existing tests failure was related. I have fixed it.

    Status needs to remain "needs work" because of all the other remaining tasks to discuss/to do (implementing new tests is of course among the remaining points).

  • πŸ‡³πŸ‡ΏNew Zealand quietone
  • Pipeline finished with Canceled
    5 days ago
    Total: 542s
    #561435
  • Pipeline finished with Canceled
    5 days ago
    Total: 480s
    #561436
  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

    MR now targeting 11.x.

    Rebased.

    And changes updated to handle dev version of packages.

  • Pipeline finished with Success
    5 days ago
    Total: 420s
    #561445
  • πŸ‡³πŸ‡±Netherlands idebr

    This feature is available through contrib, see https://www.drupal.org/project/composer_deploy β†’

  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

    Thanks for the link, I will give a look.

    It would be better to avoid the need a contrib module for that, and Core to be able to handle it by itself.

  • Pipeline finished with Failed
    about 12 hours ago
    #564291
Production build 0.71.5 2024