Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recipe for zenstruck/foundry 2.0 #1351

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

kbond
Copy link
Member

@kbond kbond commented Oct 30, 2024

Q A
License MIT
Doc issue/PR n/a

Removes a deprecated config option.

@symfony-recipes-bot symfony-recipes-bot enabled auto-merge (squash) October 30, 2024 19:41
Copy link

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/symfony/recipes/flex/pull-1351/index.json
    # On Windows
    SET SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1351/index.json
  2. Install the package(s) related to this recipe:

    composer req 'symfony/flex:^1.16'
    composer req 'zenstruck/foundry:^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.

zenstruck/foundry

1.9 vs 1.10
diff --git a/zenstruck/foundry/1.9/config/packages/dev/zenstruck_foundry.yaml b/zenstruck/foundry/1.9/config/packages/dev/zenstruck_foundry.yaml
deleted file mode 100644
index 655840c..0000000
--- a/zenstruck/foundry/1.9/config/packages/dev/zenstruck_foundry.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-# See full configuration: https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#full-default-bundle-configuration
-zenstruck_foundry:
-    # Whether to auto-refresh proxies by default (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#auto-refresh)
-    auto_refresh_proxies: true
diff --git a/zenstruck/foundry/1.9/config/packages/test/zenstruck_foundry.yaml b/zenstruck/foundry/1.9/config/packages/test/zenstruck_foundry.yaml
deleted file mode 100644
index 3bf6547..0000000
--- a/zenstruck/foundry/1.9/config/packages/test/zenstruck_foundry.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-# Unless you want different configuration for test/dev environments,
-# add configuration to config/packages/dev/zenstruck_foundry.yml
-# and this will be synced to your test environment.
-imports:
-    - { resource: ../dev/zenstruck_foundry.yaml }
diff --git a/zenstruck/foundry/1.10/config/packages/zenstruck_foundry.yaml b/zenstruck/foundry/1.10/config/packages/zenstruck_foundry.yaml
new file mode 100644
index 0000000..0657d2c
--- /dev/null
+++ b/zenstruck/foundry/1.10/config/packages/zenstruck_foundry.yaml
@@ -0,0 +1,7 @@
+when@dev: &dev
+    # See full configuration: https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#full-default-bundle-configuration
+    zenstruck_foundry:
+        # Whether to auto-refresh proxies by default (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#auto-refresh)
+        auto_refresh_proxies: true
+
+when@test: *dev
diff --git a/zenstruck/foundry/1.9/manifest.json b/zenstruck/foundry/1.10/manifest.json
index 9fe1ceb..050fabb 100644
--- a/zenstruck/foundry/1.9/manifest.json
+++ b/zenstruck/foundry/1.10/manifest.json
@@ -4,5 +4,9 @@
     },
     "bundles": {
         "Zenstruck\\Foundry\\ZenstruckFoundryBundle": ["dev", "test"]
-    }
+    },
+    "conflict": {
+        "symfony/framework-bundle": "<5.3"
+    },
+    "aliases": ["foundry"]
 }
1.10 vs 2.0
diff --git a/zenstruck/foundry/1.10/config/packages/zenstruck_foundry.yaml b/zenstruck/foundry/2.0/config/packages/zenstruck_foundry.yaml
index 0657d2c..e3ed04b 100644
--- a/zenstruck/foundry/1.10/config/packages/zenstruck_foundry.yaml
+++ b/zenstruck/foundry/2.0/config/packages/zenstruck_foundry.yaml
@@ -1,7 +1,5 @@
 when@dev: &dev
     # See full configuration: https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#full-default-bundle-configuration
     zenstruck_foundry:
-        # Whether to auto-refresh proxies by default (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#auto-refresh)
-        auto_refresh_proxies: true
 
 when@test: *dev

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is configuring anything mandatory? Because if the default config file is empty, shouldn't we drop it?

@kbond
Copy link
Member Author

kbond commented Oct 31, 2024

There is nothing mandatory to configure, no. I wanted to still show the dev/test YAML anchors to help the user out if they do need to configure something. What about adding a commented out config for common ones?

when@dev: &dev
    # See full configuration: https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#full-default-bundle-configuration
    zenstruck_foundry:
        ## configure Faker's locale
        # faker:
                # locale: fr_FR

        ## Always force properties
        # instantiator:
            # always_force_properties: true

        ## Define "global state" which will be available for all your tests
        # global_state:
            # - \App\Tests\Factory\SomeGlobalFactory

        ## Change the default namespace where factories will be created by maker
        # make_factory:
            # default_namespace:    Factory

when@test: *dev

@nicolas-grekas
Copy link
Member

I understand this wish. I'm wondering about our policies for recipes: we try to have bundles that come with no config at all. Of course, we have reasons to configure some things, but when we can, we prefer putting recipes on a diet.

@kbond
Copy link
Member Author

kbond commented Oct 31, 2024

I'm wondering about our policies for recipes: we try to have bundles that come with no config at all.

I 100% agree with this normally but in the case of Foundry, you almost always need your dev/test config to match. We do explain this "trick" in the docs but thinking it could be easily missed.

@symfony-recipes-bot symfony-recipes-bot merged commit dae5cee into symfony:main Nov 1, 2024
1 of 2 checks passed
@kbond kbond deleted the foundry2 branch November 1, 2024 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants