sensiolabs / AssetMapperTypeScriptBundle

MIT License
24 stars 7 forks source link

[Documentation] Integration with Stimulus missing #37

Open Nek- opened 2 months ago

Nek- commented 2 months ago

Hello,

I'm a big fan of TypeScript, so when I saw I could use this bundle, I tried it! (thanks for the good job so far)

I had no specific issue. But I feel like far too much is missing in the documentation and I found nothing anywhere to fix my issues. So I stopped using it instantly... But I decided to make an issue to help anyone that can to improve things!

  1. There's no guide to switch from the default configuration of Symfony to a TypeScript approach. Therefore translating the existing code may be complicated
  2. There's no guide on how to include new Types, and since Stimulus and Stimulus-Bundle types are not included, it does not work by default - with no info about it (I may have done something wrong, but I have no idea, I rely on PHPStorm red flags everywhere!)
  3. An example of controller using TypeScript would be nice as well, and at least a link to this documentation: https://stimulus.hotwired.dev/reference/using-typescript
  4. The suggested configuration (subfolder named typescript) does not work well with the default Symfony configuration, specifying that no configuration is required by default and it will look for the assets folder would be nice I think.

With the hope I help!

maelanleborgne commented 2 months ago

Hi and thanks for opening this issue.
I don't understand some of your points though, and I have the feeling that there might be a misunderstanding on what this bundle does : It is not a way to integrate with stimulus or live components. All it does is help you build your TypeScript files and expose the generated files through AssetMapper. Right now I don't intend to change the scope of the bundle, but I get that some people might want to use TypeScript with Stimulus. If you feel like documenting your process of converting your Stimulus controllers to TypeScript, I'd be glad to add this as a new section in the documentation. I'm sure there is plenty of things that would be valuable to include in the documentation, and PR are very much appreciated :)

tacman commented 2 months ago

Indeed, this would be welcomed, in fact that's the exact reason I'm looking at this bundle.

On a related note, I only run asset-map:compile on deployment, on the production server. Reading the documentation, I'm not sure if I need to install this bundle in production (so the typescript files compile) or if I can run it in dev and check in the compiled js, and then continue to run the :compile command on production, without needing typescript.