mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
20 lines
465 B
JavaScript
20 lines
465 B
JavaScript
const fs = require("fs");
|
|
const path = require("path");
|
|
const glob = require("glob");
|
|
const pkg = require("../package.json");
|
|
|
|
function buildApi() {
|
|
const components = {};
|
|
|
|
glob.sync("src/**/*.svelte").forEach((file) => {
|
|
const { name } = path.parse(file);
|
|
components[name] = { path: path.join(pkg.name, file) };
|
|
});
|
|
|
|
fs.writeFileSync(
|
|
"preprocess/api.json",
|
|
JSON.stringify({ version: pkg.version, components }, null, 2)
|
|
);
|
|
}
|
|
|
|
buildApi();
|