Change require custom libraries to suggestions as a better method with more options

Created on 12 August 2024, 4 months ago

Problem/Motivation

After πŸ“Œ Install jquery.fancytree via Composer instead of CDN Fixed

The current method, is forcing all projects to add the following to "repositories" the composer.json file

    "jquery.fancytree": {
      "type": "package",
      "package": {
        "name": "jquery/fancytree",
        "version": "2.38.3",
        "type": "drupal-library",
        "extra": {
          "installer-name": "jquery.fancytree"
        },
        "dist": {
          "url": "https://github.com/mar10/fancytree/archive/refs/tags/v2.38.3.zip",
          "type": "zip"
        },
        "license": "MIT"
      }
    }

Steps to reproduce

Adding "drupal/taxonomy_manager": "2.0.13" in the composer.json file
and composer update
will bring the following error

Dependency resolution completed in 0.026 seconds
Downloading https://packagist.org/providers/jquery/fancytree.json
[200] https://packagist.org/providers/jquery/fancytree.json
Downloading https://packagist.org/providers/jquery/fancytree.json
[200] https://packagist.org/providers/jquery/fancytree.json
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires drupal/taxonomy_manager 2.0.13 -> satisfiable by drupal/taxonomy_manager[2.0.13].
    - drupal/taxonomy_manager 2.0.13 requires jquery/fancytree ^2.38 -> could not be found in any version, there may be a typo in the package name.
  Problem 2
    - drupal/taxonomy_manager 2.0.13 requires jquery/fancytree ^2.38 -> could not be found in any version, there may be a typo in the package name.

Proposed resolution

Suggesting to switch to a better options
Add the library as a suggestion in the composer.json file.
Option #1 : The wikimedia/composer-merge-plugin method, which used in the Webform module composer.libraries.json - How to use composer to install libraries for the Webform module β†’

Option #2 : The Asset Packagist method. which used in the Anchor Link β†’

OPTION #1

Remaining tasks

  • File an issue
  • MR
  • Test
  • Review

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡―πŸ‡΄Jordan Rajab Natshah Jordan

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024