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;
29 input: ['src/start.ts', 'src/charging-station/ChargingStationWorker.ts'],
30 strictDeprecations: true,
35 sourcemap: !!isDevelopmentBuild,
36 plugins: [terser({ maxWorkers: Math.floor(availableParallelism() / 2) })],
41 '@mikro-orm/reflection',
50 'mnemonist/lru-map-with-delete.js',
63 'node:worker_threads',
67 'winston-daily-rotate-file',
68 'winston/lib/winston/transports/index.js',
74 tsconfig: 'tsconfig.json',
76 sourceMap: !!isDevelopmentBuild,
84 'dist/assets/json-schemas',
85 'dist/assets/station-templates',
86 'dist/assets/ui-protocol',
91 patterns: 'assets/**/*.json',
93 'assets/config-template.json',
94 'assets/*config[-_.]*.json',
95 'assets/idtags-template.json',
96 'assets/authorization-tags-template.json',
97 'assets/ui-protocol/**/*',
100 isAnalyzeBuild && analyze(),