Skip to content

Commit 04530c8

Browse files
chore: reuse parser across files
1 parent 26f26d9 commit 04530c8

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

packages/eui-docgen/src/main.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,26 @@ const main = async () => {
3232

3333
console.log('Generating docgen data for @elastic/eui');
3434

35-
let i = 0;
36-
for (const file of files) {
37-
const fileRelativePath = path.relative(euiSrcPath, file);
38-
39-
const componentExtends: Record<string, string[]> = {};
40-
const parser = docgen.withCustomConfig(path.join(euiPackagePath, 'tsconfig.json'), {
41-
propFilter: (prop, component) => filterProp(prop, component, componentExtends),
35+
const componentExtends: Record<string, string[]> = {};
36+
const parser = docgen.withCustomConfig(
37+
path.join(euiPackagePath, 'tsconfig.json'),
38+
{
39+
propFilter: (prop, component) =>
40+
filterProp(prop, component, componentExtends),
4241
shouldExtractLiteralValuesFromEnum: true,
4342
shouldRemoveUndefinedFromOptional: true,
4443
savePropValueAsString: true,
4544
shouldIncludePropTagMap: false,
46-
});
45+
}
46+
);
47+
48+
let i = 0;
49+
for (const file of files) {
50+
const fileRelativePath = path.relative(euiSrcPath, file);
51+
52+
for (const key of Object.keys(componentExtends)) {
53+
delete componentExtends[key];
54+
}
4755

4856
const parsed = parser.parseWithProgramProvider(file, programProvider);
4957
const results: Record<string, ProcessedComponent> = {};

0 commit comments

Comments
 (0)