forked from oae/gnome-shell-extensions-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
100 lines (94 loc) · 2.29 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
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 typescript from '@rollup/plugin-typescript';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import styles from 'rollup-plugin-styles';
import copy from 'rollup-plugin-copy';
import cleanup from 'rollup-plugin-cleanup';
const buildPath = 'dist';
const globals = {
'@imports/gio2': 'imports.gi.Gio',
'@imports/gdk4': 'imports.gi.Gdk',
'@imports/gtk4': 'imports.gi.Gtk',
'@imports/gdkpixbuf2': 'imports.gi.GdkPixbuf',
'@imports/glib2': 'imports.gi.GLib',
'@imports/st1': 'imports.gi.St',
'@imports/shell0': 'imports.gi.Shell',
'@imports/meta8': 'imports.gi.Meta',
'@imports/soup2': 'imports.gi.Soup',
'@imports/gobject2': 'imports.gi.GObject',
};
const external = Object.keys(globals);
const banner = [
'imports.gi.versions.Gtk = \'4.0\';',
].join('\n');
const prefsFooter = [
'var init = prefs.init;',
'var buildPrefsWidget = prefs.buildPrefsWidget;',
].join('\n')
export default [
{
input: 'src/extension.ts',
treeshake: {
moduleSideEffects: 'no-external'
},
output: {
file: `${buildPath}/extension.js`,
format: 'iife',
name: 'init',
exports: 'default',
globals,
assetFileNames: "[name][extname]",
},
external,
plugins: [
commonjs(),
nodeResolve({
preferBuiltins: false,
}),
typescript({
tsconfig: './tsconfig.json',
}),
styles({
mode: ["extract", `stylesheet.css`],
}),
copy({
targets: [
{ src: './resources/icons', dest: `${buildPath}` },
{ src: './resources/metadata.json', dest: `${buildPath}` },
{ src: './resources/schemas', dest: `${buildPath}` },
],
}),
cleanup({
comments: 'none'
}),
],
},
{
input: 'src/prefs/prefs.ts',
output: {
file: `${buildPath}/prefs.js`,
format: 'iife',
exports: 'default',
name: 'prefs',
banner,
footer: prefsFooter,
globals,
},
treeshake: {
moduleSideEffects: 'no-external'
},
external,
plugins: [
commonjs(),
nodeResolve({
preferBuiltins: false,
}),
typescript({
tsconfig: './tsconfig.json',
}),
cleanup({
comments: 'none'
}),
],
},
];