-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.test.config.js
57 lines (54 loc) · 1.46 KB
/
rollup.test.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import typescript from "rollup-plugin-typescript2";
import resolve from "@rollup/plugin-node-resolve";
import postcss from "rollup-plugin-postcss";
import litcss from "rollup-plugin-postcss-lit";
import path from "path";
import replace from "@rollup/plugin-replace";
const packageJson = require("./package.json");
import * as fs from "fs";
function getFilesInDirectorySync(directoryPath) {
try {
const files = fs.readdirSync(directoryPath);
const result = files.map(file => {
const filePath = path.join(directoryPath, file);
const stats = fs.statSync(filePath);
if (stats.isFile()) {
return filePath;
}
});
// Filter out undefined values (directories)
return result.filter(filePath => filePath !== undefined);
} catch (error) {
console.error("Error reading directory:", error);
throw error;
}
}
export default [
{
input: [...getFilesInDirectorySync("./test"), ...getFilesInDirectorySync("./test/utils")],
output: [
{
dir: "test-outdir",
format: "es"
}
],
plugins: [
resolve({
browser: true
}),
replace({
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
preventAssignment: true
}),
typescript({
tsconfig: "./tsconfig.test.json"
}),
postcss({
// process .scss files
minimize: false,
inject: false
}),
litcss() // process adoptedStylesheets for lit
]
}
];