-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
44 lines (39 loc) · 1.16 KB
/
rollup.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
import { readdirSync } from "fs";
import path from "path";
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import { nodeResolve } from "@rollup/plugin-node-resolve";
const autotaskSrcDir = path.join("src", "autotasks");
const autotaskInputDirs = readdirSync(autotaskSrcDir, {
withFileTypes: true,
}).filter((d) => d.isDirectory());
const inputEntryPoint = "index.js";
const outputEntryPoint = "index";
const autotaskInputs = autotaskInputDirs.map((d) => {
const outputPath = path.join(d.name, outputEntryPoint);
const inputPath = path.join(autotaskSrcDir, d.name, inputEntryPoint);
return {
[outputPath]: inputPath,
};
});
const autotaskOutputDir = path.join("build", "autotasks");
const configs = autotaskInputs.map((autotaskInput) => {
return {
input: autotaskInput,
output: {
dir: autotaskOutputDir,
format: "cjs",
exports: "default",
},
plugins: [commonjs(), json(), nodeResolve({ preferBuiltins: true })],
external: [
"ethers",
"defender-relay-client/lib/ethers",
"dotenv",
"axios",
"axios-retry",
"fs",
],
};
});
export default configs;