-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathrollup.config.js
More file actions
92 lines (87 loc) · 2.33 KB
/
rollup.config.js
File metadata and controls
92 lines (87 loc) · 2.33 KB
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
import typescript from '@rollup/plugin-typescript';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import copy from 'rollup-plugin-copy';
import replace from '@rollup/plugin-replace';
const isProduction = process.env.NODE_ENV === 'production';
const isDebugMode = process.env.STREAMDECK_DEBUG === '1' || process.env.STREAMDECK_DEBUG === 'true';
const outputDir = isProduction ? 'release/com.pedrofuentes.ical.sdPlugin' : 'dist/com.pedrofuentes.ical.sdPlugin';
// Main plugin build (Node.js runtime)
const pluginConfig = {
input: 'src/plugin.ts',
output: {
file: `${outputDir}/bin/plugin.js`,
format: 'cjs',
sourcemap: !isProduction,
exports: 'auto'
},
external: [],
plugins: [
replace({
preventAssignment: true,
values: {
'process.env.NODE_ENV': JSON.stringify(isProduction ? 'production' : 'development'),
'process.env.STREAMDECK_DEBUG': JSON.stringify(isDebugMode ? '1' : '0')
}
}),
json(),
resolve({
preferBuiltins: true,
exportConditions: ['node']
}),
commonjs(),
typescript({
tsconfig: './tsconfig.json',
declaration: false,
sourceMap: !isProduction
}),
copy({
targets: [
{ src: 'manifest.json', dest: outputDir },
{ src: 'assets', dest: outputDir },
{ src: 'bin-package.json', dest: `${outputDir}/bin`, rename: 'package.json' }
]
})
]
};
// Property Inspector build (browser environment)
const piConfig = {
input: 'pi/pi.js',
output: {
file: `${outputDir}/pi/pi.js`,
format: 'iife',
name: 'PI',
sourcemap: !isProduction,
footer: 'window.connectElgatoStreamDeckSocket = PI.connectElgatoStreamDeckSocket;'
},
plugins: [
resolve({
browser: true
}),
commonjs(),
copy({
targets: [
{ src: 'pi/pi.html', dest: outputDir },
{ src: 'pi/setup.html', dest: outputDir },
{ src: 'pi/css', dest: outputDir }
]
})
]
};
// Setup build (browser environment)
const setupConfig = {
input: 'pi/setup.js',
output: {
file: `${outputDir}/pi/setup.js`,
format: 'iife',
sourcemap: !isProduction
},
plugins: [
resolve({
browser: true
}),
commonjs()
]
};
export default [pluginConfig, piConfig, setupConfig];