diff --git a/resources/js/package.json b/resources/js/package.json index e760e2a2..1ecd3055 100644 --- a/resources/js/package.json +++ b/resources/js/package.json @@ -1,5 +1,5 @@ { - "name": "Laravel", + "name": "NativePHP", "version": "1.0.0", "description": "A NativePHP Electron application", "main": "./out/main/index.js", @@ -105,4 +105,4 @@ "#plugin": "./electron-plugin/dist/index.js" }, "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" -} \ No newline at end of file +} diff --git a/src/Commands/BuildCommand.php b/src/Commands/BuildCommand.php index 77b552cc..4ad31275 100644 --- a/src/Commands/BuildCommand.php +++ b/src/Commands/BuildCommand.php @@ -21,7 +21,9 @@ class BuildCommand extends Command protected $signature = 'native:build {os? : The operating system to build for (all, linux, mac, win)} {arch? : The Processor Architecture to build for (x64, x86, arm64)} - {--publish : to publish the app}'; + {--publish : to publish the app} + {--assets : to build the project assets} + {--asset-build=build : The NPM script to run to build your project assets}'; protected $availableOs = ['win', 'linux', 'mac', 'all']; @@ -41,7 +43,9 @@ public function handle(): void echo $output; }); - $this->checkAndBuildProjectAssets(null); + if ($this->option('assets')) { + $this->checkAndBuildProjectAssets($this->option('asset-build')); + } $os = $this->selectOs($this->argument('os')); diff --git a/src/Traits/ManagesAssetBuilding.php b/src/Traits/ManagesAssetBuilding.php index 3346e9c3..4042b948 100644 --- a/src/Traits/ManagesAssetBuilding.php +++ b/src/Traits/ManagesAssetBuilding.php @@ -46,9 +46,14 @@ public function checkAndBuildProjectAssets(?string $buildCommand): ?ProcessResul } if (! isset($scripts[$buildCommand])) { - $this->error('Invalid script selected... Continuing...'); + // We might get here if the script wasn't defined and the default was used. + // We can try to prompt the user again. + $buildCommand = $this->promptForAssetBuildCommand($scripts); - return null; + if (! isset($scripts[$buildCommand])) { + $this->error('Invalid script selected. Exiting…'); + return null; + } } $this->info('Building project assets…');