-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.mjs
100 lines (97 loc) · 2.01 KB
/
rollup.config.mjs
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import dts from "rollup-plugin-dts";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import shebang from 'rollup-plugin-shebang-bin'
import glob from 'glob';
import path from "node:path";
import { fileURLToPath } from "node:url";
export default [
{
input: "dist/plugin/index.js",
output: [
{
name: "c8y",
file: "dist/plugin/index.js",
format: "commonjs",
sourcemap: true,
},
],
plugins: [
resolve({
resolveOnly: ["./src/**"],
}),
commonjs(),
json(),
],
},
{
input: "dist/plugin/index.d.ts",
output: [
{ file: "dist/plugin/index.d.ts", format: "es", sourcemap: false },
],
plugins: [dts()],
},
{
input: glob.sync('./dist/c8yctrl/*.js'),
output: [
{
name: "c8yctrl",
dir: "dist/c8yctrl",
format: "commonjs",
},
],
plugins: [
resolve({
resolveOnly: ["./src/**"],
preferBuiltins: true,
}),
commonjs(),
json(),
shebang(
{
include: [
"dist/c8yctrl/startup.js",
]
}
)
],
},
{
input: "dist/c8yctrl/index.d.ts",
output: [{ file: "dist/c8yctrl/index.d.ts", format: "es", sourcemap: false }],
plugins: [dts()],
},
{
input: Object.fromEntries(
// https://rollupjs.org/configuration-options/#input
glob.sync("dist/c8yscrn/*.js").map((file) => [
path.relative(
"dist/",
file.slice(0, file.length - path.extname(file).length)
),
fileURLToPath(new URL(file, import.meta.url)),
])
),
output: [
{
dir: "dist/",
format: "commonjs",
},
],
plugins: [
resolve({
resolveOnly: ["./src/**"],
}),
commonjs(),
json(),
shebang(
{
include: [
"dist/c8yscrn/startup.js",
]
}
)
],
}
];