refactor(astro): create TemplateFile directly

This commit is contained in:
Oliver Davies 2023-09-24 23:05:54 +01:00
parent c9faf7bda3
commit e7fc07fd54

View file

@ -28,17 +28,11 @@ final class CreateListOfFilesToGenerate
switch (strtolower($configurationDataDto->type)) { switch (strtolower($configurationDataDto->type)) {
case (strtolower(ProjectType::Astro->name)): case (strtolower(ProjectType::Astro->name)):
$filesToGenerate = collect([ $filesToGenerate = collect([
['astro/.envrc', '.envrc'], new TemplateFile(data: 'astro/.envrc', name: '.envrc'),
['astro/.gitignore', '.gitignore'], new TemplateFile(data: 'astro/.gitignore', name: '.gitignore'),
['astro/flake.nix', 'flake.nix'], new TemplateFile(data: 'astro/flake.nix', name: 'flake.nix'),
['astro/tsconfig.json', 'tsconfig.json'], new TemplateFile(data: 'astro/tsconfig.json', name: 'tsconfig.json'),
])->map(function (array $file) { ]);
return new TemplateFile(
data: $file[0],
name: $file[1],
path: null,
);
});
break; break;
case (strtolower(ProjectType::Drupal->name)): case (strtolower(ProjectType::Drupal->name)):