Skip to content

fix: custom PHP binary package not pruned on build #204

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

Merged
merged 3 commits into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/Commands/BundleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -28,6 +29,7 @@ class BundleCommand extends Command
use HandlesZephpyr;
use HasPreAndPostProcessing;
use InstallsAppIcon;
use LocatesPhpBinary;
use PrunesVendorDirectory;
use SetsAppName;

Expand Down
7 changes: 7 additions & 0 deletions src/Traits/PrunesVendorDirectory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand All @@ -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->exists($this->buildPath($binaryPackageDirectory))) {
$filesystem->remove($this->buildPath($binaryPackageDirectory));
}
}
}
Loading