mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
chore: add prettier to format definitions/svelte files
This commit is contained in:
parent
5c829b5afc
commit
25e437b746
11 changed files with 38 additions and 23 deletions
|
@ -5,6 +5,7 @@ const svelte = require("rollup-plugin-svelte");
|
|||
const resolve = require("@rollup/plugin-node-resolve").default;
|
||||
const commonjs = require("@rollup/plugin-commonjs");
|
||||
const path = require("path");
|
||||
const prettier = require("prettier");
|
||||
const { parseComponent } = require("./parse-component");
|
||||
|
||||
async function generateDocs() {
|
||||
|
@ -43,10 +44,7 @@ class CarbonSvelteBase {
|
|||
const moduleName = name.replace(/\./g, "");
|
||||
|
||||
if (ext === ".svelte" && components.has(moduleName)) {
|
||||
const group = dir
|
||||
.split("src/")
|
||||
.pop()
|
||||
.split("/")[0];
|
||||
const group = dir.split("src/").pop().split("/")[0];
|
||||
|
||||
if (groups.has(group)) {
|
||||
groups.set(group, [...groups.get(group), moduleName]);
|
||||
|
@ -126,7 +124,11 @@ class CarbonSvelteBase {
|
|||
}
|
||||
}
|
||||
|
||||
fs.writeFileSync(pkg.types, definitions);
|
||||
const formatted_definitions = prettier.format(definitions, {
|
||||
parser: "typescript",
|
||||
});
|
||||
|
||||
fs.writeFileSync(pkg.types, formatted_definitions);
|
||||
}
|
||||
|
||||
generateDocs();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue