test(simulator): use standard file namespace for tests
[e-mobility-charging-stations-simulator.git] / rollup.config.mjs
index 8ca037fb9f24753c042ee475b786197d2c36d51e..be507238e8268c58c3e898f47c69a49e033d8b3b 100644 (file)
@@ -1,9 +1,11 @@
 /* eslint-disable n/no-unpublished-import */
+import { cpus } from 'node:os';
+
 import json from '@rollup/plugin-json';
 import terser from '@rollup/plugin-terser';
 import typescript from '@rollup/plugin-typescript';
+import { copy } from '@web/rollup-plugin-copy';
 import analyze from 'rollup-plugin-analyzer';
-import copy from 'rollup-plugin-copy';
 import del from 'rollup-plugin-delete';
 
 const isDevelopmentBuild = process.env.BUILD === 'development';
@@ -16,9 +18,8 @@ export default {
     {
       dir: 'dist',
       format: 'esm',
-      exports: 'auto',
-      ...(isDevelopmentBuild && { sourcemap: true }),
-      ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] }),
+      sourcemap: !!isDevelopmentBuild,
+      plugins: [terser({ maxWorkers: cpus().length / 2 })],
     },
   ],
   external: [
@@ -36,6 +37,7 @@ export default {
     'mongodb',
     'node:async_hooks',
     'node:crypto',
+    'node:events',
     'node:fs',
     'node:http',
     'node:path',
@@ -55,6 +57,9 @@ export default {
     json(),
     typescript({
       tsconfig: 'tsconfig.json',
+      compilerOptions: {
+        sourceMap: !!isDevelopmentBuild,
+      },
     }),
     del({
       targets: [
@@ -67,7 +72,15 @@ export default {
       ],
     }),
     copy({
-      targets: [{ src: 'src/assets', dest: 'dist/' }],
+      rootDir: 'src',
+      patterns: 'assets/**/*.json',
+      exclude: [
+        'assets/config-template.json',
+        'assets/*config[-_.]*.json',
+        'assets/idtags-template.json',
+        'assets/authorization-tags-template.json',
+        'assets/ui-protocol/**/*',
+      ],
     }),
     isAnalyzeBuild && analyze(),
   ],