Skip to content
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

[1.x] Fix composer memory limit crashes #412

Merged
merged 2 commits into from
Oct 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ protected function configureSession()
protected function installLivewireStack()
{
// Install Livewire...
(new Process(['composer', 'require', 'livewire/livewire:^2.0', 'laravel/sanctum:^2.6'], base_path()))
->setTimeout(null)
->run(function ($type, $output) {
$this->output->write($output);
});
$this->requireComposerPackages('livewire/livewire:^2.0', 'laravel/sanctum:^2.6');

// Sanctum...
(new Process(['php', 'artisan', 'vendor:publish', '--provider=Laravel\Sanctum\SanctumServiceProvider', '--force'], base_path()))
Expand Down Expand Up @@ -248,11 +244,7 @@ protected function livewireRouteDefinition()
protected function installInertiaStack()
{
// Install Inertia...
(new Process(['composer', 'require', 'inertiajs/inertia-laravel:^0.2.4', 'laravel/sanctum:^2.6', 'tightenco/ziggy:^0.9.4'], base_path()))
->setTimeout(null)
->run(function ($type, $output) {
$this->output->write($output);
});
$this->requireComposerPackages('inertiajs/inertia-laravel:^0.2.4', 'laravel/sanctum:^2.6', 'tightenco/ziggy:^0.9.4');

// Install NPM packages...
$this->updateNodePackages(function ($packages) {
Expand Down Expand Up @@ -443,6 +435,26 @@ protected function installJetstreamServiceProvider()
}
}

/**
* Installs the given Composer Packages into the application.
*
* @param mixed $packages
* @return void
*/
protected function requireComposerPackages($packages)
{
$command = array_merge(
['composer', 'require'],
is_array($packages) ? $packages : func_get_args()
);

(new Process($command, base_path(), ['COMPOSER_MEMORY_LIMIT' => '-1']))
->setTimeout(null)
->run(function ($type, $output) {
$this->output->write($output);
});
}

/**
* Update the "package.json" file.
*
Expand Down