-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrollup.config.ts
60 lines (54 loc) · 1.31 KB
/
rollup.config.ts
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
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import nodeResolve from "@rollup/plugin-node-resolve";
import terser from "@rollup/plugin-terser";
import typescript from "@rollup/plugin-typescript";
import path from "node:path";
import url from "node:url";
import { RollupOptions } from "rollup";
const isWatching = !!process.env.ROLLUP_WATCH;
const banner = `#!/usr/bin/env node
/**!
* @author Elgato
* @module elgato/streamdeck
* @license MIT
* @copyright Copyright (c) Corsair Memory Inc.
*/`
// Ignore @elgato/schema to enable auto-update.
const external = [
"@elgato/schemas",
"@elgato/schemas/streamdeck/plugins/",
"@elgato/schemas/streamdeck/plugins/json",
];
/**
* CLI bundling.
*/
const options: RollupOptions = {
input: "src/cli.ts",
output: {
banner,
file: "bin/streamdeck.mjs",
sourcemap: isWatching,
sourcemapPathTransform: (relativeSourcePath: string, sourcemapPath: string): string => {
return url.pathToFileURL(path.resolve(path.dirname(sourcemapPath), relativeSourcePath)).href;
},
},
external,
plugins: [
typescript(),
json(),
commonjs(),
nodeResolve({
browser: false,
exportConditions: ["node"],
preferBuiltins: true,
}),
!isWatching &&
terser({
format: {
comments: false,
},
}),
],
}
export default options;