1 import * as os from
'node:os';
2 import { env
} from
'node:process';
4 import json from
'@rollup/plugin-json';
5 import terser from
'@rollup/plugin-terser';
6 import typescript from
'@rollup/plugin-typescript';
7 import { copy
} from
'@web/rollup-plugin-copy';
8 import { defineConfig
} from
'rollup';
9 import analyze from
'rollup-plugin-analyzer';
10 import del from
'rollup-plugin-delete';
12 const availableParallelism
= (): number => {
13 // eslint-disable-next-line @typescript-eslint/no-shadow
14 let availableParallelism
= 1;
16 availableParallelism
= os
.availableParallelism();
18 const cpus
= os
.cpus();
19 if (Array.isArray(cpus
) && cpus
.length
> 0) {
20 availableParallelism
= cpus
.length
;
23 return availableParallelism
;
26 const isDevelopmentBuild
= env
.BUILD
=== 'development';
27 const isAnalyzeBuild
= env
.ANALYZE
;
28 const sourcemap
= !!isDevelopmentBuild
;
30 export default defineConfig({
31 input
: ['./src/start.ts', './src/charging-station/ChargingStationWorker.ts'],
32 strictDeprecations
: true,
38 plugins
: [terser({ maxWorkers
: Math.floor(availableParallelism() / 2) })],
43 '@mikro-orm/reflection',
52 'mnemonist/lru-map-with-delete.js',
67 'node:worker_threads',
71 'winston-daily-rotate-file',
72 'winston/lib/winston/transports/index.js',
78 tsconfig
: './tsconfig.json',
87 './dist/assets/*.json',
88 './dist/assets/json-schemas',
89 './dist/assets/station-templates',
90 './dist/assets/ui-protocol',
95 patterns
: 'assets/**/*.json',
97 'assets/config-template.json',
98 'assets/*config[-_.]*.json',
99 'assets/idtags-template.json',
100 'assets/authorization-tags-template.json',
101 'assets/ui-protocol/**/*',
104 Boolean(isAnalyzeBuild
) && analyze(),