From b5b79725bf4da62eafd29f4e69d3e9b11b3d19e6 Mon Sep 17 00:00:00 2001 From: Eser DENIZ Date: Fri, 4 Apr 2025 20:08:59 +0200 Subject: [PATCH 1/3] fix: increase timeout for composer install and clean up custom php binary package directory --- src/Traits/PrunesVendorDirectory.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Traits/PrunesVendorDirectory.php b/src/Traits/PrunesVendorDirectory.php index 5683d8d4..2fd13521 100644 --- a/src/Traits/PrunesVendorDirectory.php +++ b/src/Traits/PrunesVendorDirectory.php @@ -16,6 +16,7 @@ abstract protected function buildPath(string $path = ''): string; protected function pruneVendorDirectory() { Process::path($this->buildPath()) + ->timeout(300) ->run('composer install --no-dev', function (string $type, string $output) { echo $output; }); @@ -25,5 +26,11 @@ protected function pruneVendorDirectory() $this->buildPath('/vendor/bin'), $this->buildPath('/vendor/nativephp/php-bin'), ]); + + // Remove custom php binary package directory + $binaryPackageDirectory = $this->binaryPackageDirectory(); + if (! empty($binaryPackageDirectory)) { + $filesystem->remove($this->buildPath($binaryPackageDirectory)); + } } } From 27c864e0150e80ec0076f39eadccd3338ecc2607 Mon Sep 17 00:00:00 2001 From: Eser DENIZ Date: Fri, 4 Apr 2025 20:14:42 +0200 Subject: [PATCH 2/3] fix: add LocatesPhpBinary trait to BundleCommand --- src/Commands/BundleCommand.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Commands/BundleCommand.php b/src/Commands/BundleCommand.php index 751cab11..0957491f 100644 --- a/src/Commands/BundleCommand.php +++ b/src/Commands/BundleCommand.php @@ -14,6 +14,7 @@ use Native\Electron\Traits\HandlesZephpyr; use Native\Electron\Traits\HasPreAndPostProcessing; use Native\Electron\Traits\InstallsAppIcon; +use Native\Electron\Traits\LocatesPhpBinary; use Native\Electron\Traits\PrunesVendorDirectory; use Native\Electron\Traits\SetsAppName; use Symfony\Component\Finder\Finder; @@ -28,6 +29,7 @@ class BundleCommand extends Command use HandlesZephpyr; use HasPreAndPostProcessing; use InstallsAppIcon; + use LocatesPhpBinary; use PrunesVendorDirectory; use SetsAppName; From c56bdc2b2e3ce9e798e32763c20b66112034eafc Mon Sep 17 00:00:00 2001 From: Eser DENIZ Date: Fri, 4 Apr 2025 20:18:43 +0200 Subject: [PATCH 3/3] fix: ensure custom php binary package directory is removed only if it exists --- src/Traits/PrunesVendorDirectory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Traits/PrunesVendorDirectory.php b/src/Traits/PrunesVendorDirectory.php index 2fd13521..6f9ad0de 100644 --- a/src/Traits/PrunesVendorDirectory.php +++ b/src/Traits/PrunesVendorDirectory.php @@ -29,7 +29,7 @@ protected function pruneVendorDirectory() // Remove custom php binary package directory $binaryPackageDirectory = $this->binaryPackageDirectory(); - if (! empty($binaryPackageDirectory)) { + if (! empty($binaryPackageDirectory) && $filesystem->exists($this->buildPath($binaryPackageDirectory))) { $filesystem->remove($this->buildPath($binaryPackageDirectory)); } }