From 57869f6ff435d2be3d45be14dc8cc5adfa5894b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Vernet?= Date: Thu, 5 Oct 2023 22:47:17 +0200 Subject: [PATCH] feat: switch to dev env by default+web profiler --- .env | 13 ++++- .env.local.dist | 2 + Makefile | 2 + README.md | 5 +- composer.json | 7 +-- composer.lock | 83 ++++++++++++++++++++++++++++++- config/bundles.php | 1 + config/packages/web_profiler.yaml | 17 +++++++ config/routes/web_profiler.yaml | 8 +++ symfony.lock | 13 +++++ 10 files changed, 144 insertions(+), 7 deletions(-) create mode 100644 .env.local.dist create mode 100644 config/packages/web_profiler.yaml create mode 100644 config/routes/web_profiler.yaml diff --git a/.env b/.env index 427587a..861c6df 100644 --- a/.env +++ b/.env @@ -15,6 +15,15 @@ # https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration ###> symfony/framework-bundle ### -APP_ENV=prod -APP_SECRET=155f2a3ce20caf4c940aad5a3aa29410 +APP_ENV=dev +APP_DEBUG=1 +APP_SECRET=3bUhVCRkHJfT2ZJTqBnvkclRFT1zy1ig ###< symfony/framework-bundle ### + +# To test the production environmet, run: +# > cp .env.local.dist .env.local +# > bin/console asset-map:compile + +# To come back to the development environment, run: +# > rm .env.local +# > rm -rf ./public/assets/* \ No newline at end of file diff --git a/.env.local.dist b/.env.local.dist new file mode 100644 index 0000000..ec9e515 --- /dev/null +++ b/.env.local.dist @@ -0,0 +1,2 @@ +APP_ENV=prod +APP_DEBUG=0 diff --git a/Makefile b/Makefile index 52f9490..1746cb5 100644 --- a/Makefile +++ b/Makefile @@ -59,3 +59,5 @@ deploy: ## Simple manual deploy on VPS (this is to update the demo site https:// @git pull @composer install @chown -R www-data: var/* + @cp .env.local.dist .env.local + @bin/console asset-map:compile diff --git a/README.md b/README.md index 0694170..e649ae6 100644 --- a/README.md +++ b/README.md @@ -83,10 +83,13 @@ Because a live demo is always better than all explanations. Here is it: ## What it doesn't ship? ❌ -* The debug toolbar ([installation](https://symfony.com/doc/current/profiler.html)) * Doctrine ([installation](https://symfony.com/doc/current/doctrine.html#installing-doctrine)) ## References 📚 * [Castor, a journey across the sea of task runners](https://jolicode.com/blog/castor-a-journey-across-the-sea-of-task-runners) +* [Initializing your Symfony project with solid foundations](https://www.strangebuzz.com/en/blog/initializing-your-symfony-project-with-solid-foundations) +* [Organizing your Symfony project tests](https://www.strangebuzz.com/en/blog/organizing-your-symfony-project-tests) +* [What are your Symfony best practices?](https://www.strangebuzz.com/en/blog/what-are-your-symfony-best-practices) +* [Setting a CI/CD workflow for a Symfony project thanks to the GitHub actions ](https://www.strangebuzz.com/en/blog/setting-a-ci-cd-workflow-for-a-symfony-project-thanks-to-the-github-actions) diff --git a/composer.json b/composer.json index be5cdd4..c47bf8c 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,9 @@ "roave/security-advisories": "dev-latest", "symfony/browser-kit": "~6.3.0", "symfony/css-selector": "~6.3.0", - "symfony/phpunit-bridge": "^6.3" + "symfony/phpunit-bridge": "^6.3", + "symfony/stopwatch": "6.3.*", + "symfony/web-profiler-bundle": "6.3.*" }, "replace": { "symfony/polyfill-ctype": "*", @@ -101,8 +103,7 @@ ], "auto-scripts": { "cache:clear": "symfony-cmd", - "assets:install %PUBLIC_DIR%": "symfony-cmd", - "asset-map:compile": "symfony-cmd" + "assets:install %PUBLIC_DIR%": "symfony-cmd" } }, "scripts-descriptions": { diff --git a/composer.lock b/composer.lock index a78002b..1d2424e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2a4a2b040c3ffdd1377f486816f7a5a4", + "content-hash": "19a8b9c4a691b4aef0355891cb9e54e5", "packages": [ { "name": "dflydev/dot-access-data", @@ -6384,6 +6384,87 @@ } ], "time": "2023-02-16T10:14:28+00:00" + }, + { + "name": "symfony/web-profiler-bundle", + "version": "v6.3.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/web-profiler-bundle.git", + "reference": "6101b5ab7857c373d237e121f9060c68b32e1373" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/6101b5ab7857c373d237e121f9060c68b32e1373", + "reference": "6101b5ab7857c373d237e121f9060c68b32e1373", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/config": "^5.4|^6.0", + "symfony/framework-bundle": "^5.4|^6.0", + "symfony/http-kernel": "^6.3", + "symfony/routing": "^5.4|^6.0", + "symfony/twig-bundle": "^5.4|^6.0", + "twig/twig": "^2.13|^3.0.4" + }, + "conflict": { + "symfony/form": "<5.4", + "symfony/mailer": "<5.4", + "symfony/messenger": "<5.4" + }, + "require-dev": { + "symfony/browser-kit": "^5.4|^6.0", + "symfony/console": "^5.4|^6.0", + "symfony/css-selector": "^5.4|^6.0", + "symfony/stopwatch": "^5.4|^6.0" + }, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Symfony\\Bundle\\WebProfilerBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a development tool that gives detailed information about the execution of any request", + "homepage": "https://symfony.com", + "keywords": [ + "dev" + ], + "support": { + "source": "https://github.com/symfony/web-profiler-bundle/tree/v6.3.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-07-19T20:17:28+00:00" } ], "aliases": [], diff --git a/config/bundles.php b/config/bundles.php index f32711f..60df164 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -8,4 +8,5 @@ Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\UX\StimulusBundle\StimulusBundle::class => ['all' => true], + Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], ]; diff --git a/config/packages/web_profiler.yaml b/config/packages/web_profiler.yaml new file mode 100644 index 0000000..b946111 --- /dev/null +++ b/config/packages/web_profiler.yaml @@ -0,0 +1,17 @@ +when@dev: + web_profiler: + toolbar: true + intercept_redirects: false + + framework: + profiler: + only_exceptions: false + collect_serializer_data: true + +when@test: + web_profiler: + toolbar: false + intercept_redirects: false + + framework: + profiler: { collect: false } diff --git a/config/routes/web_profiler.yaml b/config/routes/web_profiler.yaml new file mode 100644 index 0000000..8d85319 --- /dev/null +++ b/config/routes/web_profiler.yaml @@ -0,0 +1,8 @@ +when@dev: + web_profiler_wdt: + resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml' + prefix: /_wdt + + web_profiler_profiler: + resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml' + prefix: /_profiler diff --git a/symfony.lock b/symfony.lock index 2185299..6906aa7 100644 --- a/symfony.lock +++ b/symfony.lock @@ -160,6 +160,19 @@ "config/packages/validator.yaml" ] }, + "symfony/web-profiler-bundle": { + "version": "6.3", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "6.1", + "ref": "e42b3f0177df239add25373083a564e5ead4e13a" + }, + "files": [ + "config/packages/web_profiler.yaml", + "config/routes/web_profiler.yaml" + ] + }, "twig/extra-bundle": { "version": "v3.5.1" }