From 72452c78f370bc7460d08667d2907d6915691001 Mon Sep 17 00:00:00 2001 From: Maxime Huran Date: Wed, 31 Jul 2024 10:21:56 +0200 Subject: [PATCH 01/10] Remove dist files and recipes --- .../config/packages/config_files_filename.yaml.twig | 2 -- .../dist/config/routes/config_files_filename.yaml.twig | 9 --------- .../config/packages/config_files_filename.yaml.twig | 2 -- .../config/routes/config_files_filename.yaml.twig | 9 --------- PluginTemplate/recipes/1.0-dev/manifest.json.twig | 10 ---------- PluginTemplate/src/Resources/config/routes/admin.yaml | 0 6 files changed, 32 deletions(-) delete mode 100644 PluginTemplate/dist/config/packages/config_files_filename.yaml.twig delete mode 100644 PluginTemplate/dist/config/routes/config_files_filename.yaml.twig delete mode 100644 PluginTemplate/recipes/1.0-dev/config/packages/config_files_filename.yaml.twig delete mode 100644 PluginTemplate/recipes/1.0-dev/config/routes/config_files_filename.yaml.twig delete mode 100644 PluginTemplate/recipes/1.0-dev/manifest.json.twig delete mode 100644 PluginTemplate/src/Resources/config/routes/admin.yaml diff --git a/PluginTemplate/dist/config/packages/config_files_filename.yaml.twig b/PluginTemplate/dist/config/packages/config_files_filename.yaml.twig deleted file mode 100644 index 0f3bdca..0000000 --- a/PluginTemplate/dist/config/packages/config_files_filename.yaml.twig +++ /dev/null @@ -1,2 +0,0 @@ -imports: - resource: '@{{ pluginPascalCaseFullName }}/Resources/config/config.yaml' diff --git a/PluginTemplate/dist/config/routes/config_files_filename.yaml.twig b/PluginTemplate/dist/config/routes/config_files_filename.yaml.twig deleted file mode 100644 index 56bb4e0..0000000 --- a/PluginTemplate/dist/config/routes/config_files_filename.yaml.twig +++ /dev/null @@ -1,9 +0,0 @@ -{{ extensionAlias }}_admin: - resource: '@{{ pluginPascalCaseFullName }}/Resources/config/routes/admin.yaml' - prefix: '/%sylius_admin.path_name%' - -{{ extensionAlias }}_shop: - resource: '@{{ pluginPascalCaseFullName }}/Resources/config/routes/shop.yaml' - prefix: '/{_locale}' - requirements: - _locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$ diff --git a/PluginTemplate/recipes/1.0-dev/config/packages/config_files_filename.yaml.twig b/PluginTemplate/recipes/1.0-dev/config/packages/config_files_filename.yaml.twig deleted file mode 100644 index 0f3bdca..0000000 --- a/PluginTemplate/recipes/1.0-dev/config/packages/config_files_filename.yaml.twig +++ /dev/null @@ -1,2 +0,0 @@ -imports: - resource: '@{{ pluginPascalCaseFullName }}/Resources/config/config.yaml' diff --git a/PluginTemplate/recipes/1.0-dev/config/routes/config_files_filename.yaml.twig b/PluginTemplate/recipes/1.0-dev/config/routes/config_files_filename.yaml.twig deleted file mode 100644 index 56bb4e0..0000000 --- a/PluginTemplate/recipes/1.0-dev/config/routes/config_files_filename.yaml.twig +++ /dev/null @@ -1,9 +0,0 @@ -{{ extensionAlias }}_admin: - resource: '@{{ pluginPascalCaseFullName }}/Resources/config/routes/admin.yaml' - prefix: '/%sylius_admin.path_name%' - -{{ extensionAlias }}_shop: - resource: '@{{ pluginPascalCaseFullName }}/Resources/config/routes/shop.yaml' - prefix: '/{_locale}' - requirements: - _locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$ diff --git a/PluginTemplate/recipes/1.0-dev/manifest.json.twig b/PluginTemplate/recipes/1.0-dev/manifest.json.twig deleted file mode 100644 index 362a9bf..0000000 --- a/PluginTemplate/recipes/1.0-dev/manifest.json.twig +++ /dev/null @@ -1,10 +0,0 @@ -{ - "bundles": { - "{{ pluginPsrNamespace }}{{ pluginPascalCaseFullName }}": [ - "all" - ] - }, - "copy-from-recipe": { - "config/": "%CONFIG_DIR%/" - } -} diff --git a/PluginTemplate/src/Resources/config/routes/admin.yaml b/PluginTemplate/src/Resources/config/routes/admin.yaml deleted file mode 100644 index e69de29..0000000 From 0d749f118c08808d5fb392b79fb0136760b1a31c Mon Sep 17 00:00:00 2001 From: Maxime Huran Date: Wed, 31 Jul 2024 10:22:05 +0200 Subject: [PATCH 02/10] Simplify composer json --- PluginTemplate/composer.json.twig | 50 ++++++++----------------------- 1 file changed, 13 insertions(+), 37 deletions(-) diff --git a/PluginTemplate/composer.json.twig b/PluginTemplate/composer.json.twig index 9812f31..d53861a 100644 --- a/PluginTemplate/composer.json.twig +++ b/PluginTemplate/composer.json.twig @@ -6,39 +6,16 @@ "license": "{{ pluginLicense }}", "require": { "php": "^{{ defaultPhpVersion }}", - "sylius/sylius": ">={{ defaultSyliusVersion }} <{{ limitSyliusVersion }}" + "sylius/sylius": ">={{ minimumSyliusVersion }} <{{ limitSyliusVersion }}" }, "require-dev": { - "behat/behat": "^3.6.1", - "behat/mink-selenium2-driver": "^1.4", - "dmore/behat-chrome-extension": "^1.3", - "dmore/chrome-mink-driver": "^2.7", - "friendsofphp/php-cs-fixer": "^3.51", - "friends-of-behat/mink": "^1.8", - "friends-of-behat/mink-browserkit-driver": "^1.4", - "friends-of-behat/mink-debug-extension": "^2.0.0", - "friends-of-behat/mink-extension": "^2.4", - "friends-of-behat/page-object-extension": "^0.3", - "friends-of-behat/suite-settings-extension": "^1.0", - "friends-of-behat/symfony-extension": "^2.1", - "friends-of-behat/variadic-extension": "^1.3", - "phpmd/phpmd": "^2.15", - "phpspec/phpspec": "^7.2", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.8.1", - "phpstan/phpstan-doctrine": "1.3.40", - "phpstan/phpstan-strict-rules": "^1.3.0", - "phpstan/phpstan-webmozart-assert": "^1.2.0", - "phpunit/phpunit": "^9.5", - "polishsymfonycommunity/symfony-mocker-container": "^1.0", - "sylius-labs/coding-standard": "^4.2", - "symfony/browser-kit": "^5.4 || ^6.0", - "symfony/debug-bundle": "^5.4 || ^6.0", - "symfony/dotenv": "^5.4 || ^6.0", - "symfony/flex": "^2.2.2", - "symfony/intl": "^5.4 || ^6.0", - "symfony/web-profiler-bundle": "^5.4 || ^6.0", - "vimeo/psalm": "5.12.0" + "friendsofphp/php-cs-fixer": "^3.16", + "phpspec/phpspec": "^7.0", + "phpstan/phpstan": "^1.8.4", + "phpstan/phpstan-doctrine": "^1.3.2", + "phpstan/phpstan-webmozart-assert": "^1.1", + "phpunit/phpunit": "^10.5", + "phpmd/phpmd": "^2.15" }, "prefer-stable": true, "autoload": { @@ -51,8 +28,8 @@ "cache:clear": "symfony-cmd", "assets:install %PUBLIC_DIR%": "symfony-cmd" }, - "phpcs": "php-cs-fixer fix --using-cache=no", - "phpstan": "phpstan analyse -c phpstan.neon src/", + "phpcs": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --using-cache=no", + "phpstan": "phpstan analyse -c phpstan.neon", "phpmd": "phpmd --exclude Migrations/* src/ ansi phpmd.xml", "phpunit": "phpunit", "phpspec": "phpspec run" @@ -73,12 +50,11 @@ }, "config": { "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true, "symfony/thanks": true, - "ergebnis/composer-normalize": true, "symfony/flex": true, - "php-http/discovery": false, - "phpstan/extension-installer": true + "dealerdirect/phpcodesniffer-composer-installer": true, + "ergebnis/composer-normalize": true, + "php-http/discovery": true } } } From c02a5d9b9ea74152b1d706e2a238e7c143bfd452 Mon Sep 17 00:00:00 2001 From: Maxime Huran Date: Wed, 31 Jul 2024 10:22:24 +0200 Subject: [PATCH 03/10] Remove old syntax in docker compose file --- PluginTemplate/docker-compose.yaml.dist | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PluginTemplate/docker-compose.yaml.dist b/PluginTemplate/docker-compose.yaml.dist index ee0776f..24d6f0c 100644 --- a/PluginTemplate/docker-compose.yaml.dist +++ b/PluginTemplate/docker-compose.yaml.dist @@ -1,4 +1,3 @@ -version: '3.8' services: database: image: mysql:8.0 @@ -18,4 +17,4 @@ services: - 1080 volumes: - database: {} \ No newline at end of file + database: {} From eccfec1357b3a1b465667b1355da91a03b6aaba8 Mon Sep 17 00:00:00 2001 From: Maxime Huran Date: Wed, 31 Jul 2024 10:22:51 +0200 Subject: [PATCH 04/10] Remove recipe from YAML test because folder does not exists anymore --- PluginTemplate/Makefile.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PluginTemplate/Makefile.twig b/PluginTemplate/Makefile.twig index ab8c266..5bb1550 100644 --- a/PluginTemplate/Makefile.twig +++ b/PluginTemplate/Makefile.twig @@ -133,7 +133,7 @@ test.container: ## Lint the symfony container ${CONSOLE} lint:container test.yaml: ## Lint the symfony Yaml files - ${CONSOLE} lint:yaml ../../recipes ../../src/Resources/config + ${CONSOLE} lint:yaml ../../src/Resources/config test.schema: ## Validate MySQL Schema ${CONSOLE} doctrine:schema:validate From ac719f2753582de6f64c4236f21bf4acad39984d Mon Sep 17 00:00:00 2001 From: Maxime Huran Date: Wed, 31 Jul 2024 10:23:06 +0200 Subject: [PATCH 05/10] Update PHP stan config --- PluginTemplate/phpstan.neon.twig | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/PluginTemplate/phpstan.neon.twig b/PluginTemplate/phpstan.neon.twig index 3bc862e..50ad543 100644 --- a/PluginTemplate/phpstan.neon.twig +++ b/PluginTemplate/phpstan.neon.twig @@ -1,10 +1,7 @@ parameters: - level: max + level: 8 paths: - - %rootDir%/src/ - - checkMissingIterableValueType: false - checkGenericClassInNonGenericObjectType: false + - src/ excludePaths: # Makes PHPStan crash From 3d909c6cbc5ff0a685d2119287aef7d4d5000344 Mon Sep 17 00:00:00 2001 From: Maxime Huran Date: Wed, 31 Jul 2024 10:23:28 +0200 Subject: [PATCH 06/10] Add .env.local in dist file with symfony route host --- PluginTemplate/dist/.env.local | 1 + 1 file changed, 1 insertion(+) create mode 100644 PluginTemplate/dist/.env.local diff --git a/PluginTemplate/dist/.env.local b/PluginTemplate/dist/.env.local new file mode 100644 index 0000000..6c1a99e --- /dev/null +++ b/PluginTemplate/dist/.env.local @@ -0,0 +1 @@ +SYLIUS_FIXTURES_HOSTNAME=${SYMFONY_DEFAULT_ROUTE_HOST:-localhost} From acc8d01f4dbd803756d129e2c68ba7040b72567f Mon Sep 17 00:00:00 2001 From: Maxime Huran Date: Wed, 31 Jul 2024 10:23:53 +0200 Subject: [PATCH 07/10] Be sure we have views folder in resources --- PluginTemplate/src/Resources/views/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 PluginTemplate/src/Resources/views/.gitkeep diff --git a/PluginTemplate/src/Resources/views/.gitkeep b/PluginTemplate/src/Resources/views/.gitkeep new file mode 100644 index 0000000..e69de29 From fd264169dc6880b4289e2779e57f5772dd877f58 Mon Sep 17 00:00:00 2001 From: Maxime Huran Date: Wed, 31 Jul 2024 10:24:14 +0200 Subject: [PATCH 08/10] Remove shop route file --- PluginTemplate/src/Resources/config/routes/shop.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 PluginTemplate/src/Resources/config/routes/shop.yaml diff --git a/PluginTemplate/src/Resources/config/routes/shop.yaml b/PluginTemplate/src/Resources/config/routes/shop.yaml deleted file mode 100644 index e69de29..0000000 From c197ba82ca9b92bdf33d68bf8898e9db2bbebcd8 Mon Sep 17 00:00:00 2001 From: Maxime Huran Date: Wed, 31 Jul 2024 10:24:56 +0200 Subject: [PATCH 09/10] Manage minimum sylius version and default Sylius version --- PluginTemplate/___.github/workflows/recipe.yaml.twig | 4 ++++ castor.php | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/PluginTemplate/___.github/workflows/recipe.yaml.twig b/PluginTemplate/___.github/workflows/recipe.yaml.twig index 6df864a..1f08519 100644 --- a/PluginTemplate/___.github/workflows/recipe.yaml.twig +++ b/PluginTemplate/___.github/workflows/recipe.yaml.twig @@ -17,7 +17,11 @@ jobs: fail-fast: false matrix: php: ['{{ defaultPhpVersion }}'] +{% if minimumSyliusVersion != defaultSyliusVersion %} + sylius: ["~{{ minimumSyliusVersion }}.0", "~{{ defaultSyliusVersion }}.0"] +{% else %} sylius: ["~{{ defaultSyliusVersion }}.0"] +{% endif %} {% verbatim %} steps: - name: Setup PHP diff --git a/castor.php b/castor.php index df28668..998c84b 100644 --- a/castor.php +++ b/castor.php @@ -54,9 +54,11 @@ function create( // true|false 'isMonsieurBizPlugin' => io()->confirm('Is this a Monsieur Biz plugin?', true), // 1.12 - 'defaultSyliusVersion' => io()->ask('What is the default Sylius version of your plugin?', '1.12'), + 'minimumSyliusVersion' => io()->ask('What is the minimum Sylius version of your plugin?', '1.12'), // 1.13 - 'limitSyliusVersion' => io()->ask('What is the limit Sylius version of your plugin?', '1.13'), + 'defaultSyliusVersion' => io()->ask('What is the default Sylius version of your plugin?', '1.13'), + // 1.14 + 'limitSyliusVersion' => io()->ask('What is the limit Sylius version of your plugin? (Current Sylius version +1)', '1.14'), // 8.2 'defaultPhpVersion' => io()->ask('What is the default PHP version of your plugin?', '8.2'), // MonsieurBizSyliusBazingaExtension From b48b1a25094973c0b1238551cc11ade211abb981 Mon Sep 17 00:00:00 2001 From: Maxime Huran Date: Wed, 31 Jul 2024 10:27:57 +0200 Subject: [PATCH 10/10] Update README to explain recipes --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index edabb4d..f4cbcc9 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,9 @@ You have a Sylius installed with your plugin, you can start coding your plugin. ![Sylius in setup !](assets/sylius.jpg) +For you recipe, create a folder for your plugin with the `0.1` version in the [MonsieurBiz Symfony Recipe repo](https://github.com/monsieurbiz/symfony-recipes/). +Example : `monsieurbiz/sylius-amazing-plugin/0.1/`. + ## License Under MIT.