schranz-php-recipes / symfony-recipes-php

Provides https://github.com/symfony/recipes as PHP instead of YAML configs.
MIT License
13 stars 3 forks source link

Update recipes 2023-05-27 #39

Closed symfony-php-recipes-bot closed 1 year ago

symfony-php-recipes-bot commented 1 year ago
Q A
License MIT

The Symfony Recipes changed with version . This PR contains the new definition for recipes.

github-actions[bot] commented 1 year ago

Thanks for the PR 😍

How to test these changes in your application

  1. Define the SYMFONY_ENDPOINT environment variable:

    # On Unix-like (BSD, Linux and macOS)
    export SYMFONY_ENDPOINT=https://raw.githubusercontent.com/schranz-php-recipes/symfony-recipes-php/flex/pull-39/index.json
    # On Windows
    SET SYMFONY_ENDPOINT=https://raw.githubusercontent.com/schranz-php-recipes/symfony-recipes-php/flex/pull-39/index.json
  2. Install the package(s) related to this recipe:

    composer req 'symfony/flex:^1.16'
    composer req 'symfony/asset-mapper:^6.3' 'symfony/stimulus-bundle:^2.9' 'symfony/twig-bundle:^6.3' 'symfony/ux-translator:^2.9' 'symfony/webpack-encore-bundle:^2.0'
  3. Don't forget to unset the SYMFONY_ENDPOINT environment variable when done:

    # On Unix-like (BSD, Linux and macOS)
    unset SYMFONY_ENDPOINT
    # On Windows
    SET SYMFONY_ENDPOINT=

Diff between recipe versions

In order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes. I'm going keep this comment up to date with any updates of the attached patch.

symfony/twig-bundle

3.3 vs 4.4 ```diff diff --git a/symfony/twig-bundle/3.3/config/packages/twig.php b/symfony/twig-bundle/4.4/config/packages/twig.php index b3fcf8e..c335154 100644 --- a/symfony/twig-bundle/3.3/config/packages/twig.php +++ b/symfony/twig-bundle/4.4/config/packages/twig.php @@ -9,5 +9,6 @@ return static function (ContainerConfigurator $containerConfigurator): void { 'default_path' => '%kernel.project_dir%/templates', 'debug' => '%kernel.debug%', 'strict_variables' => '%kernel.debug%', + 'exception_controller' => null, ]); }; diff --git a/symfony/twig-bundle/3.3/config/routes/dev/twig.php b/symfony/twig-bundle/3.3/config/routes/dev/twig.php deleted file mode 100644 index bdc1801..0000000 --- a/symfony/twig-bundle/3.3/config/routes/dev/twig.php +++ /dev/null @@ -1,10 +0,0 @@ -import('@TwigBundle/Resources/config/routing/errors.xml') - ->prefix('/_error'); -}; ```
4.4 vs 5.0 ```diff diff --git a/symfony/twig-bundle/4.4/config/packages/twig.php b/symfony/twig-bundle/5.0/config/packages/twig.php index c335154..46a0bf4 100644 --- a/symfony/twig-bundle/4.4/config/packages/twig.php +++ b/symfony/twig-bundle/5.0/config/packages/twig.php @@ -7,8 +7,5 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura return static function (ContainerConfigurator $containerConfigurator): void { $containerConfigurator->extension('twig', [ 'default_path' => '%kernel.project_dir%/templates', - 'debug' => '%kernel.debug%', - 'strict_variables' => '%kernel.debug%', - 'exception_controller' => null, ]); }; ```
5.0 vs 5.3 ```diff diff --git a/symfony/twig-bundle/5.0/config/packages/test/twig.php b/symfony/twig-bundle/5.0/config/packages/test/twig.php deleted file mode 100644 index 4429ff5..0000000 --- a/symfony/twig-bundle/5.0/config/packages/test/twig.php +++ /dev/null @@ -1,11 +0,0 @@ -extension('twig', [ - 'strict_variables' => true, - ]); -}; diff --git a/symfony/twig-bundle/5.0/config/packages/twig.php b/symfony/twig-bundle/5.3/config/packages/twig.php index 46a0bf4..77331d8 100644 --- a/symfony/twig-bundle/5.0/config/packages/twig.php +++ b/symfony/twig-bundle/5.3/config/packages/twig.php @@ -8,4 +8,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $containerConfigurator->extension('twig', [ 'default_path' => '%kernel.project_dir%/templates', ]); + if ($containerConfigurator->env() === 'test') { + $containerConfigurator->extension('twig', [ + 'strict_variables' => true, + ]); + } }; diff --git a/symfony/twig-bundle/5.0/manifest.json b/symfony/twig-bundle/5.3/manifest.json index 30d5643..c4835ac 100644 --- a/symfony/twig-bundle/5.0/manifest.json +++ b/symfony/twig-bundle/5.3/manifest.json @@ -5,5 +5,8 @@ "copy-from-recipe": { "config/": "%CONFIG_DIR%/", "templates/": "templates/" + }, + "conflict": { + "symfony/framework-bundle": "<5.3" } } ```
5.3 vs 5.4 ```diff diff --git a/symfony/twig-bundle/5.3/templates/base.html.twig b/symfony/twig-bundle/5.4/templates/base.html.twig index 16d7273..d4f83f7 100644 --- a/symfony/twig-bundle/5.3/templates/base.html.twig +++ b/symfony/twig-bundle/5.4/templates/base.html.twig @@ -3,14 +3,14 @@ {% block title %}Welcome!{% endblock %} - {# Run `composer require symfony/webpack-encore-bundle` - and uncomment the following Encore helpers to start using Symfony UX #} + + {# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #} {% block stylesheets %} - {#{{ encore_entry_link_tags('app') }}#} + {{ encore_entry_link_tags('app') }} {% endblock %} {% block javascripts %} - {#{{ encore_entry_script_tags('app') }}#} + {{ encore_entry_script_tags('app') }} {% endblock %} ```
5.4 vs 6.3 ```diff diff --git a/symfony/twig-bundle/5.4/templates/base.html.twig b/symfony/twig-bundle/6.3/templates/base.html.twig index d4f83f7..67598ac 100644 --- a/symfony/twig-bundle/5.4/templates/base.html.twig +++ b/symfony/twig-bundle/6.3/templates/base.html.twig @@ -4,13 +4,10 @@ {% block title %}Welcome!{% endblock %} - {# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #} {% block stylesheets %} - {{ encore_entry_link_tags('app') }} {% endblock %} {% block javascripts %} - {{ encore_entry_script_tags('app') }} {% endblock %} ```

symfony/ux-translator

2.8 vs 2.9 ```diff diff --git a/symfony/ux-translator/2.8/assets/translator.js b/symfony/ux-translator/2.9/assets/translator.js index eab7b6c..28012a6 100644 --- a/symfony/ux-translator/2.8/assets/translator.js +++ b/symfony/ux-translator/2.9/assets/translator.js @@ -1,3 +1,4 @@ +import { trans, getLocale, setLocale, setLocaleFallbacks } from '@symfony/ux-translator'; /* * This file is part of the Symfony UX Translator package. * @@ -7,10 +8,6 @@ * If you use TypeScript, you can rename this file to "translator.ts" to take advantage of types checking. */ -import { trans, getLocale, setLocale, setLocaleFallbacks } from '@symfony/ux-translator'; -import { localeFallbacks } from '../var/translations/configuration'; - setLocaleFallbacks(localeFallbacks); export { trans }; -export * from '../var/translations'; diff --git a/symfony/ux-translator/2.8/manifest.json b/symfony/ux-translator/2.9/manifest.json index 3f984fc..a1ac08b 100644 --- a/symfony/ux-translator/2.8/manifest.json +++ b/symfony/ux-translator/2.9/manifest.json @@ -2,8 +2,38 @@ "bundles": { "Symfony\\UX\\Translator\\UxTranslatorBundle": ["all"] }, + "conflict": { + "symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0" + }, "copy-from-recipe": { "assets/": "assets/", - "config/": "%CONFIG_DIR%/" - } + "config/": "%CONFIG_DIR%/", + "var/": "var/" + }, + "add-lines": [ + { + "file": "assets/translator.js", + "content": "import { localeFallbacks } from '../var/translations/configuration';", + "position": "top", + "requires": "symfony/webpack-encore-bundle" + }, + { + "file": "assets/translator.js", + "content": "import { localeFallbacks } from '@app/translations/configuration';", + "position": "top", + "requires": "symfony/asset-mapper" + }, + { + "file": "assets/translator.js", + "content": "export * from '../var/translations';", + "position": "bottom", + "requires": "symfony/webpack-encore-bundle" + }, + { + "file": "assets/translator.js", + "content": "export * from '@app/translations';", + "position": "bottom", + "requires": "symfony/asset-mapper" + } + ] } diff --git a/symfony/ux-translator/2.9/var/translations/configuration.js b/symfony/ux-translator/2.9/var/translations/configuration.js new file mode 100644 index 0000000..bea96d6 --- /dev/null +++ b/symfony/ux-translator/2.9/var/translations/configuration.js @@ -0,0 +1,3 @@ +export const localeFallbacks = {}; + +console.log('Run bin/console cache:warmup to generate the translation files.'); diff --git a/symfony/ux-translator/2.9/var/translations/index.js b/symfony/ux-translator/2.9/var/translations/index.js new file mode 100644 index 0000000..34f7c1b --- /dev/null +++ b/symfony/ux-translator/2.9/var/translations/index.js @@ -0,0 +1 @@ +console.log('Run bin/console cache:warmup to generate the translation files.'); ```

symfony/webpack-encore-bundle

1.0 vs 1.6 ```diff diff --git a/symfony/webpack-encore-bundle/1.6/config/packages/test/webpack_encore.php b/symfony/webpack-encore-bundle/1.6/config/packages/test/webpack_encore.php new file mode 100644 index 0000000..e69de29 ```
1.6 vs 1.9 ```diff diff --git a/symfony/webpack-encore-bundle/1.6/assets/controllers/hello_controller.js b/symfony/webpack-encore-bundle/1.9/assets/controllers/hello_controller.js index 8c79f65..e847027 100644 --- a/symfony/webpack-encore-bundle/1.6/assets/controllers/hello_controller.js +++ b/symfony/webpack-encore-bundle/1.9/assets/controllers/hello_controller.js @@ -1,4 +1,4 @@ -import { Controller } from 'stimulus'; +import { Controller } from '@hotwired/stimulus'; /* * This is an example Stimulus controller! diff --git a/symfony/webpack-encore-bundle/1.6/config/packages/assets.php b/symfony/webpack-encore-bundle/1.6/config/packages/assets.php deleted file mode 100644 index 1b1ce1e..0000000 --- a/symfony/webpack-encore-bundle/1.6/config/packages/assets.php +++ /dev/null @@ -1,13 +0,0 @@ -extension('framework', [ - 'assets' => [ - 'json_manifest_path' => '%kernel.project_dir%/public/build/manifest.json', - ], - ]); -}; diff --git a/symfony/webpack-encore-bundle/1.6/config/packages/prod/webpack_encore.php b/symfony/webpack-encore-bundle/1.6/config/packages/prod/webpack_encore.php deleted file mode 100644 index e69de29..0000000 diff --git a/symfony/webpack-encore-bundle/1.6/config/packages/test/webpack_encore.php b/symfony/webpack-encore-bundle/1.6/config/packages/test/webpack_encore.php deleted file mode 100644 index e69de29..0000000 diff --git a/symfony/webpack-encore-bundle/1.6/config/packages/webpack_encore.php b/symfony/webpack-encore-bundle/1.9/config/packages/webpack_encore.php index acb6760..903c669 100644 --- a/symfony/webpack-encore-bundle/1.6/config/packages/webpack_encore.php +++ b/symfony/webpack-encore-bundle/1.9/config/packages/webpack_encore.php @@ -7,5 +7,14 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura return static function (ContainerConfigurator $containerConfigurator): void { $containerConfigurator->extension('webpack_encore', [ 'output_path' => '%kernel.project_dir%/public/build', + 'script_attributes' => [ + 'defer' => true, + ], + ]); + + $containerConfigurator->extension('framework', [ + 'assets' => [ + 'json_manifest_path' => '%kernel.project_dir%/public/build/manifest.json', + ], ]); }; diff --git a/symfony/webpack-encore-bundle/1.6/package.json b/symfony/webpack-encore-bundle/1.9/package.json index ba0e4f4..813010a 100644 --- a/symfony/webpack-encore-bundle/1.6/package.json +++ b/symfony/webpack-encore-bundle/1.9/package.json @@ -1,10 +1,10 @@ { "devDependencies": { - "@symfony/stimulus-bridge": "^2.0.0", - "@symfony/webpack-encore": "^1.0.0", + "@hotwired/stimulus": "^3.0.0", + "@symfony/stimulus-bridge": "^3.0.0", + "@symfony/webpack-encore": "^1.7.0", "core-js": "^3.0.0", "regenerator-runtime": "^0.13.2", - "stimulus": "^2.0.0", "webpack-notifier": "^1.6.0" }, "license": "UNLICENSED", diff --git a/symfony/webpack-encore-bundle/1.9/post-install.txt b/symfony/webpack-encore-bundle/1.9/post-install.txt new file mode 100644 index 0000000..6169d37 --- /dev/null +++ b/symfony/webpack-encore-bundle/1.9/post-install.txt @@ -0,0 +1,5 @@ + * Install Yarn and run yarn install + + * Uncomment the Twig helpers in templates/base.html.twig (they may be already) + + * Start the development server: yarn encore dev-server ```
1.9 vs 1.10 ```diff diff --git a/symfony/webpack-encore-bundle/1.9/manifest.json b/symfony/webpack-encore-bundle/1.10/manifest.json index 84ab396..39b0363 100644 --- a/symfony/webpack-encore-bundle/1.9/manifest.json +++ b/symfony/webpack-encore-bundle/1.10/manifest.json @@ -8,11 +8,14 @@ "package.json": "package.json", "webpack.config.js": "webpack.config.js" }, - "aliases": ["ux", "encore", "webpack", "webpack-encore"], + "aliases": ["encore", "webpack", "webpack-encore"], "gitignore": [ "/node_modules/", "/%PUBLIC_DIR%/build/", "npm-debug.log", "yarn-error.log" - ] + ], + "conflict": { + "symfony/framework-bundle": "<5.4" + } } diff --git a/symfony/webpack-encore-bundle/1.9/package.json b/symfony/webpack-encore-bundle/1.10/package.json index 813010a..d83a414 100644 --- a/symfony/webpack-encore-bundle/1.9/package.json +++ b/symfony/webpack-encore-bundle/1.10/package.json @@ -1,11 +1,15 @@ { "devDependencies": { + "@babel/core": "^7.17.0", + "@babel/preset-env": "^7.16.0", "@hotwired/stimulus": "^3.0.0", - "@symfony/stimulus-bridge": "^3.0.0", - "@symfony/webpack-encore": "^1.7.0", - "core-js": "^3.0.0", - "regenerator-runtime": "^0.13.2", - "webpack-notifier": "^1.6.0" + "@symfony/stimulus-bridge": "^3.2.0", + "@symfony/webpack-encore": "^4.0.0", + "core-js": "^3.23.0", + "regenerator-runtime": "^0.13.9", + "webpack": "^5.74.0", + "webpack-cli": "^4.10.0", + "webpack-notifier": "^1.15.0" }, "license": "UNLICENSED", "private": true, diff --git a/symfony/webpack-encore-bundle/1.9/post-install.txt b/symfony/webpack-encore-bundle/1.10/post-install.txt index 6169d37..e53f05d 100644 --- a/symfony/webpack-encore-bundle/1.9/post-install.txt +++ b/symfony/webpack-encore-bundle/1.10/post-install.txt @@ -1,5 +1,3 @@ * Install Yarn and run yarn install - * Uncomment the Twig helpers in templates/base.html.twig (they may be already) - * Start the development server: yarn encore dev-server diff --git a/symfony/webpack-encore-bundle/1.9/webpack.config.js b/symfony/webpack-encore-bundle/1.10/webpack.config.js index 056b04a..408012f 100644 --- a/symfony/webpack-encore-bundle/1.9/webpack.config.js +++ b/symfony/webpack-encore-bundle/1.10/webpack.config.js @@ -11,7 +11,7 @@ Encore .setOutputPath('public/build/') // public path used by the web server to access the output path .setPublicPath('/build') - // only needed for CDN's or sub-directory deploy + // only needed for CDN's or subdirectory deploy //.setManifestKeyPrefix('build/') /* @@ -45,14 +45,15 @@ Encore // enables hashed filenames (e.g. app.abc123.css) .enableVersioning(Encore.isProduction()) - .configureBabel((config) => { - config.plugins.push('@babel/plugin-proposal-class-properties'); - }) + // configure Babel + // .configureBabel((config) => { + // config.plugins.push('@babel/a-babel-plugin'); + // }) - // enables @babel/preset-env polyfills + // enables and configure @babel/preset-env polyfills .configureBabelPresetEnv((config) => { config.useBuiltIns = 'usage'; - config.corejs = 3; + config.corejs = '3.23'; }) // enables Sass/SCSS support ```
1.10 vs 2.0 ```diff diff --git a/symfony/webpack-encore-bundle/1.10/assets/app.js b/symfony/webpack-encore-bundle/2.0/assets/app.js index bb0a6aa..8506504 100644 --- a/symfony/webpack-encore-bundle/1.10/assets/app.js +++ b/symfony/webpack-encore-bundle/2.0/assets/app.js @@ -7,6 +7,3 @@ // any CSS you import will output into a single css file (app.css in this case) import './styles/app.css'; - -// start the Stimulus application -import './bootstrap'; diff --git a/symfony/webpack-encore-bundle/1.10/assets/bootstrap.js b/symfony/webpack-encore-bundle/1.10/assets/bootstrap.js deleted file mode 100644 index 4ab2df6..0000000 --- a/symfony/webpack-encore-bundle/1.10/assets/bootstrap.js +++ /dev/null @@ -1,11 +0,0 @@ -import { startStimulusApp } from '@symfony/stimulus-bridge'; - -// Registers Stimulus controllers from controllers.json and in the controllers/ directory -export const app = startStimulusApp(require.context( - '@symfony/stimulus-bridge/lazy-controller-loader!./controllers', - true, - /\.[jt]sx?$/ -)); - -// register any custom, 3rd party controllers here -// app.register('some_controller_name', SomeImportedController); diff --git a/symfony/webpack-encore-bundle/1.10/assets/controllers/hello_controller.js b/symfony/webpack-encore-bundle/1.10/assets/controllers/hello_controller.js deleted file mode 100644 index e847027..0000000 --- a/symfony/webpack-encore-bundle/1.10/assets/controllers/hello_controller.js +++ /dev/null @@ -1,16 +0,0 @@ -import { Controller } from '@hotwired/stimulus'; - -/* - * This is an example Stimulus controller! - * - * Any element with a data-controller="hello" attribute will cause - * this controller to be executed. The name "hello" comes from the filename: - * hello_controller.js -> "hello" - * - * Delete this file or adapt it for your use! - */ -export default class extends Controller { - connect() { - this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js'; - } -} diff --git a/symfony/webpack-encore-bundle/1.10/assets/controllers.json b/symfony/webpack-encore-bundle/1.10/assets/controllers.json deleted file mode 100644 index a1c6e90..0000000 --- a/symfony/webpack-encore-bundle/1.10/assets/controllers.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "controllers": [], - "entrypoints": [] -} diff --git a/symfony/webpack-encore-bundle/1.10/manifest.json b/symfony/webpack-encore-bundle/2.0/manifest.json index 39b0363..6c2c542 100644 --- a/symfony/webpack-encore-bundle/1.10/manifest.json +++ b/symfony/webpack-encore-bundle/2.0/manifest.json @@ -8,7 +8,7 @@ "package.json": "package.json", "webpack.config.js": "webpack.config.js" }, - "aliases": ["encore", "webpack", "webpack-encore"], + "aliases": ["ux", "encore", "webpack", "webpack-encore"], "gitignore": [ "/node_modules/", "/%PUBLIC_DIR%/build/", @@ -16,6 +16,23 @@ "yarn-error.log" ], "conflict": { - "symfony/framework-bundle": "<5.4" - } + "symfony/framework-bundle": "<5.4", + "symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0" + }, + "add-lines": [ + { + "file": "templates/base.html.twig", + "content": " {{ encore_entry_script_tags('app') }}", + "position": "after_target", + "target": "{% block javascripts %}", + "warn_if_missing": true + }, + { + "file": "templates/base.html.twig", + "content": " {{ encore_entry_link_tags('app') }}", + "position": "after_target", + "target": "{% block stylesheets %}", + "warn_if_missing": true + } + ] } diff --git a/symfony/webpack-encore-bundle/1.10/package.json b/symfony/webpack-encore-bundle/2.0/package.json index d83a414..b4ce2a6 100644 --- a/symfony/webpack-encore-bundle/1.10/package.json +++ b/symfony/webpack-encore-bundle/2.0/package.json @@ -2,8 +2,6 @@ "devDependencies": { "@babel/core": "^7.17.0", "@babel/preset-env": "^7.16.0", - "@hotwired/stimulus": "^3.0.0", - "@symfony/stimulus-bridge": "^3.2.0", "@symfony/webpack-encore": "^4.0.0", "core-js": "^3.23.0", "regenerator-runtime": "^0.13.9", diff --git a/symfony/webpack-encore-bundle/1.10/webpack.config.js b/symfony/webpack-encore-bundle/2.0/webpack.config.js index 408012f..9d752df 100644 --- a/symfony/webpack-encore-bundle/1.10/webpack.config.js +++ b/symfony/webpack-encore-bundle/2.0/webpack.config.js @@ -22,9 +22,6 @@ Encore */ .addEntry('app', './assets/app.js') - // enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js) - .enableStimulusBridge('./assets/controllers.json') - // When enabled, Webpack "splits" your files into smaller pieces for greater optimization. .splitEntryChunks() ```