fix: do not send UI protocol response if no handler is found
[e-mobility-charging-stations-simulator.git] / rollup.config.mjs
index be3fa4d35f843333a713ed5558c3a658425e5ee3..e78c1e9e26e145eaffa217fb2b0813520e9cf6c4 100644 (file)
@@ -1,3 +1,4 @@
+/* eslint-disable n/no-unpublished-import */
 import json from '@rollup/plugin-json';
 import terser from '@rollup/plugin-terser';
 import typescript from '@rollup/plugin-typescript';
@@ -6,28 +7,17 @@ import copy from 'rollup-plugin-copy';
 import del from 'rollup-plugin-delete';
 
 const isDevelopmentBuild = process.env.BUILD === 'development';
+const isAnalyzeBuild = process.env.ANALYZE;
 
 export default {
   input: ['src/start.ts', 'src/charging-station/ChargingStationWorker.ts'],
+  strictDeprecations: true,
   output: [
     {
       dir: 'dist',
       format: 'esm',
       exports: 'auto',
-      sourcemap: true,
-      preserveModules: true,
-      preserveModulesRoot: 'src',
-      entryFileNames: '[name].mjs',
-      ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] }),
-    },
-    {
-      dir: 'dist',
-      format: 'cjs',
-      exports: 'auto',
-      sourcemap: true,
-      preserveModules: true,
-      preserveModulesRoot: 'src',
-      entryFileNames: '[name].cjs',
+      ...(isDevelopmentBuild && { sourcemap: true }),
       ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] }),
     },
   ],
@@ -41,11 +31,12 @@ export default {
     'http-status-codes',
     'just-clone',
     'just-merge',
-    'mnemonist/lru-map-with-delete',
+    'mnemonist/lru-map-with-delete.js',
     'moment',
     'mongodb',
     'node:async_hooks',
     'node:crypto',
+    'node:events',
     'node:fs',
     'node:http',
     'node:path',
@@ -55,11 +46,10 @@ export default {
     'node:util',
     'node:worker_threads',
     'poolifier',
-    'proper-lockfile',
     'tar',
     'winston',
     'winston-daily-rotate-file',
-    'winston/lib/winston/transports',
+    'winston/lib/winston/transports/index.js',
     'ws',
   ],
   plugins: [
@@ -72,13 +62,14 @@ export default {
         'dist/*',
         '!dist/assets',
         'dist/assets/*.json',
-        'dist/assets/station-templates',
         'dist/assets/json-schemas',
+        'dist/assets/station-templates',
+        'dist/assets/ui-protocol',
       ],
     }),
     copy({
       targets: [{ src: 'src/assets', dest: 'dist/' }],
     }),
-    isDevelopmentBuild && analyze(),
+    isAnalyzeBuild && analyze(),
   ],
 };