From 28fd09f0c9521fbc81cf9bbfd186356591436113 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Sat, 22 Jan 2022 12:48:56 -0800 Subject: [PATCH] build: separate sveld into a separate build script --- package.json | 1 + rollup.config.js | 19 ------------------- scripts/build-docs.js | 20 ++++++++++++++++++++ 3 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 scripts/build-docs.js diff --git a/package.json b/package.json index 0614e4b2..8a830d98 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "test:preprocess": "node tests/preprocess", "build:css": "node scripts/build-css", "build:api": "node scripts/build-api", + "build:docs": "node scripts/build-docs", "build:lib": "rollup -c", "prepack": "run-p build:*", "format": "prettier --write \"./**/*.{svelte,js,md}\"" diff --git a/rollup.config.js b/rollup.config.js index 419a5485..231b26ea 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -3,7 +3,6 @@ import pkg from "./package.json"; import resolve from "@rollup/plugin-node-resolve"; import commonjs from "@rollup/plugin-commonjs"; import svelte from "rollup-plugin-svelte"; -import sveld from "sveld"; export default ["es", "umd"].map((format) => { const UMD = format === "umd"; @@ -23,24 +22,6 @@ export default ["es", "umd"].map((format) => { resolve(), commonjs(), UMD && terser(), - UMD && - sveld({ - glob: true, - markdown: true, - 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", - }, - }), ], }; }); diff --git a/scripts/build-docs.js b/scripts/build-docs.js new file mode 100644 index 00000000..76bd8794 --- /dev/null +++ b/scripts/build-docs.js @@ -0,0 +1,20 @@ +const { sveld } = require("sveld"); +const pkg = require("../package.json"); + +sveld({ + glob: true, + markdown: true, + 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", + }, +});