symfony / ux

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

Prevent updates to package.json #1912

Open trsteel88 opened 2 weeks ago

trsteel88 commented 2 weeks ago

I am including symfony/ux-turbo in my application and it keeps trying to include a file in my package.json.

I don't want to include this in my package.json as I am including turbo myself. Is there a way to prevent changes to packages.json from specific bundles?

smnandre commented 2 weeks ago

What file? The @symfony/ux-turbo/... one ?

trsteel88 commented 2 weeks ago

Yes, that's right.

smnandre commented 2 weeks ago

Those files are the ones connecting Symfony with Turbo... what would you remove them ?

trsteel88 commented 2 weeks ago

I already have turbo included in my package.json

"@hotwired/turbo": "^7.1.0",

Why would I need the ux/turbo package? The only real reason that I am using symfony/ux-turbo is for the stream format helper. e.g:

if (TurboBundle::STREAM_FORMAT !== $request->getPreferredFormat(TurboBundle::STREAM_FORMAT)) {
    ...
}
smnandre commented 2 weeks ago

The package would not install Turbo twice, so i am not sure to understand the problem here.

Why would I need the ux/turbo package?

Because you installed the symfony/ux-turbo bundle? :) The bundle goal is to connect webpack or assetmapper with symfony and ease the installation & usage of Turbo.

More information about the @symfony/ux-turbo/ package (it does not contain Turbo): https://symfony.com/doc/4.x/frontend/ux.html#how-does-symfony-ux-work

trsteel88 commented 2 weeks ago

Yes but I still don't want it to change my package.json. Is there a way to prevent that? I only want to use this bundle to detect the request type.

smnandre commented 2 weeks ago

If you disable Flex probably ?

trsteel88 commented 2 weeks ago

I can't do that. I guess I'll just have to reset package.json whenever an update occurs. It's a shame it can't be configured as I'm not using this package for loading turbo, I just want it to detect the request type

smnandre commented 2 weeks ago

Well, if having another dependency installed (even if not called) is impossible for you, yes i think this should be the only solution right now.

If you have another idea / implementation suggestion, we'd be glad to help you open a PR