From 12ecafb789864d0820a6ea9442ca1e766db4227d Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Mon, 9 Dec 2024 03:35:38 +0100 Subject: [PATCH 1/3] [Maintenance] Reorganize config files and update their extensions --- UPGRADE-2.0.md | 9 +++++---- config/{app/config.yml => config.yaml} | 4 ++-- config/{app => }/integrations.php | 2 +- config/{routing.yml => routes.yaml} | 4 ++-- config/{admin_routing.yml => routes/admin.yaml} | 0 config/{shop_routing.yml => routes/shop.yaml} | 0 config/{app => }/twig_hooks/admin/credit_memo/show.yaml | 0 config/{app => }/twig_hooks/admin/order/refund/show.yaml | 0 config/{app => }/twig_hooks/admin/order/show.yaml | 0 config/{app => }/twig_hooks/shop/account/order/show.yaml | 0 docs/legacy_installation.md | 8 ++++---- ecs.php | 1 - phpstan.neon | 1 - tests/Application/config/packages/sylius_refund.yaml | 2 +- tests/Application/config/routes.yaml | 2 +- 15 files changed, 16 insertions(+), 17 deletions(-) rename config/{app/config.yml => config.yaml} (97%) rename config/{app => }/integrations.php (84%) rename config/{routing.yml => routes.yaml} (57%) rename config/{admin_routing.yml => routes/admin.yaml} (100%) rename config/{shop_routing.yml => routes/shop.yaml} (100%) rename config/{app => }/twig_hooks/admin/credit_memo/show.yaml (100%) rename config/{app => }/twig_hooks/admin/order/refund/show.yaml (100%) rename config/{app => }/twig_hooks/admin/order/show.yaml (100%) rename config/{app => }/twig_hooks/shop/account/order/show.yaml (100%) diff --git a/UPGRADE-2.0.md b/UPGRADE-2.0.md index a484046bc..35667ef28 100644 --- a/UPGRADE-2.0.md +++ b/UPGRADE-2.0.md @@ -24,7 +24,8 @@ bin/console doctrine:migrations:migrate --no-interaction ``` -1. The directories structure has been updated to the current Symfony recommendations: +1. The structures of the directories have been updated to follow the current Symfony recommendations: + - `@SyliusRefundPlugin/Resources/assets` -> `@SyliusRefundPlugin/assets` - `@SyliusRefundPlugin/Resources/config` -> `@SyliusRefundPlugin/config` - `@SyliusRefundPlugin/Resources/translations` -> `@SyliusRefundPlugin/translations` - `@SyliusRefundPlugin/Resources/views` -> `@SyliusRefundPlugin/templates` @@ -38,9 +39,9 @@ And the routes configuration paths: ```diff - sylius_refund: - - resource: "@SyliusRefundPlugin/Resources/config/routing.yml" - + resource: "@SyliusRefundPlugin/config/routing.yml" + sylius_refund: + - resource: "@SyliusRefundPlugin/Resources/config/routing.yml" + + resource: "@SyliusRefundPlugin/config/routes.yaml" ``` Adjust the paths to assets and templates if you are using them. diff --git a/config/app/config.yml b/config/config.yaml similarity index 97% rename from config/app/config.yml rename to config/config.yaml index 2d72c2506..e5f52f575 100644 --- a/config/app/config.yml +++ b/config/config.yaml @@ -1,6 +1,6 @@ imports: - - { resource: "@SyliusRefundPlugin/config/app/twig_hooks/**/*.yaml" } - - { resource: "@SyliusRefundPlugin/config/app/integrations.php" } + - { resource: "@SyliusRefundPlugin/config/twig_hooks/**/*.yaml" } + - { resource: "@SyliusRefundPlugin/config/integrations.php" } parameters: sylius_refund.credit_memo_save_path: "%kernel.project_dir%/private/credit_memos/" diff --git a/config/app/integrations.php b/config/integrations.php similarity index 84% rename from config/app/integrations.php rename to config/integrations.php index 8dbdbd2a7..bb7116aa2 100644 --- a/config/app/integrations.php +++ b/config/integrations.php @@ -8,6 +8,6 @@ return static function (ContainerConfigurator $configurator, ContainerBuilder $container): void { if (class_exists(winzouStateMachineBundle::class)) { - $configurator->import('../integrations/winzou_state_machine.yaml'); + $configurator->import('integrations/winzou_state_machine.yaml'); } }; diff --git a/config/routing.yml b/config/routes.yaml similarity index 57% rename from config/routing.yml rename to config/routes.yaml index 3bb7c2fa6..686426c70 100644 --- a/config/routing.yml +++ b/config/routes.yaml @@ -1,9 +1,9 @@ sylius_refund_admin: - resource: "@SyliusRefundPlugin/config/admin_routing.yml" + resource: "@SyliusRefundPlugin/config/routes/admin.yaml" prefix: '/%sylius_admin.path_name%' sylius_refund_shop: - resource: "@SyliusRefundPlugin/config/shop_routing.yml" + resource: "@SyliusRefundPlugin/config/routes/shop.yaml" prefix: /{_locale} requirements: _locale: ^[a-z]{2}(?:_[A-Z]{2})?$ diff --git a/config/admin_routing.yml b/config/routes/admin.yaml similarity index 100% rename from config/admin_routing.yml rename to config/routes/admin.yaml diff --git a/config/shop_routing.yml b/config/routes/shop.yaml similarity index 100% rename from config/shop_routing.yml rename to config/routes/shop.yaml diff --git a/config/app/twig_hooks/admin/credit_memo/show.yaml b/config/twig_hooks/admin/credit_memo/show.yaml similarity index 100% rename from config/app/twig_hooks/admin/credit_memo/show.yaml rename to config/twig_hooks/admin/credit_memo/show.yaml diff --git a/config/app/twig_hooks/admin/order/refund/show.yaml b/config/twig_hooks/admin/order/refund/show.yaml similarity index 100% rename from config/app/twig_hooks/admin/order/refund/show.yaml rename to config/twig_hooks/admin/order/refund/show.yaml diff --git a/config/app/twig_hooks/admin/order/show.yaml b/config/twig_hooks/admin/order/show.yaml similarity index 100% rename from config/app/twig_hooks/admin/order/show.yaml rename to config/twig_hooks/admin/order/show.yaml diff --git a/config/app/twig_hooks/shop/account/order/show.yaml b/config/twig_hooks/shop/account/order/show.yaml similarity index 100% rename from config/app/twig_hooks/shop/account/order/show.yaml rename to config/twig_hooks/shop/account/order/show.yaml diff --git a/docs/legacy_installation.md b/docs/legacy_installation.md index 2a714625e..2c732db06 100644 --- a/docs/legacy_installation.md +++ b/docs/legacy_installation.md @@ -19,15 +19,15 @@ ```yaml imports: - - { resource: "@SyliusRefundPlugin/config/app/config.yml" } + - { resource: "@SyliusRefundPlugin/config/config.yaml" } ``` 1. Import routing: ````yaml - sylius_refund: - resource: "@SyliusRefundPlugin/config/routing.yml" + sylius_refund: + resource: "@SyliusRefundPlugin/config/routes.yaml" ```` - + 1. Apply migrations to your database: ```bash diff --git a/ecs.php b/ecs.php index 4d179d7a7..3fc32f750 100644 --- a/ecs.php +++ b/ecs.php @@ -18,7 +18,6 @@ $containerConfigurator->skip([ VisibilityRequiredFixer::class => ['*Spec.php'], InlineDocCommentDeclarationSniff::class . '.MissingVariable', - 'src/Resources/config/**', '**/var/*', ]); diff --git a/phpstan.neon b/phpstan.neon index cefe88bbb..dd1b4c50e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -12,7 +12,6 @@ parameters: - 'src/DependencyInjection/Configuration.php' # Test dependencies - - 'tests/Application/app/**.php' - 'tests/Application/src/**.php' ignoreErrors: diff --git a/tests/Application/config/packages/sylius_refund.yaml b/tests/Application/config/packages/sylius_refund.yaml index ee42ca1f0..5107d4fb1 100644 --- a/tests/Application/config/packages/sylius_refund.yaml +++ b/tests/Application/config/packages/sylius_refund.yaml @@ -1,2 +1,2 @@ imports: - - { resource: "@SyliusRefundPlugin/config/app/config.yml" } + - { resource: "@SyliusRefundPlugin/config/config.yaml" } diff --git a/tests/Application/config/routes.yaml b/tests/Application/config/routes.yaml index 5a8d73d32..e7ea95e41 100644 --- a/tests/Application/config/routes.yaml +++ b/tests/Application/config/routes.yaml @@ -1,2 +1,2 @@ sylius_refund: - resource: "@SyliusRefundPlugin/config/routing.yml" + resource: "@SyliusRefundPlugin/config/routes.yaml" From 3a215ac4116fd8eec6f3cca7021eb6284b3eb26c Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Wed, 11 Dec 2024 02:53:29 +0100 Subject: [PATCH 2/3] [Upgrade] Mention entrypoint import --- UPGRADE-2.0.md | 9 +++++++++ docs/legacy_installation.md | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/UPGRADE-2.0.md b/UPGRADE-2.0.md index 35667ef28..242841998 100644 --- a/UPGRADE-2.0.md +++ b/UPGRADE-2.0.md @@ -24,6 +24,13 @@ bin/console doctrine:migrations:migrate --no-interaction ``` +1. As the assets have been reorganized, you need to update the way you import them in your application. + Add the following line to your `assets/admin/entrypoint.js` file: + + ```js + import '../../vendor/sylius/refund-plugin/assets/entrypoint'; + ``` + 1. The structures of the directories have been updated to follow the current Symfony recommendations: - `@SyliusRefundPlugin/Resources/assets` -> `@SyliusRefundPlugin/assets` - `@SyliusRefundPlugin/Resources/config` -> `@SyliusRefundPlugin/config` @@ -31,6 +38,7 @@ - `@SyliusRefundPlugin/Resources/views` -> `@SyliusRefundPlugin/templates` You need to adjust the import of configuration file in your end application: + ```diff imports: - - { resource: "@SyliusRefundPlugin/Resources/config/config.yml" } @@ -38,6 +46,7 @@ ``` And the routes configuration paths: + ```diff sylius_refund: - resource: "@SyliusRefundPlugin/Resources/config/routing.yml" diff --git a/docs/legacy_installation.md b/docs/legacy_installation.md index 2c732db06..3550afdcc 100644 --- a/docs/legacy_installation.md +++ b/docs/legacy_installation.md @@ -21,7 +21,7 @@ imports: - { resource: "@SyliusRefundPlugin/config/config.yaml" } ``` -1. Import routing: +1. Import routes: ````yaml sylius_refund: From 9ee161fbac768c3cb29f44d7e5a92e4fd8a1a884 Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Wed, 11 Dec 2024 04:19:01 +0100 Subject: [PATCH 3/3] [Maintenance] Remove assets installation step from README --- README.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/README.md b/README.md index f50a8d76a..c1f828d54 100644 --- a/README.md +++ b/README.md @@ -51,14 +51,6 @@ From Administrator's point of view, every Refund request results in creating two bin/console doctrine:migrations:migrate ``` -1. Install assets: - - Add the following line to your `assets/admin/entrypoint.js` file: - - ```js - import '../../vendor/sylius/refund-plugin/assets/entrypoint'; - ``` - 1. Run `yarn encore dev` or `yarn encore production` 1. Default configuration assumes enabled PDF file generator. If you don't want to use that feature change your app configuration: