-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdev-run.ts
116 lines (109 loc) · 2.84 KB
/
dev-run.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
import {
clearFolders,
addDefaultIndex,
client,
postcssPlugin,
single,
TypeChecker,
copySync
} from "esbuild-helpers";
clearFolders("dist");
copySync("node_modules/web-ifc/web-ifc.wasm", "dist");
// helpers so ifcjs does not make esbuild think its nodejs only
const SkipPathAndFs = {
name: "skip-path-and-fs",
setup(build: any) {
const filter = /^(path)|(fs)/;
build.onResolve({ filter }, (args: any) => {
return { path: args.path, external: true };
});
}
};
/**
* css so we dont need to wait for postcss unless we change css..
*/
single(
{ watch: "./src/**/*.css" },
{
color: true,
define: {
DEVELOPMENT: "true"
},
entryPoints: ["./src/index.css"],
outfile: "./dist/index.css",
plugins: [
postcssPlugin([
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("tailwindcss")({
purge: {
enabled: false,
content: ["./src/**/*.ts"]
}
})
])
],
logLevel: "error",
incremental: true
}
).then(() => {
// post css is a little slow, so wait for it the first time
/**
* client bundle
*/
client(
{ watch: "./src/**/*.ts" },
{
color: true,
define: {
DEVELOPMENT: "true",
// eslint-disable-next-line @typescript-eslint/no-var-requires
VERSION: `"${require("./package-lock.json").version}"`
},
entryPoints: ["./src/index.ts"],
outfile: "./dist/index.js",
minify: false,
bundle: true,
platform: "browser",
plugins: [SkipPathAndFs],
sourcemap: true,
logLevel: "error",
incremental: true
}
);
});
/**
* index file for project
*/
addDefaultIndex({
publicFolders: [],
distFolder: "dist",
entry: "./index.js",
hbr: true,
devServer: true,
devServerPort: 80,
userInjectOnHbr:
// I just want it to reload on saves..
"window.location.reload()",
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></app-root>
</body>
</html>
`
});
const checker_client = TypeChecker({
basePath: `./src`,
name: "client type check",
tsConfig: "tsconfig.json"
});
checker_client.printSettings();
checker_client.inspectAndPrint();
checker_client.worker_watch(["./"]);