mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
build: add script to generate component index
- move typedefs for correct type parsing
This commit is contained in:
parent
c8b0b008c7
commit
5968e22bd9
14 changed files with 5518 additions and 207 deletions
|
@ -4,6 +4,7 @@ import pkg from "../../package.json";
|
|||
import { format } from "prettier";
|
||||
import { parseComponent } from "./parse-component";
|
||||
import { generateTypes } from "./generate-types";
|
||||
import { generateIndex } from "./generate-index";
|
||||
|
||||
/**
|
||||
* Rollup plugin to generate library TypeScript definitions and documentation.
|
||||
|
@ -59,9 +60,13 @@ function pluginGenerateDocs() {
|
|||
},
|
||||
writeBundle() {
|
||||
const { code: types } = generateTypes(components, pkg);
|
||||
const definitions = format(types, { parser: "typescript" });
|
||||
fs.writeFileSync(pkg.types, format(types, { parser: "typescript" }));
|
||||
|
||||
fs.writeFileSync(pkg.types, definitions);
|
||||
const { code: index } = generateIndex(components, groups, pkg);
|
||||
fs.writeFileSync(
|
||||
"./COMPONENT_INDEX.md",
|
||||
format(index, { parser: "markdown" })
|
||||
);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue