Problem/Motivation
Varbase already uses NPM/Yarn–based front-end library management in earlier branches (9.1.x, 10.0.x, and 10.1.x).
However, this setup is not yet available in the 11.0.x branch.
Drupal modules often depend on external CSS and JavaScript libraries that must be placed under web/libraries.
While PHP dependencies are handled via Composer, front-end assets are best managed using modern JavaScript package managers.
Faster installs and updates
Improved security and package authenticity
Better alignment with modern Drupal and front-end workflows
Proposed resolution
Adopt NPM/Yarn-based front-end library management for the Varbase Starter site template (Yarn recommended).
Keep and use the existing sync script:
./recipes/varbase_starter/scripts/drupal-libraries-sync.js
Composer Integration
Add Composer scripts to support syncing via Yarn or NPM:
"drupal-libraries-sync": [
"@drupal-libraries-yarn-sync"
],
"drupal-libraries-yarn-sync": [
"yarn install",
"node ./recipes/varbase_starter/scripts/drupal-libraries-sync.js"
],
"drupal-libraries-npm-sync": [
"npm install",
"node ./recipes/varbase_starter/scripts/drupal-libraries-sync.js"
],
"post-create-project-cmd": [
"@drupal-libraries-sync"
]
Front-End Dependencies (package.json)
Declare front-end libraries under dependencies
Support automatic syncing after install
"scripts": {
"drupal-libraries-sync": "node ./recipes/varbase_starter/scripts/drupal-libraries-sync.js",
"postinstall": "node ./recipes/varbase_starter/scripts/drupal-libraries-sync.js"
},
"dependencies": {
"@ckeditor/ckeditor5-media-embed": "~45.2.0",
"ace-builds": "~1",
"dropzone": "~5",
"jquery.fancytree": "~2",
"swagger-ui-dist": "~3"
},
"drupal-libraries": {
"library-directory": "web/libraries",
"libraries": [
{ "name": "dropzone", "package": "dropzone" },
{ "name": "ace", "package": "ace-builds/src-min" },
{ "name": "ckeditor5/plugins/media-embed", "package": "@ckeditor/ckeditor5-media-embed" },
{ "name": "jquery.fancytree", "package": "jquery.fancytree/dist" },
{ "name": "swagger-ui/dist", "package": "swagger-ui-dist" }
]
}
Expected Capabilities
- Run
yarn installornpm installto fetch front-end libraries - Run
yarn drupal-libraries-syncto sync libraries to web/libraries - Run
npm drupal-libraries-syncas an alternative - Run
composer drupal-libraries-syncfor CI and automation
Optionally run:
composer drupal-libraries-yarn-synccomposer drupal-libraries-npm-sync
Remaining tasks
- ✅ File an issue about this project
- ❌ Addition/Change/Update/Fix to this project
- ❌ Testing to ensure no regression
- ➖ Automated unit/functional testing coverage
- ➖ Developer Documentation support on feature change/addition
- ➖ User Guide Documentation support on feature change/addition
- ➖ UX/UI designer responsibilities
- ➖ Accessibility and Readability
- ❌ Code review from 1 Varbase core team member
- ❌ 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
- feat: #3570872 Add NPM/Yarn Support with drupal-libraries-sync for Varbase Libraries Management
Comments
Comment #2
rajab natshahComment #3
rajab natshahComment #4
rajab natshahComment #7
rajab natshahComment #10
rajab natshahComment #11
rajab natshah