Commit | Line | Data |
---|---|---|
653b69b4 | 1 | /* eslint-disable n/no-unpublished-import */ |
f412fe24 | 2 | import json from '@rollup/plugin-json'; |
8b6da988 JB |
3 | import terser from '@rollup/plugin-terser'; |
4 | import typescript from '@rollup/plugin-typescript'; | |
cb1948a3 | 5 | import analyze from 'rollup-plugin-analyzer'; |
c4a19794 | 6 | import copy from 'rollup-plugin-copy'; |
44b07a21 | 7 | import del from 'rollup-plugin-delete'; |
44b07a21 | 8 | |
1d064457 JB |
9 | const isDevelopmentBuild = process.env.BUILD === 'development'; |
10 | ||
44b07a21 | 11 | export default { |
5a010bf0 | 12 | input: ['src/start.ts', 'src/charging-station/ChargingStationWorker.ts'], |
b768993d | 13 | strictDeprecations: true, |
44a95b7f JB |
14 | output: [ |
15 | { | |
16 | dir: 'dist', | |
2896e06d | 17 | format: 'esm', |
44a95b7f JB |
18 | exports: 'auto', |
19 | sourcemap: true, | |
20 | preserveModules: true, | |
21 | preserveModulesRoot: 'src', | |
22 | entryFileNames: '[name].mjs', | |
8b6da988 | 23 | ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] }), |
44a95b7f | 24 | }, |
44a95b7f | 25 | ], |
e7aeea18 | 26 | external: [ |
e3018bc4 JB |
27 | '@mikro-orm/core', |
28 | '@mikro-orm/reflection', | |
29 | 'ajv', | |
e3018bc4 | 30 | 'ajv-formats', |
e7aeea18 JB |
31 | 'basic-ftp', |
32 | 'chalk', | |
852a4c5f | 33 | 'http-status-codes', |
088ee3c1 JB |
34 | 'just-clone', |
35 | 'just-merge', | |
b768993d | 36 | 'mnemonist/lru-map-with-delete.js', |
0bb3ee61 | 37 | 'moment', |
e7aeea18 | 38 | 'mongodb', |
01f4001e | 39 | 'node:async_hooks', |
0c7370da | 40 | 'node:crypto', |
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 JB |
49 | 'poolifier', |
50 | 'proper-lockfile', | |
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({ |
ae8ee665 | 60 | tsconfig: 'tsconfig.json', |
44b07a21 JB |
61 | }), |
62 | del({ | |
045639f5 JB |
63 | targets: [ |
64 | 'dist/*', | |
65 | '!dist/assets', | |
66 | 'dist/assets/*.json', | |
045639f5 | 67 | 'dist/assets/json-schemas', |
0c995ea6 JB |
68 | 'dist/assets/station-templates', |
69 | 'dist/assets/ui-protocol', | |
045639f5 | 70 | ], |
c4a19794 JB |
71 | }), |
72 | copy({ | |
e7aeea18 | 73 | targets: [{ src: 'src/assets', dest: 'dist/' }], |
cb1948a3 | 74 | }), |
e7aeea18 JB |
75 | isDevelopmentBuild && analyze(), |
76 | ], | |
44b07a21 | 77 | }; |