bm2 1.0.26 → 1.0.28

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bm2",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "description": "A blazing-fast, full-featured process manager built entirely on Bun native APIs. The modern PM2 replacement — zero Node.js dependencies, pure Bun performance.",
5
5
  "main": "src/api.ts",
6
6
  "module": "src/api.ts",
@@ -35,9 +35,8 @@
35
35
  DEFAULT_RESTART_DELAY,
36
36
  DEFAULT_LOG_MAX_SIZE,
37
37
  DEFAULT_LOG_RETAIN,
38
- } from "./constants";
38
+ } from "./constants";
39
39
  import path from "path";
40
-
41
40
 
42
41
  export class ProcessManager {
43
42
  private processes: Map<number, ProcessContainer> = new Map();
@@ -63,6 +62,12 @@ import path from "path";
63
62
  const resolvedInstances = this.clusterManager.resolveInstances(options.instances);
64
63
  const isCluster = options.execMode === "cluster" || resolvedInstances > 1;
65
64
  const states: ProcessState[] = [];
65
+
66
+ options.script = path.resolve(options.script);
67
+
68
+ if (!(await Bun.file(options.script).exists())) {
69
+ throw new Error(`Script not found: ${options.script}`);
70
+ }
66
71
 
67
72
  if (isCluster) {
68
73
  // In cluster mode, each instance is a separate container
@@ -79,7 +84,7 @@ import path from "path";
79
84
  config,
80
85
  this.logManager,
81
86
  this.clusterManager,
82
- this.healthChecker,
87
+ this.healthChecker,
83
88
  this.cronManager
84
89
  );
85
90
 
@@ -115,15 +120,10 @@ import path from "path";
115
120
  instances: number,
116
121
  workerIndex: number
117
122
  ): ProcessDescription {
118
-
119
- const script = path.isAbsolute(options.script)
120
- ? options.script
121
- : path.resolve(process.cwd(), options.script);
122
-
123
123
  return {
124
124
  id,
125
125
  name,
126
- script,
126
+ script: options.script,
127
127
  args: options.args || [],
128
128
  cwd: options.cwd || process.cwd(),
129
129
  env: {