-
Notifications
You must be signed in to change notification settings - Fork 4
/
dev_electron.ts
156 lines (142 loc) · 3.23 KB
/
dev_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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
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(
{ watch: "./src/frontend/**/*.css" },
{
color: true,
define: {
DEVELOPMENT: "true",
},
entryPoints: ["./src/frontend/index.css"],
outfile: "./dist/frontend/index.css",
plugins: [postcssPlugin([require("tailwindcss")("./tailwind.config.js")])],
logLevel: "error",
incremental: true,
}
);
/**
* css so we dont need to wait for postcss unless we change css..
*/
single(
{ watch: "./src/preload/**/*.ts" },
{
color: true,
define: {
DEVELOPMENT: "true",
},
plugins: [makeAllPackagesExternalPlugin],
entryPoints: ["./src/preload/main.ts"],
outfile: "./dist/preload/main.js",
minify: false,
target: "node14",
bundle: true,
platform: "node",
sourcemap: true,
logLevel: "error",
incremental: true,
}
);
/**
* client bundle
*/
client(
{ watch: "./src/frontend/**/*.ts" },
{
color: true,
define: {
DEVELOPMENT: "true",
VERSION: `'${require("./package.json").version}'`,
},
entryPoints: ["./src/frontend/main.ts"],
outfile: "./dist/frontend/main.js",
minify: false,
bundle: true,
platform: "browser",
sourcemap: true,
logLevel: "error",
incremental: true,
}
);
/**
* index file for project
*/
addDefaultIndex({
distFolder: "dist/frontend",
entry: "./main.js",
publicFolders: [],
hbr: true,
webSocketPort: 8080,
userInjectOnHbr:
'window.dispatchEvent(new CustomEvent("SIMPLE_HTML_SAVE_STATE"));',
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>
</body>
</html>
`,
});
/**
* electron bundle
*/
electron(
{ watch: "./src/backend/**/*.ts", launch: true },
{
color: true,
define: {
DEVELOPMENT: "true",
},
entryPoints: ["./src/backend/main.ts"],
outfile: "./dist/backend/main.js",
minify: false,
target: "node14",
bundle: true,
plugins: [makeAllPackagesExternalPlugin],
platform: "node",
sourcemap: true,
logLevel: "error",
incremental: true,
}
);
const checker_frontend = TypeChecker({
basePath: "./src/frontend",
name: "checker_frontend",
tsConfig: "tsconfig.json",
});
checker_frontend.printSettings();
checker_frontend.inspectAndPrint();
checker_frontend.worker_watch("./");
const checker_preload = TypeChecker({
basePath: "./src/preload",
name: "checker_preload",
tsConfig: "tsconfig.json",
});
checker_preload.printSettings();
checker_preload.inspectAndPrint();
checker_preload.worker_watch("./");
const checker_backend = TypeChecker({
basePath: "./src/backend",
name: "checker_backend",
tsConfig: "tsconfig.json",
});
checker_backend.printSettings();
checker_backend.inspectAndPrint();
checker_backend.worker_watch("./");