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

#3570874: Adopt NPM/Yarn with drupal-libraries-sync for Front-End Libraries in Varbase Starter Site Templat

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 install or npm install to fetch front-end libraries
  • Run yarn drupal-libraries-sync to sync libraries to web/libraries
  • Run npm drupal-libraries-sync as an alternative
  • Run composer drupal-libraries-sync for CI and automation

Optionally run:

  • composer drupal-libraries-yarn-sync
  • composer 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

rajab natshah created an issue. See original summary.

rajab natshah’s picture

Title: Add NPM/Yarn Support with drupal-libraries-npm-sync for Varbase Libraries Management » Add NPM/Yarn Support with drupal-libraries-sync for Varbase Libraries Management
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes

  • rajab natshah committed cca2eac6 on 11.0.x
    feat: #3570872 Add NPM/Yarn Support with drupal-libraries-sync for...

  • rajab natshah committed 1af2abb6 on 11.0.x
    feat: #3570872 Add NPM/Yarn Support with drupal-libraries-sync for...
rajab natshah’s picture

Assigned: rajab natshah » Unassigned
Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

rajab natshah’s picture

Issue tags: +varbase-11.0.0-alpha1
rajab natshah’s picture

Issue summary: View changes