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 %>
|
* @module <%= classifiedModuleName %>
|
||||||
* <%= classifiedModuleName %> components are used to...
|
* <%= classifiedModuleName %> components are used to...
|
||||||
|
@ -11,7 +14,7 @@
|
||||||
* @param {string} [param1=defaultValue] - param1 is...
|
* @param {string} [param1=defaultValue] - param1 is...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Component from '@ember/component';
|
<%= exportDefault %>class <%= classifiedModuleName %> extends Component {
|
||||||
<%= importTemplate %>
|
}
|
||||||
export default Component.extend({<%= contents %>
|
|
||||||
});
|
<%= exportAddOn %>
|
||||||
|
|
|
@ -54,11 +54,13 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
locals: function(options) {
|
locals: function(options) {
|
||||||
let templatePath = '';
|
let exportDefault = 'export default ';
|
||||||
|
let exportAddOn = '';
|
||||||
let importTemplate = '';
|
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.project.isEmberCLIAddon() || (options.inRepoAddon && !options.inDummy) || !!options.in) {
|
||||||
if (options.pod) {
|
if (options.pod) {
|
||||||
templatePath = './template';
|
templatePath = './template';
|
||||||
|
@ -68,13 +70,19 @@ module.exports = {
|
||||||
'templates/components/' +
|
'templates/components/' +
|
||||||
stringUtil.dasherize(options.entity.name);
|
stringUtil.dasherize(options.entity.name);
|
||||||
}
|
}
|
||||||
importTemplate = "import layout from '" + templatePath + "';\n";
|
exportDefault = '';
|
||||||
contents = '\n layout';
|
exportAddOn = `export default setComponentTemplate(layout, ${stringUtil.classify(
|
||||||
|
options.entity.name
|
||||||
|
)})`;
|
||||||
|
importTemplate = "import layout from '" + templatePath + "';";
|
||||||
|
setComponentTemplate = "import { setComponentTemplate } from '@ember/component'; \n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
exportDefault: exportDefault,
|
||||||
|
exportAddOn: exportAddOn,
|
||||||
importTemplate: importTemplate,
|
importTemplate: importTemplate,
|
||||||
contents: contents,
|
setComponentTemplate: setComponentTemplate,
|
||||||
path: getPathOption(options),
|
path: getPathOption(options),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue