engine7 7.0.8 → 7.1.0
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/cli.mjs +16 -6
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -496,11 +496,19 @@ engine7 start \u2014 \u542F\u52A8 Engine
|
|
|
496
496
|
if (fs.existsSync(localPath)) {
|
|
497
497
|
enginePath = localPath;
|
|
498
498
|
} else {
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
499
|
+
const cliPath = path.resolve(process.argv[1]);
|
|
500
|
+
const distDir = path.dirname(cliPath);
|
|
501
|
+
const candidate = path.join(distDir, "main.mjs");
|
|
502
|
+
if (fs.existsSync(candidate)) {
|
|
503
|
+
enginePath = candidate;
|
|
504
|
+
} else {
|
|
505
|
+
try {
|
|
506
|
+
const globalRoot = execSync("npm root -g", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
507
|
+
enginePath = path.join(globalRoot, "engine7", "dist", "main.mjs");
|
|
508
|
+
} catch {
|
|
509
|
+
console.error("\u274C \u627E\u4E0D\u5230 engine7 main.mjs");
|
|
510
|
+
process.exit(1);
|
|
511
|
+
}
|
|
504
512
|
}
|
|
505
513
|
}
|
|
506
514
|
console.log(`\u{1F680} engine7 start`);
|
|
@@ -603,6 +611,8 @@ cd /d "${cwd}"\r
|
|
|
603
611
|
const plistDir = path.join(process.env.HOME, "Library", "LaunchAgents");
|
|
604
612
|
fs.mkdirSync(plistDir, { recursive: true });
|
|
605
613
|
const plistPath = path.join(plistDir, `${label}.plist`);
|
|
614
|
+
const localCli = path.join("node_modules", "engine7", "dist", "cli.mjs");
|
|
615
|
+
const cliMjs = fs.existsSync(localCli) ? path.resolve(localCli) : path.join(path.dirname(path.dirname(engine7Bin)), "lib", "node_modules", "engine7", "dist", "cli.mjs");
|
|
606
616
|
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
607
617
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
608
618
|
<plist version="1.0">
|
|
@@ -611,7 +621,7 @@ cd /d "${cwd}"\r
|
|
|
611
621
|
<key>ProgramArguments</key>
|
|
612
622
|
<array>
|
|
613
623
|
<string>${process.execPath}</string>
|
|
614
|
-
<string>${
|
|
624
|
+
<string>${cliMjs}</string>
|
|
615
625
|
<string>start</string>
|
|
616
626
|
<string>--config</string>
|
|
617
627
|
<string>${path.resolve(configPath2)}</string>
|