pwweb / artomator

Artomator: Custom commands making life easier for Laravel.
MIT License
4 stars 1 forks source link

Create graphql schema file on first artisan call #55

Closed frankpde closed 3 years ago

frankpde commented 3 years ago

If the file does not exist, an error message is displayed.

ErrorException 

  file_get_contents(/path/to/installation/schema.graphql): failed to open stream: No such file or directory

  at vendor/pwweb/artomator/src/Generators/GraphQL/GraphQLQueryGenerator.php:35
     31▕     public function __construct(CommandData $commandData)
     32▕     {
     33▕         $this->commandData = $commandData;
     34▕         $this->fileName = $commandData->config->pathGraphQL;
  ➜  35▕         $this->fileContents = file_get_contents($this->fileName);
     36▕         $this->templateData = get_artomator_template('graphql.query');
     37▕         $this->templateData = fill_template($this->commandData->dynamicVars, $this->templateData);
     38▕     }
     39▕ 

      +16 vendor frames 
  17  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
rabrowne85 commented 3 years ago

Should be easy enough to check for the file existing. Question is whether a simple blank file is enough or whether the lighthouse commands need to be run instead. May be possible to use a ->call() to run the lighthouse artisan command needed?