Skip to content

Commit

Permalink
Implement package/composer.json validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseleite committed Nov 12, 2024
1 parent b3a973f commit 5f6de45
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/StarterKits/Exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function export(): void
$this
->validateExportPath()
->validateConfig()
->validatePackage()
->instantiateModules()
->clearExportPath()
->exportModules()
Expand Down Expand Up @@ -81,6 +82,22 @@ protected function validateConfig(): self
return $this;
}

/**
* Validate package folder, if it exists.
*/
protected function validatePackage(): self
{
if (! $this->files->exists(base_path('package'))) {
return $this;
}

if (! $this->files->exists(base_path('package/composer.json'))) {
throw new StarterKitException('Package config [package/composer.json] does not exist.');
}

return $this;
}

/**
* Instantiate and validate modules that are to be installed.
*/
Expand Down

0 comments on commit 5f6de45

Please sign in to comment.