fix: resolve promise on charging station events once
[e-mobility-charging-stations-simulator.git] / bundle.js
index ede14a96878f585ceccbed7208cd61038dbce685..4bdee327fd0015cef8c3a4bc8c0e79dad72e678f 100644 (file)
--- a/bundle.js
+++ b/bundle.js
@@ -1,6 +1,7 @@
 /* eslint-disable n/no-unpublished-import */
 import { env } from 'node:process';
 
+import chalk from 'chalk';
 import { build } from 'esbuild';
 import { clean } from 'esbuild-plugin-clean';
 import { copy } from 'esbuild-plugin-copy';
@@ -9,14 +10,38 @@ const isDevelopmentBuild = env.BUILD === 'development';
 const sourcemap = !!isDevelopmentBuild;
 
 (async () => {
+  console.info(
+    chalk.green(`Building in ${isDevelopmentBuild ? 'development' : 'production'} mode`),
+  );
+  console.time('Build time');
   await build({
     entryPoints: ['./src/start.ts', './src/charging-station/ChargingStationWorker.ts'],
     bundle: true,
     platform: 'node',
     format: 'esm',
-    external: ['@mikro-orm/*'],
+    external: [
+      '@mikro-orm/*',
+      'ajv',
+      'ajv-formats',
+      'basic-ftp',
+      'chalk',
+      'date-fns',
+      'http-status-codes',
+      'just-merge',
+      'logform',
+      'mnemonist/*',
+      'mongodb',
+      'node:*',
+      'poolifier',
+      'tar',
+      'winston',
+      'winston/*',
+      'winston-daily-rotate-file',
+      'ws',
+    ],
     minify: true,
     sourcemap,
+    entryNames: '[name]',
     outdir: './dist',
     plugins: [
       clean({
@@ -51,4 +76,5 @@ const sourcemap = !!isDevelopmentBuild;
       }),
     ],
   });
+  console.timeEnd('Build time');
 })();