benignswarm 0.7.7 → 0.7.8
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/dist/commands/watch.js +9 -4
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/commands/watch.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
1
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
2
2
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
@@ -134,14 +134,19 @@ function installLaunchd(name, exec, interval, out) {
|
|
|
134
134
|
const logDir = join(homedir(), ".bschat", "logs");
|
|
135
135
|
mkdirSync(dir, { recursive: true });
|
|
136
136
|
mkdirSync(logDir, { recursive: true });
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
// Never bake in the path of the copy that is running: it may be an npx cache that is frozen at
|
|
138
|
+
// this version. Prefer a global install on PATH; fall back to this copy only if none exists.
|
|
139
|
+
const which = spawnSync("sh", ["-c", "command -v bschat"], { encoding: "utf8" });
|
|
140
|
+
const globalCli = which.status === 0 ? which.stdout.trim() : "";
|
|
141
|
+
const program = globalCli && !globalCli.includes("/_npx/") ? [globalCli] : [process.execPath, process.argv[1]];
|
|
142
|
+
if (program.length > 1)
|
|
143
|
+
process.stderr.write(`bschat: no global install found; the LaunchAgent will run ${process.argv[1]} and will not pick up upgrades. Install with: npm i -g benignswarm\n`);
|
|
139
144
|
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
140
145
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
141
146
|
<plist version="1.0"><dict>
|
|
142
147
|
<key>Label</key><string>${label}</string>
|
|
143
148
|
<key>ProgramArguments</key><array>
|
|
144
|
-
|
|
149
|
+
${program.map((x) => `<string>${escapeXml(x)}</string>`).join("")}<string>watch</string>
|
|
145
150
|
<string>--as</string><string>${name}</string>
|
|
146
151
|
<string>--exec</string><string>${escapeXml(exec)}</string>
|
|
147
152
|
<string>--interval</string><string>${interval}</string>
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = "0.7.
|
|
1
|
+
export const CLI_VERSION = "0.7.8";
|