UI/Update blueprints to glimmer components (#13149)
* updates generator to glimmer * adds changelog * accounts for addon vs reg components * moves imports to the top of components
This commit is contained in:
parent
eda9607c8a
commit
c8bfbbdf7e
|
@ -0,0 +1,3 @@
|
|||
```release-note:improvement
|
||||
ui: Updates ember blueprints to glimmer components
|
||||
```
|
|
@ -1,3 +1,6 @@
|
|||
import Component from '@glimmer/component';
|
||||
<%= importTemplate %>
|
||||
<%= setComponentTemplate %>
|
||||
/**
|
||||
* @module <%= classifiedModuleName %>
|
||||
* <%= classifiedModuleName %> components are used to...
|
||||
|
@ -11,7 +14,7 @@
|
|||
* @param {string} [param1=defaultValue] - param1 is...
|
||||
*/
|
||||
|
||||
import Component from '@ember/component';
|
||||
<%= importTemplate %>
|
||||
export default Component.extend({<%= contents %>
|
||||
});
|
||||
<%= exportDefault %>class <%= classifiedModuleName %> extends Component {
|
||||
}
|
||||
|
||||
<%= exportAddOn %>
|
||||
|
|
|
@ -54,11 +54,13 @@ module.exports = {
|
|||
},
|
||||
|
||||
locals: function(options) {
|
||||
let templatePath = '';
|
||||
let exportDefault = 'export default ';
|
||||
let exportAddOn = '';
|
||||
let importTemplate = '';
|
||||
let contents = '';
|
||||
let setComponentTemplate = '';
|
||||
let templatePath = '';
|
||||
|
||||
// if we're in an addon, build import statement
|
||||
// if we're in an addon, build import statement and set layout
|
||||
if (options.project.isEmberCLIAddon() || (options.inRepoAddon && !options.inDummy) || !!options.in) {
|
||||
if (options.pod) {
|
||||
templatePath = './template';
|
||||
|
@ -68,13 +70,19 @@ module.exports = {
|
|||
'templates/components/' +
|
||||
stringUtil.dasherize(options.entity.name);
|
||||
}
|
||||
importTemplate = "import layout from '" + templatePath + "';\n";
|
||||
contents = '\n layout';
|
||||
exportDefault = '';
|
||||
exportAddOn = `export default setComponentTemplate(layout, ${stringUtil.classify(
|
||||
options.entity.name
|
||||
)})`;
|
||||
importTemplate = "import layout from '" + templatePath + "';";
|
||||
setComponentTemplate = "import { setComponentTemplate } from '@ember/component'; \n";
|
||||
}
|
||||
|
||||
return {
|
||||
exportDefault: exportDefault,
|
||||
exportAddOn: exportAddOn,
|
||||
importTemplate: importTemplate,
|
||||
contents: contents,
|
||||
setComponentTemplate: setComponentTemplate,
|
||||
path: getPathOption(options),
|
||||
};
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue