Skip to content

Commit fbde5e7

Browse files
committed
Added recipes checker section
1 parent f049598 commit fbde5e7

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

setup/flex_private_recipes.rst

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ Log in to your Gitlab.com account, click the **New project** button, select
3636
**Create blank project**, fill in the **Project name**, select the **Private**
3737
radio button, and click the **Create project** button.
3838

39+
.. _create_private_recipes:
40+
3941
Create Your Private Recipes
4042
---------------------------
4143

@@ -187,6 +189,87 @@ Create an entry in ``"recipes"`` for each of your bundle recipes. Replace
187189
``your-gitlab-account-name``, ``your-gitlab-repository`` and ``your-gitlab-project-id``
188190
with your own details.
189191

192+
Generate Recipes from a Developer Friendly Format Using the Recipes Checker
193+
--------------
194+
195+
When installing a bundle, composer checks for flex recipes in the format
196+
stated in the above sections, this is cumbersome to write by hand.
197+
198+
You can leverage the recipe checker to create those files for you.
199+
200+
Setup
201+
~~~~~
202+
203+
.. code-block:: terminal
204+
205+
$ git clone https://github.com/symfony-tools/recipes-checker.git
206+
$ cd recipes-checker/
207+
$ composer install
208+
209+
Now that you've installed the dependencies, you can use the ``run`` binary to compile your recipes
210+
211+
Developer Friendly Recipe Structure
212+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
213+
214+
When creating a recipe this way, your directory structure will look a bit different now:
215+
216+
.. code-block:: text
217+
218+
your-recipes-repository/
219+
└─ acme/
220+
└─ private-bundle/
221+
└─ 1.0/
222+
├─ config/
223+
├─ manifest.json
224+
└─ post-install.txt
225+
226+
Be sure to change ``acme``, ``private-bundle`` and ``1.0`` to your bundle details
227+
228+
.. warning::
229+
230+
Please note that bundle version number **must** be in the **{major}.{minor}** format
231+
(eg. **don't** use ``1.0.0`` but instead ``1.0``)
232+
233+
.. note::
234+
The only thing you need in the ``1.0`` directory is a valid ``manifest.json``.
235+
Other things are optional and you can read more about it in the official
236+
`symfony recipes repository`_
237+
238+
You can then create a simplified ``manifest.json``, for example:
239+
.. code-block:: json
240+
{
241+
"bundles": {
242+
"Acme\\PrivateBundle\\AcmePrivateBundle": ["all"]
243+
},
244+
"copy-from-recipe": {
245+
"config/": "%CONFIG_DIR%/"
246+
},
247+
"aliases": ["private-bundle"]
248+
}
249+
250+
.. note::
251+
Every configurator in the ``manifest.json`` file is optional,
252+
you can find the full list `here`_
253+
254+
You are now ready to generate target recipe files by executing the following command in your recipes root directory:
255+
.. code-block:: terminal
256+
$ git ls-tree HEAD */*/* | /path/to/recipes-checker-directory/run generate:flex-endpoint acme/private-bundle source-branch target-branch ./output/
257+
258+
Where:
259+
260+
``acme/private-bundle`` is your account and recipes git repository name
261+
262+
``source-branch`` is the branch that you create your recipes on
263+
264+
``target-branch`` is the branch that composer will pull recipes from
265+
266+
``./output/`` is where recipes checker will put compiled files
267+
268+
The ``./output`` directory contains the following files:
269+
* ``acme.private-bundle.1.0.json`` - recipe ``.json`` file
270+
* ``index.json``
271+
* ``archived``
272+
190273
Store Your Recipes in the Private Repository
191274
--------------------------------------------
192275

@@ -262,6 +345,10 @@ Replace ``your-github-account-name`` and ``your-recipes-repository`` with your o
262345
The ``endpoint`` URL **must** point to ``https://api.github.com/repos`` and
263346
**not** to ``https://www.github.com``.
264347

348+
Also note that when using recipes checker
349+
your endpoint **must** point to the branch with compiled recipes with a ``ref`` query
350+
parameter or by setting it as a default branch
351+
265352
Gitlab
266353
~~~~~~
267354

@@ -287,6 +374,10 @@ Replace ``your-gitlab-project-id`` with your own details.
287374
The ``extra.symfony`` key will most probably already exist in your
288375
``composer.json``. In that case, add the ``"endpoint"`` key to the existing
289376
``extra.symfony`` entry.
377+
.. tip::
378+
Note that when using recipes checker
379+
your endpoint **must** point to the branch with compiled recipes with a ``ref`` query
380+
parameter or by setting it as a default branch
290381

291382
Install the Recipes in Your Project
292383
-----------------------------------
@@ -307,3 +398,5 @@ install the new private recipes, run the following command:
307398
308399
.. _`release of version 1.16`: https://github.com/symfony/cli
309400
.. _`Symfony recipe files`: https://github.com/symfony/recipes/tree/flex/main
401+
.. _`symfony recipes repository`: https://github.com/symfony/recipes?tab=readme-ov-file#creating-recipes
402+
.. _`here`: https://github.com/symfony/recipes?tab=readme-ov-file#configurators

0 commit comments

Comments
 (0)