Library requirements fail if a package.json does not exist.

Created on 11 October 2023, about 1 year ago
Updated 27 July 2024, 4 months ago

Problem/Motivation

After upgrading to version 3.x of the module I noticed that the Drupal status report showed errors for the Codemirror and ckeditor5-source-editing-codemirror not being loaded, even though the library files were there and working fine.

Looking into the requirements more it seems https://git.drupalcode.org/project/ckeditor_codemirror/-/commit/f049d63 included a change that started requiring the package.json file for each library. This was the cause of the problem since during deployments we remove any package.json and package-lock.json files in order to help prevent supply chain attacks.

It appears the package.json files are only needed in order to show the exact version of the module installed, but the module itself does not need it in order to function.

Steps to reproduce

  1. Enable the module.
  2. Install both Codemirror and ckeditor5-source-editing-codemirror libraries.
  3. Check the Drupal status page /admin/reports/status There should be no errors related to the module.
  4. Delete or rename the package.json files in each library folder.
  5. Check the Drupal status page /admin/reports/status There should be 2 errors related to the module.

Proposed resolution

Since the module's functionality doesn't require the package.json files it would be great if this wasn't a requirement. If they are available, showing the version is fine, but if not there should be a fallback value.

I'm happy to provide a MR with changes.

Remaining tasks

  1. Agree on solution.
  2. Provide MR with changes.

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States pcate

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