intlayer-editor 5.3.3 → 5.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,9 +15,25 @@ const distPath = join(__dirname, '../server/dist/index.mjs');
15
15
  // Get arguments passed to the command (ignoring "node" and the script name)
16
16
  const args = process.argv.slice(2);
17
17
 
18
+ let env = 'production'; // Default environment
19
+ let envFile = ''; // Default to no env file
20
+
21
+ // Check for --env or -e flag
22
+ const envIndex = args.findIndex(
23
+ (arg) => arg === '---environment' || arg === '--env' || arg === '-e'
24
+ );
25
+ if (envIndex !== -1 && args[envIndex + 1]) {
26
+ env = args[envIndex + 1]; // Get the next argument as the environment
27
+ }
28
+
29
+ // Check for --env-file or -f flag
30
+ const envFileIndex = args.findIndex(
31
+ (arg) => arg === '---env-file' || arg === '--env-file' || arg === '-f'
32
+ );
33
+
18
34
  if (args[0] === 'start') {
19
35
  // Start the server pointing to the package's 'dist' directory
20
- const command = `NODE_ENV=production node ${distPath}`;
36
+ const command = `NODE_ENV=${env} ${envFileIndex !== -1 ? `ENV_FILE=${envFile}` : ''} node ${distPath}`;
21
37
  const child = exec(command);
22
38
 
23
39
  // Pipe child's stdout and stderr to the parent process
@@ -35,6 +51,11 @@ if (args[0] === 'start') {
35
51
  });
36
52
 
37
53
  child.on('close', (code) => {
54
+ if (
55
+ code === 255 // EADDRINUSE error when the port is already in use
56
+ )
57
+ return;
58
+
38
59
  console.info(`Child process exited with code ${code}`);
39
60
  });
40
61
  } else {