blob: 79cc5648e922e0de726ec4119122ab7b8ddf4eb6 (
plain) (
blame)
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
|
#!/usr/bin/env node
// @ts-check
const { build } = require('vite');
/** @type 'production' | 'development' */
const mode = process.env.MODE = process.env.MODE || 'production';
/** @type string[] */
const packagesToBuild = [
'main',
'preload',
'renderer',
];
/**
* Builds all packages from `packagesToBuild` sequentially.
*
* @returns Promise<void>
*/
async function buildAll() {
const totalTimeLabel = 'Total bundling time';
console.time(totalTimeLabel);
for (const packageToBuild of packagesToBuild) {
const consoleGroupName = `package ${packageToBuild}`;
console.group(consoleGroupName);
const timeLabel = 'Bundling time';
console.time(timeLabel);
const packageConfigPath = `packages/${packageToBuild}/vite.config.js`;
await build({
configFile: packageConfigPath,
mode,
});
console.timeEnd(timeLabel);
console.groupEnd();
}
console.timeEnd(totalTimeLabel);
}
buildAll().catch((err) => {
console.error(err);
process.exit(1);
});
|