rt-graphic-component/rollup.config.cjs

37 lines
880 B
JavaScript
Raw Normal View History

2023-12-19 14:20:48 +08:00
const { resolve } = require("path");
const { readdirSync } = require("fs");
const typescript = require("@rollup/plugin-typescript");
/**
* @type {import('rollup').RollupOptions}
*/
const config = {
external: ["jl-graphic"],
input: getEntryPoints(),
output: {
2023-12-19 16:30:41 +08:00
dir: "components",
2023-12-19 14:20:48 +08:00
format: "esm",
preserveModules: true,
},
plugins: [
typescript({
tsconfig: "./tsconfig.json",
compilerOptions: {
declaration: true,
2023-12-19 16:30:41 +08:00
declarationDir: "components",
2023-12-19 14:20:48 +08:00
},
}),
],
};
module.exports = config;
function getEntryPoints() {
2023-12-19 16:30:41 +08:00
const packageDir = resolve(__dirname, "src/packages");
2023-12-19 14:20:48 +08:00
const entryPoints = readdirSync(packageDir, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => resolve(packageDir, dirent.name, `${dirent.name}.ts`));
console.log(entryPoints);
return entryPoints;
}