'Composer post-autoload-dump for dev
I am use composer post-autoload-dump functionality but i want two version of it, one for when we require dev tools and one for when we don't.
More specifically in out post-autoload-dump list we have two commands that we don't want to run when using composer install --no-dev in the below snippet it's the @php artisan ide-helper:generate and the @php artisan ide-helper:meta commands as this breaks the execution if those dev packages aren't present
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi",
"@php artisan ide-helper:generate",
"@php artisan ide-helper:meta"
],
}
So i'm looking for something along the lines of :
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-autoload-dump-dev": [
"@php artisan ide-helper:generate",
"@php artisan ide-helper:meta"
]
Solution 1:[1]
In the case of Laravel I just created my own command and did my logic in there. Basically if(class_exists('\The\Class')) then run the command, else don't.
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan setup:post-autoload-dump"
],
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | E_net4 - Krabbe mit Hüten |
