1212use Native \Desktop \Drivers \Electron \Traits \HandlesZephpyr ;
1313use Native \Desktop \Drivers \Electron \Traits \InstallsAppIcon ;
1414use Native \Desktop \Drivers \Electron \Traits \PatchesPackagesJson ;
15- use Native \Support \Bundler ;
15+ use Native \Support \Builder ;
1616use Symfony \Component \Console \Attribute \AsCommand ;
1717use Symfony \Component \Finder \Finder ;
1818use ZipArchive ;
@@ -37,13 +37,13 @@ class BundleCommand extends Command
3737
3838 private string $ zipName ;
3939
40- private Bundler $ bundler ;
40+ private Builder $ builder ;
4141
4242 public function __construct ()
4343 {
4444 parent ::__construct ();
4545
46- $ this ->bundler = Bundler ::make (
46+ $ this ->builder = Builder ::make (
4747 buildPath: base_path ('build/app/ ' )
4848 );
4949 }
@@ -96,19 +96,19 @@ public function handle(): int
9696 intro ('Copying App to build directory... ' );
9797
9898 // We update composer.json later,
99- $ this ->bundler ->copyToBuildDirectory ();
99+ $ this ->builder ->copyToBuildDirectory ();
100100
101101 $ this ->newLine ();
102102 intro ('Cleaning .env file... ' );
103- $ this ->bundler ->cleanEnvFile ();
103+ $ this ->builder ->cleanEnvFile ();
104104
105105 $ this ->newLine ();
106106 intro ('Copying app icons... ' );
107107 $ this ->installIcon ();
108108
109109 $ this ->newLine ();
110110 intro ('Pruning vendor directory ' );
111- $ this ->bundler ->pruneVendorDirectory ();
111+ $ this ->builder ->pruneVendorDirectory ();
112112
113113 // Check composer.json for symlinked or private packages
114114 if (! $ this ->checkComposerJson ()) {
@@ -161,7 +161,7 @@ private function zipApplication(): bool
161161
162162 private function checkComposerJson (): bool
163163 {
164- $ composerJson = json_decode (file_get_contents ($ this ->bundler ->buildPath ('composer.json ' )), true );
164+ $ composerJson = json_decode (file_get_contents ($ this ->builder ->buildPath ('composer.json ' )), true );
165165
166166 // // Fail if there is symlinked packages
167167 // foreach ($composerJson['repositories'] ?? [] as $repository) {
@@ -194,10 +194,10 @@ private function checkComposerJson(): bool
194194
195195 if (count ($ filteredRepo ) !== count ($ composerJson ['repositories ' ])) {
196196 $ composerJson ['repositories ' ] = $ filteredRepo ;
197- file_put_contents ($ this ->bundler ->buildPath ('composer.json ' ),
197+ file_put_contents ($ this ->builder ->buildPath ('composer.json ' ),
198198 json_encode ($ composerJson , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ));
199199
200- // Process::path($this->bundler ->buildPath())
200+ // Process::path($this->builder ->buildPath())
201201 // ->run('composer install --no-dev', function (string $type, string $output) {
202202 // echo $output;
203203 // });
@@ -228,7 +228,7 @@ private function addFilesToZip(ZipArchive $zip): void
228228 $ finder = (new Finder )->files ()
229229 ->followLinks ()
230230 // ->ignoreVCSIgnored(true) // TODO: Make our own list of ignored files
231- ->in ($ this ->bundler ->buildPath ())
231+ ->in ($ this ->builder ->buildPath ())
232232 ->exclude ([
233233 // We add those a few lines below and they are ignored by most .gitignore anyway
234234 'vendor ' ,
@@ -246,22 +246,22 @@ private function addFilesToZip(ZipArchive $zip): void
246246 $ this ->finderToZip ($ finder , $ zip );
247247
248248 // Why do I have to force this? please someone explain.
249- if (file_exists ($ this ->bundler ->buildPath ('public/build ' ))) {
249+ if (file_exists ($ this ->builder ->buildPath ('public/build ' ))) {
250250 $ this ->finderToZip (
251251 (new Finder )->files ()
252252 ->followLinks ()
253- ->in ($ this ->bundler ->buildPath ('public/build ' )), $ zip , 'public/build ' );
253+ ->in ($ this ->builder ->buildPath ('public/build ' )), $ zip , 'public/build ' );
254254 }
255255
256256 // Add .env file manually because Finder ignores VCS and dot files
257- $ zip ->addFile ($ this ->bundler ->buildPath ('.env ' ), '.env ' );
257+ $ zip ->addFile ($ this ->builder ->buildPath ('.env ' ), '.env ' );
258258
259259 // Add auth.json file to support private packages
260260 // WARNING: Only for testing purposes, don't uncomment this
261- // $zip->addFile($this->bundler ->buildPath('auth.json'), 'auth.json');
261+ // $zip->addFile($this->builder ->buildPath('auth.json'), 'auth.json');
262262
263263 // Custom binaries
264- $ binaryPath = Str::replaceStart ($ this ->bundler ->buildPath ('vendor ' ), '' , config ('nativephp.binary_path ' ));
264+ $ binaryPath = Str::replaceStart ($ this ->builder ->buildPath ('vendor ' ), '' , config ('nativephp.binary_path ' ));
265265
266266 // Add composer dependencies without unnecessary files
267267 $ vendor = (new Finder )->files ()
@@ -271,14 +271,14 @@ private function addFilesToZip(ZipArchive $zip): void
271271 '*/*/vendor ' , // Exclude sub-vendor directories
272272 $ binaryPath ,
273273 ]))
274- ->in ($ this ->bundler ->buildPath ('vendor ' ));
274+ ->in ($ this ->builder ->buildPath ('vendor ' ));
275275
276276 $ this ->finderToZip ($ vendor , $ zip , 'vendor ' );
277277
278278 // Add javascript dependencies
279- if (file_exists ($ this ->bundler ->buildPath ('node_modules ' ))) {
279+ if (file_exists ($ this ->builder ->buildPath ('node_modules ' ))) {
280280 $ nodeModules = (new Finder )->files ()
281- ->in ($ this ->bundler ->buildPath ('node_modules ' ));
281+ ->in ($ this ->builder ->buildPath ('node_modules ' ));
282282
283283 $ this ->finderToZip ($ nodeModules , $ zip , 'node_modules ' );
284284 }
0 commit comments