carbon-components-svelte/scripts/build-docs.js
Enrico Sacchetti 3f188ce4a1
chore: remove legacy types
Update docs with sveld
2023-01-25 23:31:48 -05:00

28 lines
686 B
JavaScript

import fs from "node:fs";
import glob from "glob";
import { sveld } from "sveld";
import pkg from "../package.json" assert { type: "json" };
sveld({
glob: true,
markdown: true,
types: false,
markdownOptions: {
onAppend: (type, document, components) => {
if (type === "h1")
document.append(
"quote",
`${components.size} components exported from ${pkg.name}@${pkg.version}.`
);
},
},
json: true,
jsonOptions: {
outFile: "docs/src/COMPONENT_API.json",
},
});
glob.sync("./package/**/*.d.ts").forEach((file) => {
console.log("Copying", file, " to types/");
fs.copyFileSync(file, file.replace(/src/, "types"));
});