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', | |
b768993d | 35 | 'mnemonist/lru-map-with-delete.js', |
0bb3ee61 | 36 | 'moment', |
e7aeea18 | 37 | 'mongodb', |
01f4001e | 38 | 'node:async_hooks', |
0c7370da | 39 | 'node:crypto', |
942f9727 | 40 | 'node:events', |
130783a7 | 41 | 'node:fs', |
01f4001e | 42 | 'node:http', |
130783a7 | 43 | 'node:path', |
01f4001e | 44 | 'node:perf_hooks', |
8a168938 | 45 | 'node:stream', |
130783a7 | 46 | 'node:url', |
0c7370da | 47 | 'node:util', |
01f4001e | 48 | 'node:worker_threads', |
e7aeea18 | 49 | 'poolifier', |
e7aeea18 | 50 | 'tar', |
e3018bc4 | 51 | 'winston', |
e7aeea18 | 52 | 'winston-daily-rotate-file', |
b768993d | 53 | 'winston/lib/winston/transports/index.js', |
e3018bc4 | 54 | 'ws', |
e7aeea18 | 55 | ], |
44b07a21 | 56 | plugins: [ |
84e52c2c | 57 | json(), |
8b6da988 | 58 | typescript({ |
0f454015 | 59 | tsconfig: 'tsconfig.json', |
c98873ea JB |
60 | compilerOptions: { |
61 | sourceMap: !!isDevelopmentBuild, | |
62 | }, | |
44b07a21 JB |
63 | }), |
64 | del({ | |
045639f5 JB |
65 | targets: [ |
66 | 'dist/*', | |
67 | '!dist/assets', | |
68 | 'dist/assets/*.json', | |
045639f5 | 69 | 'dist/assets/json-schemas', |
0c995ea6 JB |
70 | 'dist/assets/station-templates', |
71 | 'dist/assets/ui-protocol', | |
045639f5 | 72 | ], |
c4a19794 JB |
73 | }), |
74 | copy({ | |
672551ed JB |
75 | rootDir: 'src', |
76 | patterns: 'assets/**/*.json', | |
77 | exclude: [ | |
78 | 'assets/config-template.json', | |
70b77dcd | 79 | 'assets/*config[-_.]*.json', |
672551ed | 80 | 'assets/idtags-template.json', |
5d1a7b7d | 81 | 'assets/authorization-tags-template.json', |
672551ed JB |
82 | 'assets/ui-protocol/**/*', |
83 | ], | |
cb1948a3 | 84 | }), |
51022aa0 | 85 | isAnalyzeBuild && analyze(), |
e7aeea18 | 86 | ], |
44b07a21 | 87 | }; |