@@ -269,14 +269,21 @@ def list_str(values):
269269 app_svc .register_subapp ("/api/v2" , app .api .v2 .make_app (app_svc .get_services ()))
270270 init_swagger_documentation (app_svc .application )
271271 if args .uiDevHost :
272- if not os .path .exists (f"{ MAGMA_PATH } /dist" ):
272+ if not os .path .exists (f"{ MAGMA_PATH } /dist" ) and ( os . path . exists ( f" { MAGMA_PATH } " ) and len ( os . listdir ( MAGMA_PATH )) > 0 ) :
273273 logging .info ("Building VueJS front-end." )
274274 subprocess .run (["npm" , "run" , "build" ], cwd = MAGMA_PATH , check = True )
275275 logging .info ("VueJS front-end build complete." )
276+ else :
277+ logging .warning (
278+ f"[bright_yellow]The `--uidev` flag was supplied, but the Caldera v5 Vue UI is not present."
279+ f" The Vue UI should be located in { MAGMA_PATH } . Use `--recursive` when cloning Caldera."
280+ f" Flag ignored; continuing with default server startup.[/bright_yellow]"
281+ )
282+ args .uiDevHost = False
276283 app_svc .application .on_response_prepare .append (enable_cors )
277284
278285 if args .build :
279- if len (os .listdir (MAGMA_PATH )) > 0 :
286+ if os . path . exists ( f" { MAGMA_PATH } " ) and len (os .listdir (MAGMA_PATH )) > 0 :
280287 logging .info ("Building VueJS front-end." )
281288 subprocess .run (["npm" , "install" ], cwd = MAGMA_PATH , check = True )
282289 subprocess .run (["npm" , "run" , "build" ], cwd = MAGMA_PATH , check = True )
@@ -287,12 +294,18 @@ def list_str(values):
287294 f" The Vue UI should be located in { MAGMA_PATH } . Use `--recursive` when cloning Caldera.[/bright_yellow]"
288295 )
289296 else :
290- if not os .path .exists (f"{ MAGMA_PATH } /dist" ):
297+ if os . path . exists ( f" { MAGMA_PATH } " ) and len ( os . listdir ( MAGMA_PATH )) > 0 and not os .path .exists (f"{ MAGMA_PATH } /dist" ):
291298 logging .warning (
292- "[bright_yellow]Built Caldera v5 Vue components not detected, and `--build` flag not supplied."
293- " If attempting to start Caldera v5 for the first time, the `--build` flag must be"
299+ "[bright_yellow]Caldera v5 Vue UI source detected, but not built components , and `--build` flag not supplied."
300+ " If attempting to start Caldera v5 with the UI for the first time, the `--build` flag must be"
294301 " supplied to trigger the building of the Vue source components.[/bright_yellow]"
295302 )
303+ elif not os .path .exists (f"{ MAGMA_PATH } /dist" ):
304+ logging .warning (
305+ f"[bright_yellow]Built Caldera v5 Vue components not detected, and `--build` flag not supplied."
306+ f" If attempting to start Caldera v5 with the UI for the first time, the `--build` flag and"
307+ f" Magma plugin (located in { MAGMA_PATH } ) must be supplied to trigger the building of the Vue source components.[/bright_yellow]"
308+ )
296309
297310 if args .fresh :
298311 logging .info (
0 commit comments