From a1fcacbd187546fa57f08345ca1b7f9ddf2bff27 Mon Sep 17 00:00:00 2001 From: leganz Date: Fri, 21 Aug 2020 11:24:43 +0200 Subject: [PATCH] Add deployment command for pwa to create the manifest.json file instead of using a controller. --- Console/DeployManifest.php | 52 +++++++++++++++++++++++++ Providers/LaravelPWAServiceProvider.php | 15 ++++++- 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 Console/DeployManifest.php diff --git a/Console/DeployManifest.php b/Console/DeployManifest.php new file mode 100644 index 0000000..b830c1f --- /dev/null +++ b/Console/DeployManifest.php @@ -0,0 +1,52 @@ +generate(); + File::put(public_path("manifest.json"), json_encode($output, JSON_PRETTY_PRINT)); + + $this->line('manifest.json file has been created.'); + + } + + +} diff --git a/Providers/LaravelPWAServiceProvider.php b/Providers/LaravelPWAServiceProvider.php index 4704990..7356635 100644 --- a/Providers/LaravelPWAServiceProvider.php +++ b/Providers/LaravelPWAServiceProvider.php @@ -27,6 +27,7 @@ public function boot() $this->registerViews(); $this->registerServiceworker(); $this->registerDirective(); + $this->registerCommands(); } /** @@ -118,7 +119,19 @@ public function registerDirective() }); } - + + /** + * Register the available commands + * + * @return void + */ + public function registerCommands() + { + $this->commands([ + \LaravelPWA\Console\Commands\DeployManifest::class, + ]); + + } /** * Get the services provided by the provider.