8
8
9
9
class PWACommand extends Command
10
10
{
11
+ protected $ signature = 'erag:update-manifest ' ;
12
+
13
+ protected $ description = 'Update the manifest.json file for the PWA. ' ;
14
+
11
15
public function __construct (protected PWAService $ pwaService )
12
16
{
13
17
parent ::__construct ();
14
18
}
15
19
16
- /**
17
- * The name and signature of the console command.
18
- *
19
- * @var string
20
- */
21
- protected $ signature = 'erag:update-manifest ' ;
22
-
23
- /**
24
- * The console command description.
25
- *
26
- * @var string
27
- */
28
- protected $ description = 'Update the manifest.json file for the PWA. ' ;
29
-
30
- /**
31
- * Execute the console command.
32
- */
33
20
public function handle (): void
34
21
{
35
22
try {
@@ -49,24 +36,22 @@ public function handle(): void
49
36
],
50
37
];
51
38
52
- // Load custom manifest from config, fallback to default
53
39
$ manifest = Config::get ('pwa.manifest ' , $ defaultManifest );
54
40
55
41
if (empty ($ manifest ['icons ' ])) {
56
- $ this ->error ('Manifest is missing icons. Aborting operation. ' );
57
-
42
+ $ this ->error ('⚠️ Manifest is missing icons. Operation aborted. ' );
58
43
return ;
59
44
}
60
45
61
- if ($ this ->pwaService ->createOrUpdate ($ manifest )) {
62
- $ this ->info ('Manifest JSON updated successfully ✔ ' );
63
- }
64
-
65
- $ this ->info ('Failed to write the manifest file. ' );
46
+ $ updated = $ this ->pwaService ->createOrUpdate ($ manifest );
66
47
67
- } catch (\Exception $ e ) {
68
- // Catch any errors and display an error message
69
- $ this ->error ('An error occurred while updating the manifest: ' .$ e ->getMessage ());
48
+ if ($ updated ) {
49
+ $ this ->info ('✅ Manifest JSON updated successfully. ' );
50
+ } else {
51
+ $ this ->warn ('⚠️ Manifest file was not updated. ' );
52
+ }
53
+ } catch (\Throwable $ e ) {
54
+ $ this ->error ('❌ An error occurred while updating the manifest: ' .$ e ->getMessage ());
70
55
}
71
56
}
72
57
}
0 commit comments