forked from SAP/e-mobility-charging-stations-simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bundle.js
82 lines (80 loc) · 1.92 KB
/
bundle.js
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
/* eslint-disable n/no-unpublished-import */
import { env } from 'node:process'
import chalk from 'chalk'
import { build } from 'esbuild'
import { clean } from 'esbuild-plugin-clean'
import { copy } from 'esbuild-plugin-copy'
const isDevelopmentBuild = env.BUILD === 'development'
const sourcemap = !!isDevelopmentBuild
console.info(chalk.green(`Building in ${isDevelopmentBuild ? 'development' : 'production'} mode`))
console.time('Build time')
await build({
entryPoints: ['./src/start.ts', './src/charging-station/ChargingStationWorker.ts'],
bundle: true,
platform: 'node',
format: 'esm',
external: [
'@mikro-orm/*',
'ajv',
'ajv-formats',
'basic-ftp',
'chalk',
'date-fns',
'date-fns/*',
'http-status-codes',
'logform',
'mnemonist',
'mongodb',
'node:*',
'poolifier',
'rambda',
'tar',
'winston',
'winston/*',
'winston-daily-rotate-file',
'ws'
],
treeShaking: true,
minify: true,
sourcemap,
entryNames: '[name]',
outdir: './dist',
plugins: [
clean({
patterns: [
'./dist/*',
'!./dist/assets',
'./dist/assets/*.json',
'./dist/assets/json-schemas',
'./dist/assets/station-templates',
'./dist/assets/ui-protocol',
'./dist/assets/configs-docker'
]
}),
copy({
assets: [
{
from: ['./src/assets/config.json'],
to: ['./assets']
},
{
from: ['./src/assets/idtags!(-template)*.json'],
to: ['./assets']
},
{
from: ['./src/assets/json-schemas/**/*.json'],
to: ['./assets/json-schemas']
},
{
from: ['./src/assets/station-templates/**/*.json'],
to: ['./assets/station-templates']
},
{
from: ['./src/assets/configs-docker/*.json'],
to: ['./assets/configs-docker']
}
]
})
]
})
console.timeEnd('Build time')