support "chart.js" as library directory

Created on 2 June 2023, over 1 year ago
Updated 23 August 2023, over 1 year ago

Problem/Motivation

moderation_dashboard currenlty expect the cart.js library to be at libraries/chartjs.
A common setup for Drupal projects is to use asset-packagist.org as a composer repo in combination with oomphinc/composer-installers-extender for adding npm-asset/chart.js to libraries/chart.js.
Because chart.js package name in the npm world is chart.js the destination directory is libraries/chart.js.

Steps to reproduce

1. Add

"repositories": [
  {
    "type": "composer",
    "url": "https://packages.drupal.org/8"
  },
  {
    "type": "composer",
    "url": "https://asset-packagist.org"
  }
],

to your composer.json.

2. Add composer package: oomphinc/composer-installers-extender
3. Add installer extender config to your composer.json.

"extra": {
        "installer-types": [
            "bower-asset",
            "npm-asset"
        ],
        "installer-paths": {
            "docroot/core": [
                "type:drupal-core"
            ],
            "docroot/libraries/{$name}": [
                "type:drupal-library",
                "type:bower-asset",
                "type:npm-asset"
            ],
            "docroot/modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "docroot/profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "docroot/themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "drush/contrib/{$name}": [
                "type:drupal-drush"
            ]
        }
    }

4. run <code>composer req npm-asset/chart.js

Proposed resolution

Scanning for chartjs and chart.js directory in the libraries destination and align the library definition properly.

πŸ› Bug report
Status

Fixed

Version

2.1

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany sunlix Wesel

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

Comments & Activities

Production build 0.71.5 2024