kimroen / ember-cli-coffeescript

Adds precompilation of CoffeeScript files and all the basic generation types to the ember generate command.
MIT License
72 stars 49 forks source link

Addons created in coffeescript can only be consumed by applications with coffeescript #131

Closed mriska closed 7 years ago

mriska commented 7 years ago

I discovered that components created using coffeescript in an addon can not be consumed by an application that is not set up with ember-cli-coffeescript. This seems to be caused by the wrapping files under app being generated as coffee-files which the consuming application does not know how to handle. My suggestion would be to create these proxy-files as pure javascript files so that any addons created using coffeescript can be used by all applications regardless of language preferences.

What do you think @kimroen? I can create a PR for that, if you agree on the resolution.

perlun commented 7 years ago

Good suggestion. The same goes for other languages as well (I'm mostly thinking about ember-cli-typescript here, which is still at a very early stage); you should be able to consume such addons from non-TS apps as well.

mriska commented 7 years ago

@kimroen What is your opinion on this? Do you want me to create a PR?

mriska commented 7 years ago

@kimroen Have you had the possibility to think about this? I would be happy to provide a PR if you think it is acceptable.

kimroen commented 7 years ago

Sorry, I don't think I understand fully what the issue is. I looked around and found this rfc: https://github.com/ember-cli/rfcs/pull/89 - is that related to this, or something else?

Would you mind sketching out a more complete example to help me understand? If you think a PR would make it clear, then please make that and we can work it out there.

Thanks for looking into this 👍

mriska commented 7 years ago

I don't think it is directly related to the transpilation issue you mentioned. The problem here is that the *-addon blueprints contain coffeescript files. Any addon using ember-cli-coffeescript will create these files in the application but the application will not know how to compile them unless the application has ember-cli-coffeescript installed. My proposed fix is to change the *-addon blueprints to use javascript files instead of coffeescript files. Since these are simple one-line files it is a very simple job. I'll see if I can create a PR for it tomorrow.

kimroen commented 7 years ago

All right, thanks for the clarification! If you use this addon that way and feel this would resolve your issue, then please go ahead. I'm not sure if it's doable, but if you could think of a test we could write to demonstrate the issue, then that would be very useful.

mriska commented 7 years ago

I'm creating a PR with the changes right now. I can't think of a way to write a test for this unfortunately, but I do know that the proposed solution works since I have manually changed the .coffee files to .js in a few addons after discovering this issue.