From e06e1db6711d160148715f860810a965101b5812 Mon Sep 17 00:00:00 2001 From: Alex Lingris Date: Fri, 4 Oct 2024 19:26:19 +0300 Subject: [PATCH] generators gix --- src/Commands/GenerateCollectionSchema.php | 6 ++++++ src/Commands/GenerateFileSchema.php | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/Commands/GenerateCollectionSchema.php b/src/Commands/GenerateCollectionSchema.php index bf8a845..9849fdc 100644 --- a/src/Commands/GenerateCollectionSchema.php +++ b/src/Commands/GenerateCollectionSchema.php @@ -27,6 +27,12 @@ class GenerateCollectionSchema extends Command $json = json_encode($schema, JSON_PRETTY_PRINT); $configDir = base_path(config('lucent.schemas_path')); + + if(!file_exists($configDir)) { + $this->error("Your config directory \"$configDir\" doesn't exist. Create it first and run again"); + return; + } + $schemaPath = $configDir . "/" . $name . '.json'; if(file_exists($schemaPath)){ diff --git a/src/Commands/GenerateFileSchema.php b/src/Commands/GenerateFileSchema.php index 56673af..d452ade 100644 --- a/src/Commands/GenerateFileSchema.php +++ b/src/Commands/GenerateFileSchema.php @@ -28,8 +28,15 @@ class GenerateFileSchema extends Command $json = json_encode($schema, JSON_PRETTY_PRINT); $configDir = base_path(config('lucent.schemas_path')); + + if(!file_exists($configDir)) { + $this->error("Your config directory \"$configDir\" doesn't exist. Create it first and run again"); + return; + } + $schemaPath = $configDir . "/" . $name . '.json'; + if (file_exists($schemaPath)) { $this->error("The schema file already exists."); return 0;