bgrun 3.12.25 → 3.12.26
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/README.md +16 -8
- package/dist/api.js +7 -3
- package/dist/deploy.js +7 -3
- package/dist/index.js +14 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -719,16 +719,24 @@ Not directly — bgrun manages processes on the local machine. For remote manage
|
|
|
719
719
|
|
|
720
720
|
---
|
|
721
721
|
|
|
722
|
-
## Custom Log Paths
|
|
723
|
-
|
|
724
|
-
By default, logs go to `~/.bgr/<name>-out.txt` and `~/.bgr/<name>-err.txt`. Override with:
|
|
722
|
+
## Custom Log Paths
|
|
723
|
+
|
|
724
|
+
By default, logs go to `~/.bgr/<name>-out.txt` and `~/.bgr/<name>-err.txt`. Override with:
|
|
725
725
|
|
|
726
726
|
```bash
|
|
727
|
-
bgrun --name api \
|
|
728
|
-
--command "bun run server.ts" \
|
|
729
|
-
--stdout /var/log/api/stdout.log \
|
|
730
|
-
--stderr /var/log/api/stderr.log
|
|
731
|
-
```
|
|
727
|
+
bgrun --name api \
|
|
728
|
+
--command "bun run server.ts" \
|
|
729
|
+
--stdout /var/log/api/stdout.log \
|
|
730
|
+
--stderr /var/log/api/stderr.log
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
Or provide a directory and let `bgrun` derive both log filenames from the process name:
|
|
734
|
+
|
|
735
|
+
```bash
|
|
736
|
+
bgrun --name api \
|
|
737
|
+
--command "bun run server.ts" \
|
|
738
|
+
--logs-dir /var/log/api
|
|
739
|
+
```
|
|
732
740
|
|
|
733
741
|
---
|
|
734
742
|
|
package/dist/api.js
CHANGED
|
@@ -1184,7 +1184,8 @@ async function loadConfigEnv(directory, configPath = ".config.toml") {
|
|
|
1184
1184
|
// src/commands/run.ts
|
|
1185
1185
|
var {$: $2 } = globalThis.Bun;
|
|
1186
1186
|
var {sleep: sleep2 } = globalThis.Bun;
|
|
1187
|
-
import {
|
|
1187
|
+
import { mkdirSync as mkdirSync3 } from "fs";
|
|
1188
|
+
import { dirname as dirname2, join as join5 } from "path";
|
|
1188
1189
|
import { createMeasure as createMeasure2 } from "measure-fn";
|
|
1189
1190
|
|
|
1190
1191
|
// src/watcher.ts
|
|
@@ -1518,6 +1519,7 @@ async function handleRun(options) {
|
|
|
1518
1519
|
configPath,
|
|
1519
1520
|
force,
|
|
1520
1521
|
fetch,
|
|
1522
|
+
logsDir,
|
|
1521
1523
|
stdout,
|
|
1522
1524
|
stderr
|
|
1523
1525
|
} = options;
|
|
@@ -1697,9 +1699,11 @@ async function handleRun(options) {
|
|
|
1697
1699
|
console.log(`Config file '${finalConfigPath}' not found, continuing without it.`);
|
|
1698
1700
|
}
|
|
1699
1701
|
}
|
|
1700
|
-
const stdoutPath = stdout || existingProcess?.stdout_path || join5(homePath2, ".bgr", `${name}-out.txt`);
|
|
1702
|
+
const stdoutPath = stdout || (logsDir ? join5(logsDir, `${name}-out.txt`) : undefined) || existingProcess?.stdout_path || join5(homePath2, ".bgr", `${name}-out.txt`);
|
|
1703
|
+
mkdirSync3(dirname2(stdoutPath), { recursive: true });
|
|
1701
1704
|
Bun.write(stdoutPath, "");
|
|
1702
|
-
const stderrPath = stderr || existingProcess?.stderr_path || join5(homePath2, ".bgr", `${name}-err.txt`);
|
|
1705
|
+
const stderrPath = stderr || (logsDir ? join5(logsDir, `${name}-err.txt`) : undefined) || existingProcess?.stderr_path || join5(homePath2, ".bgr", `${name}-err.txt`);
|
|
1706
|
+
mkdirSync3(dirname2(stderrPath), { recursive: true });
|
|
1703
1707
|
Bun.write(stderrPath, "");
|
|
1704
1708
|
const actualPid = await run.measure(`Spawn "${name}" \u2192 ${finalCommand}`, async () => {
|
|
1705
1709
|
const newProcess = Bun.spawn(getShellCommand(finalCommand), {
|
package/dist/deploy.js
CHANGED
|
@@ -1183,7 +1183,8 @@ async function loadConfigEnv(directory, configPath = ".config.toml") {
|
|
|
1183
1183
|
// src/commands/run.ts
|
|
1184
1184
|
var {$: $2 } = globalThis.Bun;
|
|
1185
1185
|
var {sleep: sleep2 } = globalThis.Bun;
|
|
1186
|
-
import {
|
|
1186
|
+
import { mkdirSync as mkdirSync3 } from "fs";
|
|
1187
|
+
import { dirname as dirname2, join as join5 } from "path";
|
|
1187
1188
|
import { createMeasure as createMeasure2 } from "measure-fn";
|
|
1188
1189
|
|
|
1189
1190
|
// src/watcher.ts
|
|
@@ -1517,6 +1518,7 @@ async function handleRun(options) {
|
|
|
1517
1518
|
configPath,
|
|
1518
1519
|
force,
|
|
1519
1520
|
fetch,
|
|
1521
|
+
logsDir,
|
|
1520
1522
|
stdout,
|
|
1521
1523
|
stderr
|
|
1522
1524
|
} = options;
|
|
@@ -1696,9 +1698,11 @@ async function handleRun(options) {
|
|
|
1696
1698
|
console.log(`Config file '${finalConfigPath}' not found, continuing without it.`);
|
|
1697
1699
|
}
|
|
1698
1700
|
}
|
|
1699
|
-
const stdoutPath = stdout || existingProcess?.stdout_path || join5(homePath2, ".bgr", `${name}-out.txt`);
|
|
1701
|
+
const stdoutPath = stdout || (logsDir ? join5(logsDir, `${name}-out.txt`) : undefined) || existingProcess?.stdout_path || join5(homePath2, ".bgr", `${name}-out.txt`);
|
|
1702
|
+
mkdirSync3(dirname2(stdoutPath), { recursive: true });
|
|
1700
1703
|
Bun.write(stdoutPath, "");
|
|
1701
|
-
const stderrPath = stderr || existingProcess?.stderr_path || join5(homePath2, ".bgr", `${name}-err.txt`);
|
|
1704
|
+
const stderrPath = stderr || (logsDir ? join5(logsDir, `${name}-err.txt`) : undefined) || existingProcess?.stderr_path || join5(homePath2, ".bgr", `${name}-err.txt`);
|
|
1705
|
+
mkdirSync3(dirname2(stderrPath), { recursive: true });
|
|
1702
1706
|
Bun.write(stderrPath, "");
|
|
1703
1707
|
const actualPid = await run.measure(`Spawn "${name}" \u2192 ${finalCommand}`, async () => {
|
|
1704
1708
|
const newProcess = Bun.spawn(getShellCommand(finalCommand), {
|
package/dist/index.js
CHANGED
|
@@ -1344,7 +1344,8 @@ async function loadConfigEnv(directory, configPath = ".config.toml") {
|
|
|
1344
1344
|
// src/commands/run.ts
|
|
1345
1345
|
var {$: $2 } = globalThis.Bun;
|
|
1346
1346
|
var {sleep: sleep2 } = globalThis.Bun;
|
|
1347
|
-
import {
|
|
1347
|
+
import { mkdirSync as mkdirSync3 } from "fs";
|
|
1348
|
+
import { dirname as dirname2, join as join5 } from "path";
|
|
1348
1349
|
import { createMeasure as createMeasure2 } from "measure-fn";
|
|
1349
1350
|
|
|
1350
1351
|
// src/watcher.ts
|
|
@@ -1678,6 +1679,7 @@ async function handleRun(options) {
|
|
|
1678
1679
|
configPath,
|
|
1679
1680
|
force,
|
|
1680
1681
|
fetch,
|
|
1682
|
+
logsDir,
|
|
1681
1683
|
stdout,
|
|
1682
1684
|
stderr
|
|
1683
1685
|
} = options;
|
|
@@ -1857,9 +1859,11 @@ async function handleRun(options) {
|
|
|
1857
1859
|
console.log(`Config file '${finalConfigPath}' not found, continuing without it.`);
|
|
1858
1860
|
}
|
|
1859
1861
|
}
|
|
1860
|
-
const stdoutPath = stdout || existingProcess?.stdout_path || join5(homePath2, ".bgr", `${name}-out.txt`);
|
|
1862
|
+
const stdoutPath = stdout || (logsDir ? join5(logsDir, `${name}-out.txt`) : undefined) || existingProcess?.stdout_path || join5(homePath2, ".bgr", `${name}-out.txt`);
|
|
1863
|
+
mkdirSync3(dirname2(stdoutPath), { recursive: true });
|
|
1861
1864
|
Bun.write(stdoutPath, "");
|
|
1862
|
-
const stderrPath = stderr || existingProcess?.stderr_path || join5(homePath2, ".bgr", `${name}-err.txt`);
|
|
1865
|
+
const stderrPath = stderr || (logsDir ? join5(logsDir, `${name}-err.txt`) : undefined) || existingProcess?.stderr_path || join5(homePath2, ".bgr", `${name}-err.txt`);
|
|
1866
|
+
mkdirSync3(dirname2(stderrPath), { recursive: true });
|
|
1863
1867
|
Bun.write(stderrPath, "");
|
|
1864
1868
|
const actualPid = await run.measure(`Spawn "${name}" \u2192 ${finalCommand}`, async () => {
|
|
1865
1869
|
const newProcess = Bun.spawn(getShellCommand(finalCommand), {
|
|
@@ -2957,6 +2961,7 @@ async function showHelp() {
|
|
|
2957
2961
|
--watch Watch for file changes and auto-restart
|
|
2958
2962
|
--hot Restart the managed process when files change
|
|
2959
2963
|
--force Force restart existing process
|
|
2964
|
+
--logs-dir <path> Directory for derived stdout/stderr logs
|
|
2960
2965
|
--fetch Fetch latest git changes before running
|
|
2961
2966
|
--json Output in JSON format
|
|
2962
2967
|
--filter <group> Filter list by BGR_GROUP
|
|
@@ -2987,6 +2992,7 @@ async function showHelp() {
|
|
|
2987
2992
|
bunx bgrun myapp --guard
|
|
2988
2993
|
bunx bgrun myapp --guard-off
|
|
2989
2994
|
bunx bgrun --name myapp --command "bun run dev" --directory . --watch
|
|
2995
|
+
bunx bgrun --name myapp --logs-dir .data --command "bun run dev" --directory .
|
|
2990
2996
|
bunx bgrun myapp --logs --lines 50
|
|
2991
2997
|
`;
|
|
2992
2998
|
console.log(usage);
|
|
@@ -3002,6 +3008,7 @@ var cliArgOptions = {
|
|
|
3002
3008
|
watch: { type: "boolean", short: "w" },
|
|
3003
3009
|
hot: { type: "boolean", short: "h" },
|
|
3004
3010
|
force: { type: "boolean", short: "f" },
|
|
3011
|
+
"logs-dir": { type: "string" },
|
|
3005
3012
|
fetch: { type: "boolean" },
|
|
3006
3013
|
delete: { type: "boolean" },
|
|
3007
3014
|
nuke: { type: "boolean" },
|
|
@@ -3078,6 +3085,7 @@ async function run2() {
|
|
|
3078
3085
|
configPath: values2["no-config"] ? "" : values2.config,
|
|
3079
3086
|
force: values2.force,
|
|
3080
3087
|
fetch: values2.fetch,
|
|
3088
|
+
logsDir: values2["logs-dir"],
|
|
3081
3089
|
remoteName: "",
|
|
3082
3090
|
dbPath: values2.db,
|
|
3083
3091
|
stdout: values2.stdout,
|
|
@@ -3124,6 +3132,7 @@ async function run2() {
|
|
|
3124
3132
|
configPath: values["no-config"] ? "" : values.config,
|
|
3125
3133
|
force: values.force,
|
|
3126
3134
|
fetch: values.fetch,
|
|
3135
|
+
logsDir: values["logs-dir"],
|
|
3127
3136
|
remoteName: "",
|
|
3128
3137
|
dbPath: values.db,
|
|
3129
3138
|
stdout: values.stdout,
|
|
@@ -3432,6 +3441,7 @@ async function run2() {
|
|
|
3432
3441
|
directory: values.directory,
|
|
3433
3442
|
configPath: values.config,
|
|
3434
3443
|
force: values.force,
|
|
3444
|
+
logsDir: values["logs-dir"],
|
|
3435
3445
|
remoteName: "",
|
|
3436
3446
|
dbPath: values.db,
|
|
3437
3447
|
stdout: values.stdout,
|
|
@@ -3462,6 +3472,7 @@ async function run2() {
|
|
|
3462
3472
|
configPath: values["no-config"] ? "" : values.config,
|
|
3463
3473
|
force: values.force,
|
|
3464
3474
|
fetch: values.fetch,
|
|
3475
|
+
logsDir: values["logs-dir"],
|
|
3465
3476
|
remoteName: "",
|
|
3466
3477
|
dbPath: values.db,
|
|
3467
3478
|
stdout: values.stdout,
|