feat(ui): export component prop types
This commit is contained in:
parent
6a0c57e93c
commit
86e5f2de02
5 changed files with 51 additions and 31 deletions
|
|
@ -131,12 +131,32 @@ describe("Storybook inventory", () => {
|
|||
|
||||
for (const componentName of componentsByDomain.get(domain) ?? []) {
|
||||
expect(domainIndexSource).toContain(
|
||||
`export { ${componentName} } from "./${componentName}";`,
|
||||
`export * from "./${componentName}";`,
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test("exports component prop interfaces through grouped package entrypoints", () => {
|
||||
for (const component of componentInventory()) {
|
||||
const source = readFileSync(component.path, "utf8");
|
||||
const propTypeName = `${component.name}Props`;
|
||||
|
||||
if (!source.match(new RegExp(`export\\\\s+(interface|type)\\\\s+${propTypeName}\\\\b`))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const domainIndexSource = readFileSync(
|
||||
join(componentsDir, component.domain, "index.ts"),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
expect(domainIndexSource).toContain(
|
||||
`export * from "./${component.name}";`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test("keeps Storybook fixtures generic and content-free", () => {
|
||||
const storyText = readdirSync(storiesDir)
|
||||
.filter((filename) => filename.endsWith(".tsx") || filename.endsWith(".ts"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue