Incoming requests payload validation with JSON schemas (#135)
[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 {
903becc3 12 input: ['src/start.ts', 'src/ui/httpd/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',
175d4f46 44 'express',
e7aeea18 45 'fs',
7c72977b 46 'mnemonist/lru-map-with-delete',
0bb3ee61 47 'moment',
e7aeea18
JB
48 'mongodb',
49 'path',
50 'perf_hooks',
51 'poolifier',
52 'proper-lockfile',
53 'reflect-metadata',
54 'tar',
55 'url',
56 'uuid',
e3018bc4 57 'winston',
e7aeea18 58 'winston-daily-rotate-file',
0d8140bd 59 'winston/lib/winston/transports/index.js',
e7aeea18 60 'worker_threads',
e3018bc4 61 'ws',
e7aeea18 62 ],
44b07a21 63 plugins: [
84e52c2c 64 json(),
ae8ee665
JB
65 ts({
66 tsconfig: 'tsconfig.json',
e7aeea18 67 browserslist: false,
44b07a21 68 }),
4082efc1 69 isDevelopmentBuild && istanbul(),
44b07a21 70 del({
073bd098 71 targets: ['dist/*', '!dist/assets', 'dist/assets/*.json', 'dist/assets/station-templates'],
c4a19794
JB
72 }),
73 copy({
e7aeea18 74 targets: [{ src: 'src/assets', dest: 'dist/' }],
cb1948a3 75 }),
e7aeea18
JB
76 isDevelopmentBuild && analyze(),
77 ],
44b07a21 78};