1 /* eslint-disable n/no-unpublished-import */
2 import * as os from 'node:os';
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 analyze from 'rollup-plugin-analyzer';
9 import del from 'rollup-plugin-delete';
11 const availableParallelism = () => {
12 // eslint-disable-next-line no-shadow
13 let availableParallelism = 1;
15 availableParallelism = os.availableParallelism();
17 const numberOfCpus = os.cpus();
18 if (Array.isArray(numberOfCpus) && numberOfCpus.length > 0) {
19 availableParallelism = numberOfCpus.length;
22 return availableParallelism;
25 const isDevelopmentBuild = process.env.BUILD === 'development';
26 const isAnalyzeBuild = process.env.ANALYZE;
27 const sourceMap = !!isDevelopmentBuild;
30 input: ['src/start.ts', 'src/charging-station/ChargingStationWorker.ts'],
31 strictDeprecations: true,
37 plugins: [terser({ maxWorkers: Math.floor(availableParallelism() / 2) })],
42 '@mikro-orm/reflection',
51 'mnemonist/lru-map-with-delete.js',
65 'node:worker_threads',
69 'winston-daily-rotate-file',
70 'winston/lib/winston/transports/index.js',
76 tsconfig: 'tsconfig.json',
86 'dist/assets/json-schemas',
87 'dist/assets/station-templates',
88 'dist/assets/ui-protocol',
93 patterns: 'assets/**/*.json',
95 'assets/config-template.json',
96 'assets/*config[-_.]*.json',
97 'assets/idtags-template.json',
98 'assets/authorization-tags-template.json',
99 'assets/ui-protocol/**/*',
102 isAnalyzeBuild && analyze(),