Great work!

If you would like to install the select2 library with composer, you will need to add the following to the composer.json file into the repositories array:

    {
      "type": "package",
      "package": {
        "name": "jquery/select2",
        "version": "4.0.5",
        "type": "drupal-library",
        "dist": {
          "url": "https://github.com/select2/select2/archive/4.0.5.zip",
          "type": "zip"
        }
      }
    }

After this you can install the library with "composer require jquery/select2" and the library will be downloaded into the libraries folder.

Maybe this could be added to the documentation?

Comments

Anonymous’s picture

joep.hendrix created an issue. See original summary.

Anonymous’s picture

Issue summary: View changes
heliogabal’s picture

Component: Documentation » Code
Status: Active » Needs review
StatusFileSize
new686 bytes

I think rather than add this to the documentation, this should be patched to avoid manual work. I created a patch from your code so this can be tested and merged.

heliogabal’s picture

StatusFileSize
new696 bytes

sorry, wrong patch, I hope this one works.

Anonymous’s picture

No, this should go into the root composer.json. The module composer.json is not used by composer.

Anonymous’s picture

Issue summary: View changes
heliogabal’s picture

Status: Needs review » Postponed
Related issues: +#2873160: Implement core management of 3rd-party FE libraries

Yeah sorry, I found that out as well: apparently, the repositories array can only be added to the main composer.json as it is not resolved recursively: https://getcomposer.org/doc/04-schema.md#repositories

It seems there is no easy way to do this right now, as described in this comment: https://www.drupal.org/project/drupal/issues/2873160#comment-12571586

Setting this to postponed, hope this is the right way to do it. If there is a solution upstream, this can be fixed later.

Anonymous’s picture

Issue summary: View changes
Anonymous’s picture

Component: Code » Documentation
Category: Feature request » Task

Please ad this to the documentation.

chr.fritsch’s picture

Status: Postponed » Fixed

I added that to the module description page.

Thx

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.