-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclusterizer.config.js
More file actions
40 lines (35 loc) · 943 Bytes
/
clusterizer.config.js
File metadata and controls
40 lines (35 loc) · 943 Bytes
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
export default async () => {
const client = await loadClient();
const NODE_ENV = process.env.NODE_ENV || "development";
return NODE_ENV === "development"
? {
env: { NODE_ENV },
watch: ["./src", client.nodeStatsPath, client.browserStatsPath],
maxInstances: 3,
minInstances: 1,
logs: true,
}
: {
env: { NODE_ENV },
maxInstances: 1,
minInstances: 0,
maxFailures: 0,
logs: false,
};
};
const loadClient = async (first = true) => {
try {
return (await import("@lessstack/web-client-template")).default;
} catch (err) {
if (first) {
process.stdout.write("Waiting for the client to be built… ");
}
const client = await new Promise((resolve) =>
setTimeout(() => resolve(loadClient(false)), 500),
);
if (first) {
process.stdout.write("\x1b[32mdone!\x1b[0m\n");
}
return client;
}
};