u-foo 1.0.1 → 1.0.2
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 +1 -1
- package/src/chat/index.js +10 -4
package/package.json
CHANGED
package/src/chat/index.js
CHANGED
|
@@ -13,10 +13,15 @@ function connectSocket(sockPath) {
|
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
function resolveProjectFile(projectRoot, relativePath, fallbackRelativePath) {
|
|
17
|
+
const local = path.join(projectRoot, relativePath);
|
|
18
|
+
if (fs.existsSync(local)) return local;
|
|
19
|
+
return path.join(__dirname, "..", "..", fallbackRelativePath);
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
function startDaemon(projectRoot) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const child = spawn(process.execPath, [path.join(projectRoot, "bin", "ufoo.js"), "daemon", "--start"], {
|
|
23
|
+
const daemonBin = resolveProjectFile(projectRoot, path.join("bin", "ufoo.js"), path.join("bin", "ufoo.js"));
|
|
24
|
+
const child = spawn(process.execPath, [daemonBin, "daemon", "--start"], {
|
|
20
25
|
detached: true,
|
|
21
26
|
stdio: "ignore",
|
|
22
27
|
cwd: projectRoot,
|
|
@@ -40,7 +45,8 @@ async function connectWithRetry(sockPath, retries, delayMs) {
|
|
|
40
45
|
|
|
41
46
|
async function runChat(projectRoot) {
|
|
42
47
|
if (!fs.existsSync(path.join(projectRoot, ".ufoo"))) {
|
|
43
|
-
|
|
48
|
+
const initScript = resolveProjectFile(projectRoot, path.join("scripts", "init.sh"), path.join("scripts", "init.sh"));
|
|
49
|
+
spawnSync("bash", [initScript, "--modules", "context,bus", "--project", projectRoot], {
|
|
44
50
|
stdio: "inherit",
|
|
45
51
|
});
|
|
46
52
|
}
|