-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
95 lines (90 loc) · 2.25 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
import commonjs from "@rollup/plugin-commonjs";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import typescript from "@rollup/plugin-typescript";
import cleanup from "rollup-plugin-cleanup";
import copy from "rollup-plugin-copy";
const buildPath = "dist";
const commonPaths = {
"@gi-ts/adw1": "gi://Adw",
"@gi-ts/gtk4": "gi://Gtk",
"@gi-types/gvc1": "gi://Gvc",
"@gi-ts/glib2": "gi://GLib",
"@gi-ts/gio2": "gi://Gio",
};
const extensionPaths = {
...commonPaths,
"gnomejs://extension.js":
"resource:///org/gnome/shell/extensions/extension.js",
"gnomejs://main.js": "resource:///org/gnome/shell/ui/main.js",
"gnomejs://volume.js": "resource:///org/gnome/shell/ui/status/volume.js",
};
const prefsPaths = {
...commonPaths,
"gnomejs://prefs.js":
"resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js",
"gnomejs://main.js": "resource:///org/gnome/Shell/Extensions/js/ui/main.js",
"gnomejs://volume.js":
"resource:///org/gnome/Shell/Extensions/js/ui/status/volume.js",
};
export default [
{
input: "src/extension.ts",
treeshake: {
moduleSideEffects: "no-external",
},
output: {
file: `${buildPath}/extension.js`,
format: "es",
name: "init",
exports: "default",
paths: extensionPaths,
assetFileNames: "[name][extname]",
},
plugins: [
commonjs(),
nodeResolve({
preferBuiltins: false,
}),
typescript({
tsconfig: "./tsconfig.json",
}),
// styles({
// mode: ["extract", `stylesheet.css`],
// }),
copy({
targets: [
{ src: "./resources/metadata.json", dest: `${buildPath}` },
{ src: "./resources/schemas", dest: `${buildPath}` },
],
}),
cleanup({
comments: "none",
}),
],
},
{
input: "src/prefs.ts",
output: {
file: `${buildPath}/prefs.js`,
format: "es",
exports: "default",
name: "prefs",
paths: prefsPaths,
},
treeshake: {
moduleSideEffects: "no-external",
},
plugins: [
commonjs(),
nodeResolve({
preferBuiltins: false,
}),
typescript({
tsconfig: "./tsconfig.json",
}),
cleanup({
comments: "none",
}),
],
},
];