update helper functions

This commit is contained in:
Cory LaViska
2021-06-28 08:53:31 -04:00
parent 42fb6c7100
commit 94a5c6244e
2 changed files with 12 additions and 14 deletions

View File

@@ -9,20 +9,19 @@ import mkdirp from 'mkdirp';
const metadata = JSON.parse(fs.readFileSync('./dist/custom-elements.json', 'utf8'));
function getAllComponents() {
function getAllComponents(metadata) {
const allComponents = [];
metadata.modules.map(module => {
module.exports.find(ex => {
module.exports.map(ex => {
if (ex.kind === 'custom-element-definition') {
const tagName = ex.name;
const className = ex.declaration.name;
const component = Object.assign(
{ className, tagName },
module?.declarations.find(dec => dec.name === 'default')
);
const component = module?.declarations.find(dec => dec.name === 'default');
allComponents.push(component);
if (component) {
allComponents.push(Object.assign(component, { className, tagName }));
}
}
});
});