forked from w3f/1k-validators-be
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathesbuild.js
More file actions
98 lines (92 loc) · 1.68 KB
/
esbuild.js
File metadata and controls
98 lines (92 loc) · 1.68 KB
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
import esbuild from "esbuild";
const isProduction = process.argv.includes("--prod");
const externalPackages = [
"@polkadot/api-augment",
"velocityjs",
"dustjs-linkedin",
"atpl",
"liquor",
"twig",
"eco",
"jazz",
"jqtpl",
"hamljs",
"hamlet",
"whiskers",
"haml-coffee",
"hogan.js",
"templayed",
"underscore",
"walrus",
"mustache",
"just",
"ect",
"mote",
"toffee",
"dot",
"bracket-template",
"ractive",
"htmling",
"babel-core",
"plates",
"vash",
"slm",
"marko",
"teacup/lib/express",
"coffee-script",
"squirrelly",
"twing",
"matris-js-sdk",
"@1kv/telemetry",
"@1kv/gateway",
"@1kv/common",
"mongoose",
"logform",
"winston",
"ws",
"form-data",
"combined-stream",
"proxy-from-env",
"follow-redirects",
"cron",
"coingecko-api-v3",
"matrix-js-sdk",
"node-mongodb-native",
"mongoose",
];
const buildOptions = {
entryPoints: ["src/index.ts"],
bundle: true,
minify: isProduction,
platform: "node",
target: "node18",
external: externalPackages,
outdir: "build",
tsconfig: "tsconfig.json",
// splitting: true,
format: "esm",
sourcemap: !isProduction,
logLevel: "info",
};
if (process.argv.includes("--watch")) {
buildOptions.watch = {
onRebuild(error, result) {
if (error) console.error("watch build failed:", error);
else
console.log(
"watch build succeeded at",
new Date().toLocaleTimeString(),
);
},
};
console.log("watch mode enabled");
}
if (isProduction) {
buildOptions.define = {
"process.env.NODE_ENV": "'production'",
};
}
esbuild.build(buildOptions).catch((error) => {
console.error(error);
process.exit(1);
});