-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix post-update-cmd with --no-dev installs #1067
base: master
Are you sure you want to change the base?
Conversation
It does not check if the database is available. Somebody may want to implement something along the lines of: try {
\Illuminate\Support\Facades\DB::connection()->getPdo();
} catch (Exception $e) {
// If we get here we are not connected
$this->comment($this->signature . ': No database connection, not updating PhpStorm ide-helper:* files.');
} Our setup connects to multiple databases, and as dev you'd rather see it break than become silent. |
Potentially ide-helper could drop such a file? I believe there are recommended ways to 'install files' in Laravel, e.g. to install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No objections from my side; having it doc only seems useful
Let's see what @barryvdh thinks!
} | ||
``` | ||
|
||
In `composer.json` you can then add `"@php artisan ide-helper:do-it"` that will gracefully work indepent of `--no-dev` composer installs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it should be more explicit where to add this, as they're multiple keys possible in scripts
, i.e. mention post-update-cmd
?
I see Is there some Laravel-ish, or Composer-ish way to see if ide-helper is loaded? And which class to test? |
This should check whether ide-helper is installed: Artisan::command('ide-helper:run', function () {
if (App::has('command.ide-helper.generate')) {
Artisan::call('ide-helper:meta', [], $this->output);
Artisan::call('ide-helper:generate', [], $this->output);
}
})->describe('Run ide-helper:generate and meta.'); This can be inserted to routes/console.php |
Summary
When barryvdh/laravel-ide-helper is a dev dependency, it is not available with
--no-dev
installs ("release builds"). Which will give errors if you addide-helper:<..>
inpost-update-cmd
orpost-install-cmd
incomposer.json
.This fixes that by making an intermediate that checks for
APP_ENV="local"
in.env
to automatically run ide-helper scripts.This patch is related to: #794
Type of change
Checklist
composer fix-style