Web UI: Refine documentation and code cleanup
[e-mobility-charging-stations-simulator.git] / rollup.config.mjs
CommitLineData
f412fe24 1import json from '@rollup/plugin-json';
cb1948a3 2import analyze from 'rollup-plugin-analyzer';
c4a19794 3import copy from 'rollup-plugin-copy';
44b07a21 4import del from 'rollup-plugin-delete';
4082efc1 5import istanbul from 'rollup-plugin-istanbul';
fc201913 6import { terser } from 'rollup-plugin-terser';
ae8ee665 7import ts from 'rollup-plugin-ts';
44b07a21 8
1d064457
JB
9const isDevelopmentBuild = process.env.BUILD === 'development';
10
44b07a21 11export default {
5a010bf0 12 input: ['src/start.ts', 'src/charging-station/ChargingStationWorker.ts'],
44a95b7f
JB
13 output: [
14 {
15 dir: 'dist',
16 format: 'es',
17 exports: 'auto',
18 sourcemap: true,
19 preserveModules: true,
20 preserveModulesRoot: 'src',
21 entryFileNames: '[name].mjs',
22 ...(!isDevelopmentBuild && { plugins: [terser({ numWorkers: 2 })] }),
23 },
24 {
25 dir: 'dist',
26 format: 'cjs',
27 exports: 'auto',
28 sourcemap: true,
29 preserveModules: true,
30 preserveModulesRoot: 'src',
31 entryFileNames: '[name].cjs',
32 ...(!isDevelopmentBuild && { plugins: [terser({ numWorkers: 2 })] }),
33 },
34 ],
e7aeea18 35 external: [
e3018bc4
JB
36 '@mikro-orm/core',
37 '@mikro-orm/reflection',
38 'ajv',
39 'ajv-draft-04',
40 'ajv-formats',
e7aeea18
JB
41 'basic-ftp',
42 'chalk',
43 'crypto',
44 'fs',
7c72977b 45 'mnemonist/lru-map-with-delete',
0bb3ee61 46 'moment',
e7aeea18
JB
47 'mongodb',
48 'path',
49 'perf_hooks',
50 'poolifier',
51 'proper-lockfile',
52 'reflect-metadata',
53 'tar',
54 'url',
55 'uuid',
e3018bc4 56 'winston',
e7aeea18 57 'winston-daily-rotate-file',
0d8140bd 58 'winston/lib/winston/transports/index.js',
e7aeea18 59 'worker_threads',
e3018bc4 60 'ws',
e7aeea18 61 ],
44b07a21 62 plugins: [
84e52c2c 63 json(),
ae8ee665
JB
64 ts({
65 tsconfig: 'tsconfig.json',
e7aeea18 66 browserslist: false,
44b07a21 67 }),
4082efc1 68 isDevelopmentBuild && istanbul(),
44b07a21 69 del({
045639f5
JB
70 targets: [
71 'dist/*',
72 '!dist/assets',
73 'dist/assets/*.json',
74 'dist/assets/station-templates',
75 'dist/assets/json-schemas',
76 ],
c4a19794
JB
77 }),
78 copy({
e7aeea18 79 targets: [{ src: 'src/assets', dest: 'dist/' }],
cb1948a3 80 }),
e7aeea18
JB
81 isDevelopmentBuild && analyze(),
82 ],
44b07a21 83};