ember-codemod-pod-to-octane icon indicating copy to clipboard operation
ember-codemod-pod-to-octane copied to clipboard

Move template.hbs alongside route.js or component.js

Open apellerano-pw opened this issue 4 months ago • 2 comments

Ember's component blueprint will nest components under the app/components/ directory. However it's also valid Ember to place components directly in a pod folder under the app/ root.

Both of these are valid components

app/
  components/
    my-pod-b/
      component.js
      template.hbs
  my-pod-a/
    component.js
    template.hbs

Problem is route templates pod similarly to my-pod-a, and if all you're looking at is template.hbs you have no way to know if it's a route or a component template. You need the broader context of there being a route.js or component.js present.

If you have components stored like my-pod-a and run this codemod, the map-route-template will move the component's template.hbs into the app/templates/ folder, and map-component-classes will never move the component.js. This breaks the component.

I don't see a way to fix this with the current architecture. I think there needs to be a more broad map-route and map-component concept which, upon spotting a route.js or component.js, also look for the sibling template.hbs and move it appropriately.

apellerano-pw avatar Oct 14 '24 14:10 apellerano-pw