You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While writing the PR description for the ember-cli feature, I started to reconsider how micro-addons should work.
How it works now
Currently, the files are copied from a flat file structure in such a way that the following happens:
components are accessible via import MyComponent from 'app-name/components/my-component';
libraries are accessible via import MyLibrary from 'app-name/lib/my-library';
helpers are accessible via import MyHelper from 'app-name/helpers/my-helper';
There are 3 addon hooks we use to make this work:
treeForApp copies and renames component.js, helper.js, library.js
treeForAddon copies style.css (for components)
treeForTemplates copies template.hbs
I think this might not be 100% according to convention and where they're accessible from fells a bit illogical.
How I think it should work
treeForAddon should copy all of them into addon/[type]/addon-name.[extension]
treeForApp should create the standard import-export modules for components and helpers, so they are also directly accessible from the app. Libraries should be importable from the addon only, so they do not require import-export modules.
treeForApp might be able to create a template, but if that is impossible, then treeForTemplates should still be used for that
I think this would follow convention more closely.
The text was updated successfully, but these errors were encountered:
While writing the PR description for the ember-cli feature, I started to reconsider how micro-addons should work.
How it works now
Currently, the files are copied from a flat file structure in such a way that the following happens:
import MyComponent from 'app-name/components/my-component';
import MyLibrary from 'app-name/lib/my-library';
import MyHelper from 'app-name/helpers/my-helper';
There are 3 addon hooks we use to make this work:
treeForApp
copies and renamescomponent.js
,helper.js
,library.js
treeForAddon
copies style.css (for components)treeForTemplates
copiestemplate.hbs
I think this might not be 100% according to convention and where they're accessible from fells a bit illogical.
How I think it should work
treeForAddon
should copy all of them intoaddon/[type]/addon-name.[extension]
treeForApp
should create the standard import-export modules for components and helpers, so they are also directly accessible from the app. Libraries should be importable from the addon only, so they do not require import-export modules.treeForApp
might be able to create a template, but if that is impossible, thentreeForTemplates
should still be used for thatI think this would follow convention more closely.
The text was updated successfully, but these errors were encountered: