emberjs / ember-optional-features

MIT License
40 stars 15 forks source link

Codemod for `template-only-glimmer-components` doesn't support Addons #237

Open elwayman02 opened 3 years ago

elwayman02 commented 3 years ago

It appears that the codemod implementation only runs against components in the app/ directory, which will not work for addons, which store their components in the addon/ directory and may not re-export them at all (since doing so is dangerous and a bad pattern). In order for addons to successfully enable this feature, the codemod needs to be able to create backing classes for addon components.

https://github.com/emberjs/ember-optional-features/blob/master/features/template-only-glimmer-components.js#L55

elwayman02 commented 3 years ago

Following up on discussion with @chancancode to capture some pieces we figured out:

Conclusion: It may be better for this codemod to live as a separate project in ember-codemods rather than as part of this project.

elwayman02 commented 3 years ago

Coming full circle on this.

@rwjblue implemented the codemod to fix this here: https://github.com/rwjblue/ember-holy-futuristic-template-namespacing-batman-codemod/pull/58

However, there is a related issue that I believe does impact this project. If you enable template-only-glimmer-components in an addon, it does not create backing classes for template-only components in tests/dummy/templates/components, which is a perfectly valid use-case for addons.

rwjblue commented 3 years ago

which is a perfectly valid use-case for addons

Ya, agreed.