mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
docs: add component API information
This commit is contained in:
parent
0472c1ad23
commit
0d0d35e715
36 changed files with 18462 additions and 5 deletions
|
@ -1,10 +1,14 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { promisify } from "util";
|
||||
import pkg from "../../package.json";
|
||||
import { format } from "prettier";
|
||||
import { parseComponent } from "./parse-component";
|
||||
import { generateTypes } from "./generate-types";
|
||||
import { generateIndex } from "./generate-index";
|
||||
import { generatePublicAPI } from "./generate-public-api";
|
||||
|
||||
const writeFile = promisify(fs.writeFile);
|
||||
|
||||
/**
|
||||
* Rollup plugin to generate library TypeScript definitions and documentation.
|
||||
|
@ -58,15 +62,21 @@ function pluginGenerateDocs() {
|
|||
}
|
||||
}
|
||||
},
|
||||
writeBundle() {
|
||||
async writeBundle() {
|
||||
const { code: types } = generateTypes(components, pkg);
|
||||
fs.writeFileSync(pkg.types, format(types, { parser: "typescript" }));
|
||||
await writeFile(pkg.types, format(types, { parser: "typescript" }));
|
||||
|
||||
const { code: index } = generateIndex(components, groups, pkg);
|
||||
fs.writeFileSync(
|
||||
await writeFile(
|
||||
"./COMPONENT_INDEX.md",
|
||||
format(index, { parser: "markdown" })
|
||||
);
|
||||
|
||||
const { code: json } = generatePublicAPI(components, groups, pkg);
|
||||
await writeFile(
|
||||
"./docs/src/PUBLIC_API.json",
|
||||
JSON.stringify(json, null, 2)
|
||||
);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue