bm2 1.0.27 → 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.27",
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,12 +62,16 @@ 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
69
74
  for (let i = 0; i < resolvedInstances; i++) {
70
-
71
- options.script = path.resolve(options.script);
72
75
 
73
76
  const id = this.nextId++;
74
77
  const baseName = options.name || options.script.split("/").pop()?.replace(/\.\w+$/, "") || `app-${id}`;
@@ -81,7 +84,7 @@ import path from "path";
81
84
  config,
82
85
  this.logManager,
83
86
  this.clusterManager,
84
- this.healthChecker,
87
+ this.healthChecker,
85
88
  this.cronManager
86
89
  );
87
90
 
@@ -117,15 +120,10 @@ import path from "path";
117
120
  instances: number,
118
121
  workerIndex: number
119
122
  ): ProcessDescription {
120
-
121
- const script = path.isAbsolute(options.script)
122
- ? options.script
123
- : path.resolve(process.cwd(), options.script);
124
-
125
123
  return {
126
124
  id,
127
125
  name,
128
- script,
126
+ script: options.script,
129
127
  args: options.args || [],
130
128
  cwd: options.cwd || process.cwd(),
131
129
  env: {