tijsverkoyen / CssToInlineStyles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very usefull when you're sending emails.
BSD 3-Clause "New" or "Revised" License
5.8k stars 187 forks source link

[Drupal] Problems with versions in dependency symfony/css-selector #202

Closed davidjguru closed 3 years ago

davidjguru commented 4 years ago

When I was working with Varbase for Drupal 9 I found problems in the installation of Drupal Console due to a conflict with dependency versions. I was installing Varbase with Drupal 9 when after the build of the codebase, I added a simply order to download Drupal Console last version (1.9.5) with Drupal 9 Support, but I got an error from conflicts in versions, just like this:

$ ddev composer require drupal/console:^1.9.5
   ./composer.json has been updated
   Loading composer repositories with package information
   Updating dependencies (including require-dev)
   Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for drupal/console ^1.9.5 -> satisfiable by drupal/console[1.9.5].
    - Conclusion: remove symfony/css-selector v5.1.7
    - Conclusion: don't install symfony/css-selector v5.1.7
    - drupal/console 1.9.5 requires symfony/css-selector ~3.0|~4.0

So, by now, we can not work in Drupal 9 using the Drupal Console tool mixing with some varbase modules.

This conflict exists due to a former version of symfony/css-selector previously installed as dependency, from the chain: $ composer depends symfony/css-selector tijsverkoyen/css-to-inline-styles 2.2.3 requires symfony/css-selector (^2.7 || ^3.0 || ^4.0 || ^5.0) $ composer depends tijsverkoyen/css-to-inline-styles drupal/swiftmailer 2.0.0-beta1 requires tijsverkoyen/css-to-inline-styles (^2.2) $ composer depends drupal/swiftmailer drupal/varbase_email 9.0.0-alpha1 requires drupal/swiftmailer (~2.0)

So, in root, the version for symfony/css-selector is getting as dependency from this resource. But finally saves it in last available version, 5.1.7 when you're saying: "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0" in your composer.json file. The installed versions of symfony/css-selector stays like that:

$ composer show  symfony/css-selector             
    name     : symfony/css-selector
    descrip. : Symfony CssSelector Component
    keywords : 
    versions : * v5.1.7
    type     : library
    license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
    homepage : https://symfony.com
    source   : [git] https://github.com/symfony/css-selector.git e544e24472d4c97b2d11ade7caacd446727c6bf9
    dist     : [zip] https://api.github.com/repos/symfony/css-selector/zipball/e544e[...]
    path     : /var/www/html/vendor/symfony/css-selector
    names    : symfony/css-selector
    autoload psr-4
   Symfony\Component\CssSelector\ => . exclude-from-classmap
   requires  php >=7.2.5

... And the last version of Drupal Console for Drupal 9 (Drupal Console 1.9.5) ask for a version - drupal/console 1.9.5 requires symfony/css-selector ~3.0|~4.0

How to reproduce

$ ddev config --project-type=drupal9 --docroot=docroot --create-docroot $ echo y | ddev composer create Vardot/varbase-project:9.0.0-alpha1 $ ddev composer require --dev drupal/console

Details:

Solution

Well, I'm thinking about changing the version of the resource symfony/css-selector (locked at v5.1.7 in my system). Is it possible to fix the version set for this dependency from the tijsverkoyen/CssToInlineStyles side? Something in the range 3.0|4.0, avoiding the 5.0 versions range? For the Drupal people will be a big help.

Greetings,

David.

stof commented 4 years ago

use composer require drupal/console:^1.9.5 --update-with-dependencies to allow Composer to downgrade other existing packages if necessary

stof commented 4 years ago

On a side note, adding support for symfony/css-selector 5 in drupal/console should be quite easy, as I don't think there are any BC break in that component in Symfony 5.