symfony / ux

Symfony UX initiative: a JavaScript ecosystem for Symfony
https://ux.symfony.com/
MIT License
856 stars 315 forks source link

[Turbo] symfony/ux-turbo doesn't install correctly when using --webapp #2391

Closed tacman closed 2 days ago

tacman commented 3 days ago

This fails, I reported it at https://github.com/symfony/symfony/issues/58926 but probably belongs in this repo.

symfony new TurboBug  --webapp && cd TurboBug
bin/console make:controller AppController
symfony server:start -d
symfony open:local --path=/app

image

But if I remove ux-turbo, it works:

symfony new NewApp  --webapp && cd NewApp
composer remove symfony/ux-turbo
bin/console make:controller AppController
symfony server:start -d
symfony open:local --path=/app
nicolas-grekas commented 3 days ago

Let's figure this out. Did you run assets:install et al commands? They should be in the composer.json script's entry already. Turbo is part of the core DX we want to promote out of the box so we should make it work.

tacman commented 3 days ago

No change:

symfony new NewApp  --webapp && cd NewApp
bin/console assets:install
bin/console make:controller AppController
symfony server:start -d
symfony open:local --path=/app

Unless my composer has some global to block scripts, this has always worked for me, so I think it's something in ux-turbo.

WebMamba commented 3 days ago

I had the same issue after running a symfony new --webapp. Huuuum not sure what's happen here... I am digging in to it

smnandre commented 3 days ago

So... it appears Turbo is not present in the bundle.php file after install

Had to manually add it (and then everything worked as expected)

<?php

return [
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
    Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
    Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
    Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
    Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
    Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
    Symfony\UX\StimulusBundle\StimulusBundle::class => ['all' => true],
+    Symfony\UX\Turbo\TurboBundle::class => ['all' => true],
    Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
    Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
    Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
    Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
];
smnandre commented 3 days ago

I guess the "bundle" lines are missing from the recipes ... we did not have one before so the registration was automatic, but now we have one, i think we need to add these lines in https://github.com/symfony/recipes/blob/main/symfony/ux-turbo/2.20/manifest.json

    "bundles": {
        "Symfony\\UX\\Turbo\\TurboBundle": ["all"]
    },

See https://github.com/symfony/recipes/blob/main/symfony/stimulus-bundle/2.20/manifest.json for comparaison

smnandre commented 3 days ago

Posted a PR to fix this.... would love a second eye (@nicolas-grekas ?)

smnandre commented 3 days ago

Confirmed here (if i read it correctly): we do need at least one working recipe https://github.com/symfony/flex/pull/865

smnandre commented 3 days ago

Not sure if this works (only once for me ... maybe)

... could you try @tacman with the instructions provider in the PR ?

smnandre commented 3 days ago

https://github.com/symfony/recipes/pull/1357

tacman commented 3 days ago

Yep, works as expected!

export SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1357/index.json
symfony new TurboTest  --webapp && cd TurboTest
bin/console make:controller AppController
symfony server:start -d
symfony open:local --path=/app