fix: fix get composite schedule rejection condition
[e-mobility-charging-stations-simulator.git] / bundle.js
CommitLineData
44ebef4c 1/* eslint-disable n/no-unpublished-import */
66a7748d 2import { env } from 'node:process'
44ebef4c 3
66a7748d
JB
4import chalk from 'chalk'
5import { build } from 'esbuild'
6import { clean } from 'esbuild-plugin-clean'
7import { copy } from 'esbuild-plugin-copy'
44ebef4c 8
66a7748d
JB
9const isDevelopmentBuild = env.BUILD === 'development'
10const sourcemap = !!isDevelopmentBuild
44ebef4c 11
66a7748d
JB
12;(async () => {
13 console.info(chalk.green(`Building in ${isDevelopmentBuild ? 'development' : 'production'} mode`))
14 console.time('Build time')
44ebef4c
JB
15 await build({
16 entryPoints: ['./src/start.ts', './src/charging-station/ChargingStationWorker.ts'],
17 bundle: true,
18 platform: 'node',
19 format: 'esm',
ae2f5292
JB
20 external: [
21 '@mikro-orm/*',
22 'ajv',
23 'ajv-formats',
24 'basic-ftp',
25 'chalk',
26 'date-fns',
27 'http-status-codes',
28 'just-merge',
29 'logform',
ab34592f 30 'mnemonist/*',
ae2f5292
JB
31 'mongodb',
32 'node:*',
33 'poolifier',
34 'tar',
35 'winston',
ab34592f 36 'winston/*',
ae2f5292 37 'winston-daily-rotate-file',
66a7748d 38 'ws'
ae2f5292 39 ],
44ebef4c
JB
40 minify: true,
41 sourcemap,
4eeee49c 42 entryNames: '[name]',
44ebef4c
JB
43 outdir: './dist',
44 plugins: [
45 clean({
46 patterns: [
47 './dist/*',
48 '!./dist/assets',
49 './dist/assets/*.json',
50 './dist/assets/json-schemas',
51 './dist/assets/station-templates',
66a7748d
JB
52 './dist/assets/ui-protocol'
53 ]
44ebef4c
JB
54 }),
55 copy({
56 assets: [
57 {
58 from: ['./src/assets/config.json'],
66a7748d 59 to: ['./assets']
44ebef4c
JB
60 },
61 {
62 from: ['./src/assets/idtags!(-template)*.json'],
66a7748d 63 to: ['./assets']
44ebef4c
JB
64 },
65 {
66 from: ['./src/assets/json-schemas/**/*.json'],
66a7748d 67 to: ['./assets/json-schemas']
44ebef4c
JB
68 },
69 {
70 from: ['./src/assets/station-templates/**/*.json'],
66a7748d
JB
71 to: ['./assets/station-templates']
72 }
73 ]
74 })
75 ]
76 })
77 console.timeEnd('Build time')
78})()