-
Notifications
You must be signed in to change notification settings - Fork 3
/
etsc.config.cjs
47 lines (41 loc) · 1.15 KB
/
etsc.config.cjs
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
// noinspection JSUnusedGlobalSymbols
const JsExtPlugin = require('./etsc-jsext.cjs');
const fs = require('node:fs');
const dotenv = require('dotenv');
dotenv.config();
/** @type {import('esbuild-node-tsc/dist/config').Config} */
module.exports = {
esbuild: {
bundle: true,
minify: false,
format: 'esm',
treeShaking: true,
platform: 'node',
packages: 'external',
plugins: [
JsExtPlugin({ method: 'resolve' })
]
},
// Prebuild hook
prebuild: async () => {
console.time('ETSC rmdir');
fs.rmSync('./dist', {
recursive: true,
force: true,
});
console.timeEnd('ETSC rmdir');
console.time('ETSC build');
},
// Postbuild hook
postbuild: async () => {
console.timeEnd('ETSC build');
console.time('ETSC cpy');
fs.cpSync('./src/backend/views', './dist/backend/views', {
force: true,
recursive: true,
});
fs.cpSync('./src/pipeline/detect_language.py', './dist/pipeline/detect_language.py', { force: true });
fs.cpSync('./src/pipeline/search_image_hashes.py', './dist/pipeline/search_image_hashes.py', { force: true });
console.timeEnd('ETSC cpy');
},
};