-
Notifications
You must be signed in to change notification settings - Fork 4
/
build_electron.ts
138 lines (125 loc) · 2.8 KB
/
build_electron.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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import {
clearFolders,
addDefaultIndex,
electron,
client,
makeAllPackagesExternalPlugin,
postcssPlugin,
single,
TypeChecker,
} from "esbuild-helpers";
clearFolders("dist/backend", "dist/frontend", "dist/preload");
/**
* css so we dont need to wait for postcss unless we change css..
*/
single(null, {
color: true,
define: {
DEVELOPMENT: "false",
},
entryPoints: ["./src/frontend/index.css"],
outfile: "./dist/frontend/index.css",
plugins: [postcssPlugin([require("tailwindcss")("./tailwind.config.js")])],
logLevel: "error",
incremental: false,
});
/**
* css so we dont need to wait for postcss unless we change css..
*/
single(null, {
color: true,
define: {
DEVELOPMENT: "false",
},
plugins: [makeAllPackagesExternalPlugin],
entryPoints: ["./src/preload/main.ts"],
outfile: "./dist/preload/main.js",
minify: true,
target: "node14",
bundle: true,
platform: "node",
sourcemap: false,
logLevel: "error",
incremental: false,
});
/**
* client bundle
*/
client(null, {
color: true,
define: {
DEVELOPMENT: "false",
VERSION: `'${require("./package.json").version}'`,
},
entryPoints: ["./src/frontend/main.ts"],
outfile: "./dist/frontend/main.js",
minify: true,
bundle: true,
platform: "browser",
sourcemap: false,
logLevel: "error",
incremental: false,
});
/**
* index file for project
*/
addDefaultIndex({
distFolder: "dist/frontend",
entry: "./main.js",
publicFolders: [],
hbr: false,
indexTemplate: /*html*/ `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link href="./index.css" rel="stylesheet" />
$bundle
</head>
<body>
<app-root class="app-root"></app-root>
</body>
</html>
`,
});
/**
* electron bundle
*/
electron(null, {
color: true,
define: {
DEVELOPMENT: "true",
},
entryPoints: ["./src/backend/main.ts"],
outfile: "./dist/backend/main.js",
minify: true,
target: "node14",
bundle: true,
plugins: [makeAllPackagesExternalPlugin],
platform: "node",
sourcemap: false,
logLevel: "error",
incremental: false,
});
const checker_frontend = TypeChecker({
basePath: "./src/frontend",
name: "checker_frontend",
tsConfig: "tsconfig.json",
});
checker_frontend.printSettings();
checker_frontend.inspectAndPrint();
const checker_preload = TypeChecker({
basePath: "./src/preload",
name: "checker_preload",
tsConfig: "tsconfig.json",
});
checker_preload.printSettings();
checker_preload.inspectAndPrint();
const checker_backend = TypeChecker({
basePath: "./src/backend",
name: "checker_backend",
tsConfig: "tsconfig.json",
});
checker_backend.printSettings();
checker_backend.inspectAndPrint();