diff --git a/.castor/qa.php b/.castor/qa.php index 184b20e..40f050f 100644 --- a/.castor/qa.php +++ b/.castor/qa.php @@ -15,22 +15,22 @@ function all(): void #[AsTask(description: 'Installs tooling')] function install(): void { - docker_compose_run('composer install -o', workDir: '/home/app/root/tools/php-cs-fixer'); - docker_compose_run('composer install -o', workDir: '/home/app/root/tools/phpstan'); + docker_compose_run('composer install -o --working-dir=tools/php-cs-fixer'); + docker_compose_run('composer install -o --working-dir=tools/phpstan'); } #[AsTask(description: 'Runs PHPStan')] function phpstan(): void { - docker_compose_run('phpstan --configuration=/home/app/root/phpstan.neon', workDir: '/home/app/application'); + docker_compose_run('phpstan'); } #[AsTask(description: 'Fixes Coding Style')] function cs(bool $dryRun = false): void { if ($dryRun) { - docker_compose_run('php-cs-fixer fix --dry-run --diff', workDir: '/home/app/root'); + docker_compose_run('php-cs-fixer fix --dry-run --diff'); } else { - docker_compose_run('php-cs-fixer fix', workDir: '/home/app/root'); + docker_compose_run('php-cs-fixer fix'); } } diff --git a/.castor/utils.php b/.castor/utils.php index f6bc8fd..340666e 100644 --- a/.castor/utils.php +++ b/.castor/utils.php @@ -66,7 +66,6 @@ function create_default_context(): Context 'project_name' => 'app', 'root_domain' => 'app.test', 'extra_domains' => [], - 'project_directory' => 'application', 'php_version' => '8.2', 'docker_compose_files' => [ 'docker-compose.yml', @@ -163,7 +162,6 @@ function docker_compose(array $subCommand, Context $c = null, bool $withBuilder ->withTimeout(null) ->withEnvironment([ 'PROJECT_NAME' => variable('project_name'), - 'PROJECT_DIRECTORY' => variable('project_directory'), 'PROJECT_ROOT_DOMAIN' => variable('root_domain'), 'PROJECT_DOMAINS' => $domains, 'USER_ID' => variable('user_id'), diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a2e1f3..d09510e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ * Drop support for PHP < 8.1 * Add some PHP tooling (PHP-CS-Fixer, PHPStan) * Add `castor init` command to initialize a new project +* Remove support for custom `project_directory` ## 3.11.0 (2023-05-30) diff --git a/README.md b/README.md index 22a491b..0b7c38d 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,6 @@ domain where the application will be available; * `extra_domains` (optional): This contains extra domains where the application will be available; -* `project_directory` (optional, default: `application`): This is the host -directory containing your PHP application; - * `php_version` (optional, default: `8.2`): This is PHP version. For example: @@ -53,7 +50,6 @@ function create_default_parameters(): Context "admin.{$projectName}.{$tld}", "api.{$projectName}.{$tld}", ], - 'project_directory' => 'application', 'php_version' => 8.2, ]; ) @@ -177,7 +173,7 @@ If you want to use Webpack Encore in a Symfony project, context: services/php target: builder volumes: - - "../../${PROJECT_DIRECTORY}:/home/app/application:cached" + - "../..:/home/app/application:cached" command: "yarn run dev-server --hot --host 0.0.0.0 --allowed-hosts encore.${PROJECT_ROOT_DOMAIN} --allowed-hosts ${PROJECT_ROOT_DOMAIN} --client-web-socket-url-hostname encore.${PROJECT_ROOT_DOMAIN} --client-web-socket-url-port 443 --client-web-socket-url-protocol wss" labels: - "traefik.enable=true" @@ -662,7 +658,7 @@ services: context: services/php target: cron volumes: - - "../../${PROJECT_DIRECTORY}:/home/app/application:cached" + - "../..:/home/app/application:cached" ``` @@ -796,7 +792,7 @@ index 2eda814..59f8fed 100644 + - mysql #- rabbitmq volumes: - - "../../${PROJECT_DIRECTORY}:/home/app/application:cached" + - "../..:/home/app/application:cached" diff --git a/infrastructure/docker/docker-compose.yml b/infrastructure/docker/docker-compose.yml index 49a2661..1804a01 100644 --- a/infrastructure/docker/docker-compose.yml @@ -817,7 +813,7 @@ index 49a2661..1804a01 100644 - - postgres + - mysql volumes: - - "../../${PROJECT_DIRECTORY}:/home/app/application:cached" + - "../..:/home/app/application:cached" labels: @@ -24,10 +24,7 @@ services: # Comment the next line to be able to access frontend via HTTP instead of HTTPS diff --git a/castor.php b/castor.php index e1592f5..db51d87 100644 --- a/castor.php +++ b/castor.php @@ -23,7 +23,6 @@ function create_default_variables(): array 'extra_domains' => [ "www.{$projectName}.{$tld}", ], - 'project_directory' => 'application', 'php_version' => $_SERVER['DS_PHP_VERSION'] ?? '8.2', ]; } @@ -49,14 +48,14 @@ function start(): void #[AsTask(description: 'Installs the application (composer, yarn, ...)', namespace: 'app')] function install(): void { - $basePath = sprintf('%s/%s', variable('root_dir'), variable('project_directory')); + $rootDir = variable('root_dir'); - if (is_file("{$basePath}/composer.json")) { + if (is_file("{$rootDir}/composer.json")) { docker_compose_run('composer install -n --prefer-dist --optimize-autoloader'); } - if (is_file("{$basePath}/yarn.lock")) { + if (is_file("{$rootDir}/yarn.lock")) { docker_compose_run('yarn'); - } elseif (is_file("{$basePath}/package.json")) { + } elseif (is_file("{$rootDir}/package.json")) { docker_compose_run('npm install'); } diff --git a/infrastructure/docker/docker-compose.builder.yml b/infrastructure/docker/docker-compose.builder.yml index b79f0cf..c6ff270 100644 --- a/infrastructure/docker/docker-compose.builder.yml +++ b/infrastructure/docker/docker-compose.builder.yml @@ -22,5 +22,4 @@ services: volumes: - "builder-data:/home/app" - "${COMPOSER_CACHE_DIR}:/home/app/.composer/cache" - - "../../${PROJECT_DIRECTORY}:/home/app/application:cached" - - "../..:/home/app/root:cached" + - "../..:/home/app/application:cached" diff --git a/infrastructure/docker/docker-compose.worker.yml b/infrastructure/docker/docker-compose.worker.yml index bc3a2c3..abbcf6c 100644 --- a/infrastructure/docker/docker-compose.worker.yml +++ b/infrastructure/docker/docker-compose.worker.yml @@ -10,7 +10,7 @@ x-services-templates: - postgres #- rabbitmq volumes: - - "../../${PROJECT_DIRECTORY}:/home/app/application:cached" + - "../..:/home/app/application:cached" user: app labels: - "docker-starter.worker.${PROJECT_NAME}" diff --git a/infrastructure/docker/docker-compose.yml b/infrastructure/docker/docker-compose.yml index 4e75fbb..b47d23f 100644 --- a/infrastructure/docker/docker-compose.yml +++ b/infrastructure/docker/docker-compose.yml @@ -18,7 +18,7 @@ services: depends_on: - postgres volumes: - - "../../${PROJECT_DIRECTORY}:/home/app/application:cached" + - "../..:/home/app/application:cached" environment: - "PHP_VERSION=${PHP_VERSION}" labels: diff --git a/infrastructure/docker/services/php/Dockerfile b/infrastructure/docker/services/php/Dockerfile index e97d1b0..67df299 100644 --- a/infrastructure/docker/services/php/Dockerfile +++ b/infrastructure/docker/services/php/Dockerfile @@ -115,4 +115,4 @@ RUN mkdir -p "/home/app/.composer/cache" \ && chown app: /home/app/.composer -R # Third party tools -ENV PATH="$PATH:/home/app/root/tools/bin" +ENV PATH="$PATH:/home/app/application/tools/bin" diff --git a/phpstan.neon b/phpstan.neon index e819040..9242929 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -18,7 +18,6 @@ parameters: project_name: string, root_domain: string, extra_domains: string[], - project_directory: string, php_version: string, docker_compose_files: string[], macos: bool, diff --git a/application/public/index.php b/public/index.php similarity index 100% rename from application/public/index.php rename to public/index.php