33namespace Native \Desktop \Drivers \Electron \Commands ;
44
55use Illuminate \Console \Command ;
6+ use Native \Desktop \Drivers \Electron \Traits \CreatesElectronProject ;
67use Native \Desktop \Drivers \Electron \Traits \Installer ;
78use Native \Desktop \Support \Composer ;
89use Symfony \Component \Console \Attribute \AsCommand ;
910
1011use function Laravel \Prompts \confirm ;
12+ use function Laravel \Prompts \info ;
1113use function Laravel \Prompts \intro ;
1214use function Laravel \Prompts \outro ;
1315
1719)]
1820class InstallCommand extends Command
1921{
22+ use CreatesElectronProject;
2023 use Installer;
2124
2225 protected $ signature = 'native:install
@@ -25,25 +28,34 @@ class InstallCommand extends Command
2528
2629 public function handle (): void
2730 {
28- intro ('Publishing NativePHP Service Provider... ' );
29-
3031 $ withoutInteraction = $ this ->option ('no-interaction ' );
3132
33+ // Publish provider & config
34+ intro ('Publishing NativePHP Service Provider... ' );
3235 $ this ->call ('vendor:publish ' , ['--tag ' => 'nativephp-provider ' ]);
3336 $ this ->call ('vendor:publish ' , ['--tag ' => 'nativephp-config ' ]);
3437
38+ // Install Composer scripts
39+ intro ('Installing composer scripts ' );
3540 Composer::installScripts ();
3641
37- $ installer = $ this ->getInstaller ($ this ->option ('installer ' ));
42+ // Create Electron project
43+ // NOTE: Consider making this optional
44+ intro ('Creating Electron project ' );
45+ $ installPath = base_path ('nativephp/electron ' );
46+ $ this ->createElectronProject ($ installPath );
47+ info ('Created Electron project in `./nativephp/electron` ' );
3848
49+ // Install NPM Dependencies
50+ $ installer = $ this ->getInstaller ($ this ->option ('installer ' ));
3951 $ this ->installNPMDependencies (
4052 force: $ this ->option ('force ' ),
4153 installer: $ installer ,
4254 withoutInteraction: $ withoutInteraction
4355 );
4456
57+ // Promt to serve the app
4558 $ shouldPromptForServe = ! $ withoutInteraction && ! $ this ->option ('force ' );
46-
4759 if ($ shouldPromptForServe && confirm ('Would you like to start the NativePHP development server ' , false )) {
4860 $ this ->call ('native:serve ' , [
4961 '--installer ' => $ installer ,
0 commit comments