-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom-elements-manifest.config.ts
40 lines (36 loc) · 1.22 KB
/
custom-elements-manifest.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env ts-node
import { dirname, resolve } from 'node:path';
import { customElementExamplesPlugin } from '@webcomponents-preview/cem-plugin-examples';
import { customElementGenerateReadmesPlugin } from '@webcomponents-preview/cem-plugin-generate-readmes';
import { customElementGroupingPlugin } from '@webcomponents-preview/cem-plugin-grouping';
export default {
packagejson: true,
litelement: true,
globs: ['src/**/*.{component,plugin}.ts', 'src/**/EXAMPLES.md'],
outdir: 'dist',
plugins: [
customElementExamplesPlugin(),
customElementGenerateReadmesPlugin({
addInlineReadme: true,
transformer: 'wca',
outputPath(path) {
if (path === undefined) return '';
return resolve(dirname(path), 'README.md');
},
}),
customElementGroupingPlugin({
addGroups(componentPath) {
const path = componentPath?.split('/') || [];
const [, type, category, sub] = path;
const groups = [type, category];
if (path.length > 5) groups.push(sub);
return [
groups
.filter(Boolean)
.map(([Upper, ...lower]) => `${Upper.toLocaleUpperCase()}${lower.join('')}`)
.join('/'),
];
},
}),
],
};