Skip to content

Commit 3cf8dca

Browse files
authored
fix: custom PHP binary package not pruned on build (#204)
* fix: increase timeout for composer install and clean up custom php binary package directory * fix: add LocatesPhpBinary trait to BundleCommand * fix: ensure custom php binary package directory is removed only if it exists
1 parent e733d3e commit 3cf8dca

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/Commands/BundleCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Native\Electron\Traits\HandlesZephpyr;
1515
use Native\Electron\Traits\HasPreAndPostProcessing;
1616
use Native\Electron\Traits\InstallsAppIcon;
17+
use Native\Electron\Traits\LocatesPhpBinary;
1718
use Native\Electron\Traits\PrunesVendorDirectory;
1819
use Native\Electron\Traits\SetsAppName;
1920
use Symfony\Component\Finder\Finder;
@@ -28,6 +29,7 @@ class BundleCommand extends Command
2829
use HandlesZephpyr;
2930
use HasPreAndPostProcessing;
3031
use InstallsAppIcon;
32+
use LocatesPhpBinary;
3133
use PrunesVendorDirectory;
3234
use SetsAppName;
3335

src/Traits/PrunesVendorDirectory.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ abstract protected function buildPath(string $path = ''): string;
1616
protected function pruneVendorDirectory()
1717
{
1818
Process::path($this->buildPath())
19+
->timeout(300)
1920
->run('composer install --no-dev', function (string $type, string $output) {
2021
echo $output;
2122
});
@@ -25,5 +26,11 @@ protected function pruneVendorDirectory()
2526
$this->buildPath('/vendor/bin'),
2627
$this->buildPath('/vendor/nativephp/php-bin'),
2728
]);
29+
30+
// Remove custom php binary package directory
31+
$binaryPackageDirectory = $this->binaryPackageDirectory();
32+
if (! empty($binaryPackageDirectory) && $filesystem->exists($this->buildPath($binaryPackageDirectory))) {
33+
$filesystem->remove($this->buildPath($binaryPackageDirectory));
34+
}
2835
}
2936
}

0 commit comments

Comments
 (0)