Addon that can inspect and import app code


#1

I’m looking at building something that can help to detect code no longer in use in an app. I wrote up some of my ideas at https://github.com/ember-cli/ember-cli/issues/5364. The suggestion there is to open an RFC, before I go down that path I was trying ot prototype it as an addon. I wanted to try to import the router and then go checking that controllers, views etc fall within the current routes.

I was hopeful that the addon hooks would give me a convenient point to try this, but haven’t found a good solution yet. If I try to do it as part of a custom command, and go and source the router file directly, its going to be ES6 and not importable. If I try to do it during the build command, none of the hooks seem to have the level of detail I’m looking for, or even an intermediate transpiled file path I can use.

My next idea is to try https://github.com/ModuleLoader/es6-module-loader to help just loading router files, and I’ll see how far I can get with that.

Any ideas would be appreciated here. I get the feeling there’s something in the broccoli process that might be useful for me, but haven’t found it so far.