From 7bab7e91f49cc820914cab8436e16aeab2ea30ef Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sun, 21 Jan 2024 22:01:49 +0000 Subject: [PATCH] Remove Astro --- box.json.dist | 4 +- src/Action/CreateListOfFilesToGenerate.php | 10 -- src/DataTransferObject/ConfigDto.php | 2 +- src/Enum/ProjectType.php | 1 - templates/astro/.envrc.twig | 3 - templates/astro/.gitignore.twig | 20 ---- templates/astro/flake.nix.twig | 25 ---- templates/astro/run.twig | 111 ------------------ templates/astro/tsconfig.json.twig | 12 -- .../Validator/ConfigurationValidatorTest.php | 1 - 10 files changed, 2 insertions(+), 187 deletions(-) delete mode 100644 templates/astro/.envrc.twig delete mode 100644 templates/astro/.gitignore.twig delete mode 100644 templates/astro/flake.nix.twig delete mode 100755 templates/astro/run.twig delete mode 100644 templates/astro/tsconfig.json.twig diff --git a/box.json.dist b/box.json.dist index 5113af7..405f7de 100644 --- a/box.json.dist +++ b/box.json.dist @@ -14,9 +14,7 @@ "templates/drupal/.env.example.twig", "templates/drupal/.hadolint.yaml.twig", "templates/drupal/.gitignore.twig", - "templates/terraform/.gitignore.twig", - "templates/astro/.envrc.twig", - "templates/astro/.gitignore.twig" + "templates/terraform/.gitignore.twig" ], "directories": [ "config", diff --git a/src/Action/CreateListOfFilesToGenerate.php b/src/Action/CreateListOfFilesToGenerate.php index d722aba..22bddd6 100644 --- a/src/Action/CreateListOfFilesToGenerate.php +++ b/src/Action/CreateListOfFilesToGenerate.php @@ -25,16 +25,6 @@ final class CreateListOfFilesToGenerate $filesToGenerate = collect(); switch (strtolower($configDto->type)) { - case (strtolower(ProjectType::Astro->name)): - $filesToGenerate = collect([ - new TemplateFile(data: 'astro/.envrc', name: '.envrc'), - new TemplateFile(data: 'astro/.gitignore', name: '.gitignore'), - new TemplateFile(data: 'astro/flake.nix', name: 'flake.nix'), - new TemplateFile(data: 'astro/run', name: 'run'), - new TemplateFile(data: 'astro/tsconfig.json', name: 'tsconfig.json'), - ]); - break; - case (strtolower(ProjectType::Fractal->name)): $filesToGenerate = collect([ new TemplateFile(data: 'fractal/.gitignore', name: '.gitignore'), diff --git a/src/DataTransferObject/ConfigDto.php b/src/DataTransferObject/ConfigDto.php index 4c61653..3f3c577 100644 --- a/src/DataTransferObject/ConfigDto.php +++ b/src/DataTransferObject/ConfigDto.php @@ -243,7 +243,7 @@ final class ConfigDto #[Assert\Type('string')] public string $projectRoot; - #[Assert\Choice(choices: ['astro', 'drupal', 'fractal', 'laravel', 'php-library', 'symfony', 'terraform'])] + #[Assert\Choice(choices: ['drupal', 'fractal', 'laravel', 'php-library', 'symfony', 'terraform'])] public string $type; #[Assert\Collection([ diff --git a/src/Enum/ProjectType.php b/src/Enum/ProjectType.php index 12f0868..ef8507c 100644 --- a/src/Enum/ProjectType.php +++ b/src/Enum/ProjectType.php @@ -6,7 +6,6 @@ namespace App\Enum; enum ProjectType: string { - case Astro = 'astro'; case Drupal = 'drupal'; case Fractal = 'fractal'; case Laravel = 'laravel'; diff --git a/templates/astro/.envrc.twig b/templates/astro/.envrc.twig deleted file mode 100644 index cff5673..0000000 --- a/templates/astro/.envrc.twig +++ /dev/null @@ -1,3 +0,0 @@ -# {{ managedText|raw }} - -use flake diff --git a/templates/astro/.gitignore.twig b/templates/astro/.gitignore.twig deleted file mode 100644 index 5a3a420..0000000 --- a/templates/astro/.gitignore.twig +++ /dev/null @@ -1,20 +0,0 @@ -# {{ managedText | raw }} - -.astro -.direnv -.env -.env.production -dist -node_modules -npm-debug.log* -pnpm-debug.log* -yarn-debug.log* -yarn-error.log* - -{% if flake is defined %} -.dir-env/ -{% endif %} - -{% for path in git.ignore %} -{{ path }} -{% endfor %} diff --git a/templates/astro/flake.nix.twig b/templates/astro/flake.nix.twig deleted file mode 100644 index 8180f23..0000000 --- a/templates/astro/flake.nix.twig +++ /dev/null @@ -1,25 +0,0 @@ -# {{ managedText|raw }} - -{ - inputs = { - devshell.url = "github:numtide/devshell"; - nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; - }; - - outputs = inputs@{ flake-parts, ... }: - flake-parts.lib.mkFlake { inherit inputs; } { - imports = [ inputs.devshell.flakeModule ]; - - systems = [ "x86_64-linux" ]; - - perSystem = { config, self', inputs', pkgs, system, ... }: { - devshells.default = { - packages = with pkgs; [ -{% for package in flake.devshell.packages %} - "{{ package }}" -{% endfor %} - ]; - }; - }; - }; -} diff --git a/templates/astro/run.twig b/templates/astro/run.twig deleted file mode 100755 index 369a6de..0000000 --- a/templates/astro/run.twig +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env bash - -# {{ managedText | raw }} - -set -o errexit -set -o pipefail - -PATH="$PATH:./node_modules/.bin" - -{% if not isFlake %} -# If we're running in CI we need to disable TTY allocation for docker compose -# commands that enable it by default, such as exec and run. -TTY="${TTY:-}" -if [[ ! -t 1 ]]; then - TTY="-T" -fi -{% endif %} - -# Remove and generated or temporary files. -function build { - astro build "${@}" -} - -# Remove and generated or temporary files. -function clean { - rm -fr build node_modules - touch build/.keep -} - -# Disable Git hooks. -function git-hooks:off { - git config --unset core.hooksPath -} - -# Enable Git hooks. -function git-hooks:on { - git config core.hooksPath .githooks -} - -# Create a new Fractal component. -function fractal:new { - mkdir -p "components/${1}" - - echo "name: ${1}" > "components/${1}/${1}.config.yml" - echo "${1}" > "components/${1}/${1}.twig" -} - -# Display a list of all available commands. -function help { - printf "%s [args]\n\nTasks:\n" "${0}" - - compgen -A function | grep -v "^_" | cat -n - - printf "\nExtended help:\n Each task has comments for general usage\n" -} - -# Start the project. -function start { - {% if not isFlake %} - cp -v --no-clobber .env.example .env || true - docker compose up -d - {% else %} - fractal start --sync - {% endif %} -} - -function sync { - clean - fractal build - - aws s3 sync "build/." s3://"${BUCKET_NAME}" \ - --acl "public-read" \ - --cache-control max-age=3600 -} - -{% if not isFlake %} -# Run a command within the node container. -function cmd { - docker compose exec node yarn "${@}" -} - -# Stop the project -function stop { - docker compose down -} - -# Execute yarn commands. -function yarn { - cmd node yarn "${@}" -} - -function _run { - local service="${1}" - local command="${2}" - - docker compose run \ - --entrypoint "${command}" \ - --no-deps \ - --rm \ - -T \ - "${service}" "${@}" -} -{% endif %} - -# Include any local tasks. -[[ -e run.local ]] && source run.local - -TIMEFORMAT=$'\nTask completed in %3lR' -time "${@:-help}" - -# vim: ft=bash diff --git a/templates/astro/tsconfig.json.twig b/templates/astro/tsconfig.json.twig deleted file mode 100644 index d19ebb7..0000000 --- a/templates/astro/tsconfig.json.twig +++ /dev/null @@ -1,12 +0,0 @@ -// {{ managedText }} - -{ - "extends": "astro/tsconfigs/strict", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "~/*": ["src/*"] - }, - "strictNullChecks": true - } -} diff --git a/tests/Kernel/Validator/ConfigurationValidatorTest.php b/tests/Kernel/Validator/ConfigurationValidatorTest.php index c910434..49ef283 100644 --- a/tests/Kernel/Validator/ConfigurationValidatorTest.php +++ b/tests/Kernel/Validator/ConfigurationValidatorTest.php @@ -213,7 +213,6 @@ class ConfigurationValidatorTest extends KernelTestCase public static function projectTypeProvider(): \Generator { return [ - yield 'astro' => [ProjectType::Astro->value, 0, null], yield 'drupal' => [ProjectType::Drupal->value, 0, null], yield 'fractal' => [ProjectType::Fractal->value, 0, null], yield 'invalid' => ['not-a-project-type', 1, 'The value you selected is not a valid choice.'],