npm-assets and bower-assets lead to multiple jquery and jquery-ui versions

Created on 6 March 2024, about 1 year ago
Updated 20 March 2024, about 1 year ago

Problem/Motivation

I am really not sure if this the correct place to raise this issue but I cannot see anywhere else that seems any more sensible.

I have been working locally on Dupal 10.2.3 for some week without any issue and I saw an update today to 10.2.4.
all my contrib' code is bang up to date so I was not expecting anything other than core and bit of Symphony componentry.

I expected a composer update to sort that but all I got was...

  - Downgrading bower-asset/jquery (3.7.1 => 3.6.4)
  - Upgrading nikic/php-parser (v5.0.1 => v5.0.2)

I've seen that yo-yo between 3.7.1 => 3.6.4 of bower-asset/jquery before but just ignored it!

So next I tried composer update "drupal/core-*" --with-all-dependencies.

Result...

Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
53 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found

So I then tried composer require drupal/core-recommended:10.2.4 drupal/core-composer-scaffold:10.2.4 drupal/core-project-message:10.2.4 --update-with-all-dependencies

Ah, this time I got what I was expecting...

Updating dependencies
Lock file operations: 0 installs, 4 updates, 0 removals
  - Upgrading drupal/core (10.2.3 => 10.2.4)
  - Upgrading drupal/core-composer-scaffold (10.2.3 => 10.2.4)
  - Upgrading drupal/core-project-message (10.2.3 => 10.2.4)
  - Upgrading drupal/core-recommended (10.2.3 => 10.2.4)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 4 updates, 0 removals
  - Upgrading drupal/core-composer-scaffold (10.2.3 => 10.2.4): Extracting archive
  - Upgrading drupal/core-project-message (10.2.3 => 10.2.4): Extracting archive
  - Upgrading drupal/core (10.2.3 => 10.2.4): Extracting archive
  - Upgrading drupal/core-recommended (10.2.3 => 10.2.4)
Generating autoload files
53 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Scaffolding files for drupal/core:
  - Copy [project-root]/.editorconfig from assets/scaffold/files/editorconfig
  - Copy [project-root]/.gitattributes from assets/scaffold/files/gitattributes
  - Copy [web-root]/.csslintrc from assets/scaffold/files/csslintrc
  - Copy [web-root]/.eslintignore from assets/scaffold/files/eslintignore
  - Copy [web-root]/.htaccess from assets/scaffold/files/htaccess
  - Copy [web-root]/example.gitignore from assets/scaffold/files/example.gitignore

I then run a database update and a cache clear just for good measure and I seem to be on 10.2.4 but my question is twofold:

1) Why didn't the straight forward composer update do it in the first place?
2) Surely composer require drupal/core-recommended:10.2.4 drupal/core-composer-scaffold:10.2.4 drupal/core-project-message:10.2.4 --update-with-all-dependencies completely should do exactly the same as composer update "drupal/core-*" --with-all-dependencies because given that wildcard, it's exactly the same command?

Help me to see the light someone please ;-)

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
ComposerΒ  β†’

Last updated about 11 hours ago

No maintainer
Created by

πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset

Live updates comments and jobs are added and updated live.
  • Needs framework manager review

    It is used to alert the framework manager core committer(s) that an issue significantly impacts (or has the potential to impact) multiple subsystems or represents a significant change or addition in architecture or public APIs, and their signoff is needed (see the governance policy draft for more information). If an issue significantly impacts only one subsystem, use Needs subsystem maintainer review instead, and make sure the issue component is set to the correct subsystem.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @SirClickALot
  • No matter what, this isn't a bug. It's Composer conducting its operations.

    1. I don't know. We would have to see the composer.* files as they were at that time. A `composer why-not` would have been helpful.

    2. It's not exactly the same command. composer require drupal/core-recommended:10.2.4 pins a specific version.

  • πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset

    Thanks @cilefen β†’ ,

    That's useful help.

    1) I have rolled back the code and database and I am ready try out a composer why-not but can you give me a bit more info as the what exactly I need to try?

    2) Sure I agree, it's not exactlythe same command but is should have effectively the same if my composer.json was set correctly but it seems that is wasn't, it read...

    ..."drupal/core-composer-scaffold": "10.2.3",
            "drupal/core-project-message": "10.2.3",
            "drupal/core-recommended": "10.2.3",
    ...

    I think that a remnant from the time when quite a few of us were having difficulties with moving up to 10.2 πŸ’¬ Composer update to 10.2 does not register Closed: works as designed but I'll remedy with the addition of a '^'.

    Glad to post up anything else I find after the composer why-not expt.

  • I don't know from which file that code output is, but if those dependencies had been pinned to specific versions, composer update will not change them. That is as expected.

  • Status changed to Closed: works as designed about 1 year ago
  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    Yep, if your composer.json specifies an exact version like "10.2.3" then you will always get that version and composer update will never upgrade it. You should use the ^ operator if you want composer update to be able to select newer versions.

    composer why-not drupal/core 10.2.4 should tell you why the upgrade was not allowed.

  • πŸ‡©πŸ‡ͺGermany mkalkbrenner πŸ‡©πŸ‡ͺ

    For whatever reason, jquery3.7.1 has been removed from bower:
    https://asset-packagist.org/package/bower-asset/jquery

  • Status changed to Active about 1 year ago
  • πŸ‡©πŸ‡ͺGermany mkalkbrenner πŸ‡©πŸ‡ͺ

    I investigated the issue a bit more, as we have seen strange jquery version "jumps" during composer updates over the last year.
    The problem is if a contrib or custom module requires a npm-asset or bower-asset via composer, these javascripts libs might have their own jquery or jquery-ui dependency which is specific to the reposititory.
    So you one asset might require "npm-asset/jquery" while another requires "bower-asset/jquery". Even worse, the drupal core already includes jquery and jquery-ui as a copy!

    So whatever gets updated during composer updates, you sometimes see strange jquery version jumps. But I guess, in most cases the built-in jquery version of drupal core will be used ... hopefully. In the worst case multiple different jquery version get loaded at the same time.

    I think it would be correct that Drupal tells composer that it provides jquery and jquery-ui by itself and therefore already fulfills dependencies to jquery and jquery-ui of those assets.

    And maybe that should be extended to all libs in the core/assets folder. But I created a MR for jquery and jquery-ui.

  • Pipeline finished with Failed
    about 1 year ago
    Total: 117s
    #117282
  • Status changed to Needs review about 1 year ago
  • πŸ‡©πŸ‡ͺGermany mkalkbrenner πŸ‡©πŸ‡ͺ

    I investigated the issue a bit more, as we have seen strange jquery version "jumps" during composer updates over the last year.
    The problem is if a contrib or custom module requires a npm-asset or bower-asset via composer, these javascripts libs might have their own jquery or jquery-ui dependency which is specific to the reposititory.
    So you one asset might require "npm-asset/jquery" while another requires "bower-asset/jquery". Even worse, the drupal core already includes jquery and jquery-ui as a copy!

    So whatever gets updated during composer updates, you sometimes see strange jquery version jumps. But I guess, in most cases the built-in jquery version of drupal core will be used ... hopefully. In the worst case multiple different jquery version get loaded at the same time.

    I think it would be correct that Drupal tells composer that it provides jquery and jquery-ui by itself and therefore already fulfills dependencies to jquery and jquery-ui of those assets.

    And maybe that should be extended to all libs in the core/assets folder. But here's a patch for jquery and jquery-ui.

  • Pipeline finished with Success
    about 1 year ago
    Total: 518s
    #117313
  • πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset

    Brilliant detective work @mkalkbrenner β†’ !

    In my case I think it was recent update to the facet β†’ module (2.0.7 ,8 March 2024) that caused my site to revert the libraries version back to 3.6.4

  • Status changed to Postponed: needs info about 1 year ago
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    What's the bug here? The MR is adding Bower and nom packagist endpoints to core, which we won't be doing

  • Status changed to Needs review about 1 year ago
  • πŸ‡©πŸ‡ͺGermany mkalkbrenner πŸ‡©πŸ‡ͺ

    Core already fulfills the dependency to jquery and jquery-ui by itself. It is wrong to load jquery and jquery-ui twice from npm or bower.

    All the library definitions of modules which require jquery don't explicitly reference the version from npm or bower. They reference juery in core. So composer should behave in the same way.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Tagging for framework manager

    Though @larowlan in #11, is one mentioned this may be a no go.

  • Status changed to Needs work about 1 year ago
  • The Needs Review Queue Bot β†’ tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    So I get why we're making the change, but I don't know if we want to hard prevent people from installing those things should they wish to.

    I personally feel using composer to install npm packages already feels like you've entered the realm of the bad_judgement module.

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    I've asked other committers for their thoughts

Production build 0.71.5 2024