test(simulator): use standard file namespace for tests
[e-mobility-charging-stations-simulator.git] / rollup.config.mjs
index e78c1e9e26e145eaffa217fb2b0813520e9cf6c4..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: [
@@ -56,6 +57,9 @@ export default {
     json(),
     typescript({
       tsconfig: 'tsconfig.json',
+      compilerOptions: {
+        sourceMap: !!isDevelopmentBuild,
+      },
     }),
     del({
       targets: [
@@ -68,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(),
   ],