docs: refine README.md
[e-mobility-charging-stations-simulator.git] / rollup.config.mjs
CommitLineData
653b69b4 1/* eslint-disable n/no-unpublished-import */
f412fe24 2import json from '@rollup/plugin-json';
8b6da988
JB
3import terser from '@rollup/plugin-terser';
4import typescript from '@rollup/plugin-typescript';
672551ed 5import { copy } from '@web/rollup-plugin-copy';
cb1948a3 6import analyze from 'rollup-plugin-analyzer';
44b07a21 7import del from 'rollup-plugin-delete';
44b07a21 8
1d064457 9const isDevelopmentBuild = process.env.BUILD === 'development';
51022aa0 10const isAnalyzeBuild = process.env.ANALYZE;
1d064457 11
44b07a21 12export default {
5a010bf0 13 input: ['src/start.ts', 'src/charging-station/ChargingStationWorker.ts'],
b768993d 14 strictDeprecations: true,
44a95b7f
JB
15 output: [
16 {
17 dir: 'dist',
2896e06d 18 format: 'esm',
44a95b7f 19 exports: 'auto',
51022aa0 20 ...(isDevelopmentBuild && { sourcemap: true }),
8b6da988 21 ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] }),
44a95b7f 22 },
44a95b7f 23 ],
e7aeea18 24 external: [
e3018bc4
JB
25 '@mikro-orm/core',
26 '@mikro-orm/reflection',
27 'ajv',
e3018bc4 28 'ajv-formats',
e7aeea18
JB
29 'basic-ftp',
30 'chalk',
852a4c5f 31 'http-status-codes',
088ee3c1
JB
32 'just-clone',
33 'just-merge',
b768993d 34 'mnemonist/lru-map-with-delete.js',
0bb3ee61 35 'moment',
e7aeea18 36 'mongodb',
01f4001e 37 'node:async_hooks',
0c7370da 38 'node:crypto',
942f9727 39 'node:events',
130783a7 40 'node:fs',
01f4001e 41 'node:http',
130783a7 42 'node:path',
01f4001e 43 'node:perf_hooks',
8a168938 44 'node:stream',
130783a7 45 'node:url',
0c7370da 46 'node:util',
01f4001e 47 'node:worker_threads',
e7aeea18 48 'poolifier',
e7aeea18 49 'tar',
e3018bc4 50 'winston',
e7aeea18 51 'winston-daily-rotate-file',
b768993d 52 'winston/lib/winston/transports/index.js',
e3018bc4 53 'ws',
e7aeea18 54 ],
44b07a21 55 plugins: [
84e52c2c 56 json(),
8b6da988 57 typescript({
0f454015 58 tsconfig: 'tsconfig.json',
44b07a21
JB
59 }),
60 del({
045639f5
JB
61 targets: [
62 'dist/*',
63 '!dist/assets',
64 'dist/assets/*.json',
045639f5 65 'dist/assets/json-schemas',
0c995ea6
JB
66 'dist/assets/station-templates',
67 'dist/assets/ui-protocol',
045639f5 68 ],
c4a19794
JB
69 }),
70 copy({
672551ed
JB
71 rootDir: 'src',
72 patterns: 'assets/**/*.json',
73 exclude: [
74 'assets/config-template.json',
75 'assets/*config[-_]*.json',
76 'assets/idtags-template.json',
77 'assets/ui-protocol/**/*',
78 ],
cb1948a3 79 }),
51022aa0 80 isAnalyzeBuild && analyze(),
e7aeea18 81 ],
44b07a21 82};