Repository navigation
[ComposerScriptsConfigurator] Auto-wire @auto-scripts into post-install-cmd and post-update-cmd - #1089
[ComposerScriptsConfigurator] Auto-wire @auto-scripts into post-install-cmd and post-update-cmd#1089wachterjohannes wants to merge 1 commit into
@auto-scripts into post-install-cmd and post-update-cmd#1089Conversation
|
Cross-references for the 4-PR plan in symfony/ai#1994:
|
… command (wachterjohannes) This PR was merged into the main branch. Discussion ---------- [Mate] Add `--ignore-missing-file` option to `discover` command | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Docs? | no | Issues | Fix #1994 (partial) | License | MIT Adds an `--ignore-missing-file` option to `mate discover` that exits `0` as a no-op when `mate/extensions.php` does not exist. Required so the upcoming `symfony/ai-mate` Symfony Flex recipe can invoke `mate discover` unconditionally from Composer scripts. ## Cross-repo PRs | # | Repo | PR | What | Status | |---|---|---|---|---| | 1 | symfony/ai | [#2027](#2027) | `mate discover --ignore-missing-file` | **this PR** | | 2 | symfony/ai | [#2026](#2026) | Drop `symfony/ai-mate-composer-plugin` from `symfony/ai-mate`'s require list (depends on #2027) | draft | | 3 | symfony/flex | [symfony/flex#1089](symfony/flex#1089) | Auto-wire ``@auto`-scripts` into `post-install-cmd` / `post-update-cmd` | draft | | 4 | symfony/recipes | [symfony/recipes#1535](symfony/recipes#1535) | The `symfony/ai-mate` recipe | draft | | 5 | symfony/ai | _follow-up_ | Delete the composer plugin source | not started | ## Summary - Adds `--ignore-missing-file` option to `mate discover`: exits `0` when `mate/extensions.php` does not exist. ## Usage The Flex recipe (symfony/recipes#1535) wires `vendor/bin/mate discover --composer --ignore-missing-file` into ``@auto`-scripts`, so it runs unconditionally on every `composer install` / `composer update` — including the first one, before `mate init` has been executed. Commits ------- 439cabe [Mate] Add --ignore-missing-file option to discover command
|
Why is this needed to achieve your plan? Which non-skeleton apps is this meant to cover? |
|
@nicolas-grekas see the plan in symfony/ai#1994 this covers the integration of symfony mate - which will call the command |
|
@nicolas-grekas as soon as you are OK with the plan i can fix this PR - if you have any other idea which allows to acchieve the goal - i am open to change my plan :) |
…tall-cmd and post-update-cmd
3b3c1f4 to
e2fd56b
Compare
|
Without this, the recipe's Mate is a dev tool for any PHP project, so those are exactly the projects we need to cover. We need this change in Flex, unless you see another way to get the script to run there. The change only touches the hooks when a recipe declares |
When a recipe declares
composer-scripts, Flex now also ensures@auto-scriptsis wired intoscripts.post-install-cmdandscripts.post-update-cmdin the user'scomposer.json. Restores parity with composer plugins for non-skeleton projects, where these hooks aren't pre-configured.Cross-repo PRs
mate discover --ignore-missing-filesymfony/ai-mate-composer-pluginfromsymfony/ai-mate's require list (depends on symfony/ai#2027)@auto-scriptsintopost-install-cmd/post-update-cmdsymfony/ai-materecipeSummary
ComposerScriptsConfigurator::configure()now, in addition to merging intoscripts.auto-scripts, ensures@auto-scriptsis present in bothpost-install-cmdandpost-update-cmd:["@auto-scripts"].@auto-scripts→ appended.@auto-scripts→ no-op (idempotent).unconfigure()is intentionally untouched — the wiring stays even when the package is uninstalled, because other recipes may depend on it.Usage
Recipes can now declare
composer-scriptsand rely on the script running automatically in any project — including plain PHP projects without the Symfony skeleton's pre-wired hooks.