slejnej / asset-installer
Install npm from composer script
Installs: 1 343
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^7.4 || ^8.1
- ext-json: *
- symfony/filesystem: ~4.4.0
- symfony/process: ~4.4.0
- symfony/yaml: ~4.4.0
This package is auto-updated.
Last update: 2024-05-23 13:39:10 UTC
README
Install all your npm assets via composer
Installation
- install via composer
composer req slejnej/asset-installer
- add asset installation script to your composer
"scripts": { "post-install-cmd": [ "slejnej\\AssetInstaller\\InstallerHandler::installAssets" ] }
- add npm packages direct to your composer
"extra": { "npm": { "leaflet": "^1.7.1" } }
- run
composer install
In case
If this package is included in one of your vendor dependencies, then the scripts are not run for security reasons. As a work around you can use in primary composer.json
something like this:
find ./vendors -maxdepth 2 -type f -name composer.json -exec bash -c "cat {} | grep ::installAssets && composer install --working-dir $(dirname {})" \;
It will find all the files that contain php command installAsset and then execute composer install
in containing folder.
Update ./vendors
folder where it should look in and adjust maxdepth and update you
composer` executable.