mirror of
https://github.com/opdavies/build-configs.git
synced 2025-09-06 03:15:34 +01:00
refactor(fractal): reorganise templates
Refs: OD-44
This commit is contained in:
parent
b6b6e86558
commit
cfbdeb375e
13 changed files with 235 additions and 11 deletions
|
@ -22,6 +22,9 @@ final class CreateListOfFilesToGenerate
|
|||
*/
|
||||
[$configurationData, $configurationDataDto] = $configurationDataAndDto;
|
||||
|
||||
$isDocker = static::isDocker($configurationData);
|
||||
$isFlake = static::isFlake($configurationData);
|
||||
|
||||
/** @var Collection<int, TemplateFile> */
|
||||
$filesToGenerate = collect();
|
||||
|
||||
|
@ -36,6 +39,25 @@ final class CreateListOfFilesToGenerate
|
|||
]);
|
||||
break;
|
||||
|
||||
case (strtolower(ProjectType::Fractal->name)):
|
||||
$filesToGenerate = collect([
|
||||
new TemplateFile(data: 'fractal/.gitignore', name: '.gitignore'),
|
||||
new TemplateFile(data: 'fractal/justfile', name: 'justfile'),
|
||||
]);
|
||||
|
||||
if (self::isDocker($configurationData)) {
|
||||
$filesToGenerate->push(new TemplateFile(data: 'fractal/.env.example', name: '.env.example'));
|
||||
$filesToGenerate->push(new TemplateFile(data: 'fractal/.dockerignore', name: '.dockerignore'));
|
||||
$filesToGenerate->push(new TemplateFile(data: 'fractal/.hadolint.yaml', name: '.hadolint.yaml'));
|
||||
$filesToGenerate->push(new TemplateFile(data: 'fractal/.yarnrc', name: '.yarnrc'));
|
||||
$filesToGenerate->push(new TemplateFile(data: 'fractal/Dockerfile', name: 'Dockerfile'));
|
||||
$filesToGenerate->push(new TemplateFile(data: 'fractal/docker-compose.yaml', name: 'docker-compose.yaml'));
|
||||
} elseif (self::isFlake($configurationData)) {
|
||||
$filesToGenerate->push(new TemplateFile(data: 'fractal/.envrc', name: '.envrc'));
|
||||
$filesToGenerate->push(new TemplateFile(data: 'fractal/flake.nix', name: 'flake.nix'));
|
||||
}
|
||||
break;
|
||||
|
||||
case (strtolower(ProjectType::Drupal->name)):
|
||||
$filesToGenerate = collect([
|
||||
new TemplateFile(data: 'drupal/.dockerignore', name: '.dockerignore'),
|
||||
|
@ -76,9 +98,6 @@ final class CreateListOfFilesToGenerate
|
|||
return $next([$configurationData, $configurationDataDto, $filesToGenerate]);
|
||||
}
|
||||
|
||||
$isDocker = static::isDocker($configurationData);
|
||||
$isFlake = static::isFlake($configurationData);
|
||||
|
||||
if ($isDocker) {
|
||||
$filesToGenerate->push(new TemplateFile(data: 'common/.dockerignore', name: '.dockerignore'));
|
||||
$filesToGenerate->push(new TemplateFile(data: 'common/.hadolint.yaml', name: '.hadolint.yaml'));
|
||||
|
@ -121,13 +140,6 @@ final class CreateListOfFilesToGenerate
|
|||
}
|
||||
}
|
||||
|
||||
if (static::isTypeScript(Arr::get($configurationData, 'language'))) {
|
||||
if ($isDocker) {
|
||||
$filesToGenerate[] = new TemplateFile(data: 'typescript/.yarnrc', name: '.yarnrc');
|
||||
$filesToGenerate[] = new TemplateFile(data: 'typescript/Dockerfile', name: 'Dockerfile');
|
||||
}
|
||||
}
|
||||
|
||||
if (static::isCaddy(Arr::get($configurationData, 'web.type'))) {
|
||||
$filesToGenerate[] = new TemplateFile(
|
||||
data: 'web/caddy/Caddyfile',
|
||||
|
|
|
@ -46,7 +46,7 @@ final class Config
|
|||
)]
|
||||
public array $experimental;
|
||||
|
||||
#[Assert\Choice(choices: ['php', 'typescript'])]
|
||||
#[Assert\Choice(choices: ['javascript', 'php', 'typescript'])]
|
||||
#[Assert\NotBlank]
|
||||
public string $language;
|
||||
|
||||
|
|
|
@ -8,4 +8,5 @@ enum ProjectType
|
|||
{
|
||||
case Astro;
|
||||
case Drupal;
|
||||
case Fractal;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue