composer package requiring npm dependencies

Viewed 478

I'm creating a small Laravel package, I've set it up in package/my-package and initiated a composer.json in package/my-package/composer.json.

It's working fine, but I need to add dependencies like Bootstrap, jQuery, jQuery Datatables... How should I use npm to install thoses dependencies automatically after composer is done installing?

Like for example, after publishing the package, users should only use composer require my-packakge/my-package and it should install everything including the dependencies I mentioned.

I've tried adding this code to my composer.json, but it did nothing:

"extra": {
     "npm": {
          "bootstrap": "^4.3.1"
     },
}

Should I add a separate package.json file in addition to composer.json ? if so how will it work ?

0 Answers
Related