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