bm2 1.0.30 → 1.0.32

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +10 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bm2",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
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",
package/src/index.ts CHANGED
@@ -153,20 +153,22 @@ async function loadEcosystemConfig(filePath: string): Promise<EcosystemConfig> {
153
153
  let config;
154
154
 
155
155
  if (ext === ".json") {
156
- config = await Bun.file(abs).json() as EcosystemConfig;
156
+ config = (await Bun.file(abs).json()) as EcosystemConfig;
157
+ } else {
158
+ // .ts, .js, .mjs — dynamic import
159
+ const mod = await import(abs);
160
+ config = (mod.default || mod) as EcosystemConfig;
157
161
  }
158
-
159
- // .ts, .js, .mjs — dynamic import
160
- const mod = await import(abs);
161
- config = (mod.default || mod) as EcosystemConfig;
162
162
 
163
163
  const cwd = path.dirname(abs);
164
-
164
+
165
165
  config.apps = config.apps.map(i => {
166
166
  if ((i.cwd || "").trim() == "") i.cwd = cwd
167
167
  return i;
168
168
  })
169
169
 
170
+ //console.log("config===>", config.apps)
171
+
170
172
  return config
171
173
  }
172
174
 
@@ -345,8 +347,8 @@ async function cmdStart(args: string[]) {
345
347
  scriptOrConfig.includes("bm2.config") ||
346
348
  scriptOrConfig.includes("pm2.config")
347
349
  ) {
348
- const {config, cwd } = await loadEcosystemConfig(scriptOrConfig);
349
- const res = await sendToDaemon({ type: "ecosystem", data: { config, cwd } });
350
+ const config = await loadEcosystemConfig(scriptOrConfig);
351
+ const res = await sendToDaemon({ type: "ecosystem", data: config });
350
352
  if (!res.success) {
351
353
  console.error(colorize(`Error: ${res.error}`, "red"));
352
354
  process.exit(1);