Flex: Execution of "post-create-project-cmd" is prevented by symfony/flex

Created on 1 Jul 2019  路  5Comments  路  Source: symfony/flex

If you create a project with Symfony Flex and you have other Composer Plugins in your composer.json or globally installed which are listening on "post-create-project-cmd", those events do not get executed anymore when creating a project.

This is only happening if composer has randomly installed the Flex Plugin before the other plugins as the other plugins are then installed by Flex itself.

This causes those Plugins to register there Event Listeners to the new Event Dispacher created for the composer update command executed by Flex. But with this Event Dispatcher an "post-create-project-cmd" is never emitted. This is only emitted on the "root" composer Event Dispatcher. So i guess the bug is that Flex should also emit the "post-create-project-cmd" after it emits the "post-root-package-install" manually.

Most helpful comment

Urgent PR welcome :)

All 5 comments

Do you have an example of such a plugin? That would help reproduce the issue. Thanks.

This is my example code:

This installs flex and does not execute the "post-create-project-cmd":

composer create-project deltachaos/example-529 helloworld

This does not install flex and executes the "post-create-project-cmd":

composer create-project deltachaos/example-529=dev-without-flex helloworld

We have in our organization a custom composer plugin that works around missing events triggered by flex. We need to create some files and update configurations after project creation. This is currently not possible with flex.

Beside that: Not triggering the event is simply a bug as it is a create-project call.

Same problem here. Urgent need to fix this!

Urgent PR welcome :)

I think it's from this line : https://github.com/symfony/flex/pull/520/files#diff-46b78198ae7ea525f04268205dd782c3R326 because the event fires at the beginning because it's a composer-plugin and it disable all script event after.

I'm not totally sure, it's a track i found.

Was this page helpful?
0 / 5 - 0 ratings