Problem/Motivation

Varbase 11 used to obtain six front-end libraries by running recipes/varbase_starter/scripts/drupal-libraries-sync.js, a Node script that copied files out of node_modules/ into web/libraries/, driven by a drupal-libraries block, six npm dependencies and a postinstall hook in package.json. That is replaced by Composer packages on Packagist, each required by the module or the varbase_* recipe that actually loads it.

  • vardot/aos 2.3.4 (new)
  • vardot/jquery.fancytree 2.38.5 (new)
  • vardot/ckeditor5-media-embed-drupal 47.6.2 (new)
  • vardot/ace 1.44.0 (refreshed from a 2017 fork)
  • vardot/dropzone 5.9.3 (refreshed from a 2017 fork)
  • swagger-api/swagger-ui, already required by drupal/openapi_ui_swagger; it only needed an installer path.

All are type: drupal-library except swagger-api/swagger-ui, which is type: library.

This recipe carried the sync script itself, at scripts/drupal-libraries-sync.js (112 lines), and the Drupal CMS pre-test CI job wrote a drupal-libraries block into package.json, copied the script in and ran yarn to drive it. With the libraries coming from Composer, none of that has a reason to exist.

The same job also verified the libraries by counting declarations in package.json. A count can pass while an installer path is wrong or an upstream layout has changed, so it did not actually prove the files the .libraries.yml entries load were on disk.

Steps to reproduce

  1. Read .gitlab-ci.yml, Drupal CMS pre-test job: it writes a drupal-libraries block, copies scripts/drupal-libraries-sync.js in, runs yarn, then counts declarations in package.json.
  2. Point an installer path at a wrong directory and re-run the job: the count still passes while no library file is on disk.

Environment: Drupal core 11.4.5, Varbase 11.0.x, PHP 8.4, MariaDB, DDEV.

Proposed resolution

  • Delete scripts/drupal-libraries-sync.js.
  • Rewire the Drupal CMS pre-test job: no drupal-libraries block, no copying the sync script in, no yarn at all.
  • The job wires the two installer paths a generic web/libraries/{$name} rule cannot place (swagger-api/swagger-ui is type: library; ckeditor_media_embed loads its plugin from a nested path).
  • The job asserts the library files the .libraries.yml entries load are on disk, instead of counting declarations.

Verified on a freshly installed Varbase 11.4.5 site in DDEV, with every package resolved from Packagist and no VCS repositories:

  • 14/14 declared library files present on disk; 10/10 assets return HTTP 200.
  • 7/7 Drupal libraries discovered, every asset resolving, all 7 rendering the Composer paths.
  • Status report green: ace_editor OK, dropzonejs_library OK, taxonomy_manager OK, media-embed installed at 47.6.2 matching core 47.6.2.
  • ace_editor PHPUnit: 69 tests, 709 assertions, 0 failures. phpcs clean on every changed PHP file.
  • yarn install succeeds with none of the six npm library packages present.

Remaining tasks

  • ✅ File an issue
  • ✅ Addition/Change/Update/Fix
  • ✅ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ➖ Developer Documentation support
  • ➖ User Guide Documentation support
  • ➖ UX/UI designer responsibilities
  • ➖ Accessibility and Readability
  • ❌ Reviewed by a human
  • ❌ Code review by maintainers
  • ❌ Full testing and approval
  • ❌ Credit contributors
  • ❌ Review with the product owner
  • ❌ Update Release Notes
  • ❌ Release

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • The drupal-libraries-sync script is removed; the front-end libraries come from Composer. CI now asserts the library files on disk.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rajab natshah created an issue. See original summary.

rajab natshah’s picture

Status: Active » Needs review

  • rajab natshah committed 90afdfe1 on 1.0.x
    feat: #3620357 Drop the drupal-libraries-sync script and assert the...