engine7 7.0.7 → 7.0.9
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 +12 -5
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -583,12 +583,17 @@ engine7 service \u2014 \u5F00\u673A\u81EA\u542F\u52A8\u7BA1\u7406
|
|
|
583
583
|
const taskName = "Engine7";
|
|
584
584
|
const nodeExe = process.execPath;
|
|
585
585
|
const cliMjs = path.resolve(engine7Bin);
|
|
586
|
-
const
|
|
586
|
+
const absConfig = path.resolve(configPath2);
|
|
587
|
+
const wrapperPath = path.join(cwd, "engine7-start.cmd");
|
|
588
|
+
const wrapperContent = `@echo off\r
|
|
589
|
+
cd /d "${cwd}"\r
|
|
590
|
+
"${nodeExe}" "${cliMjs}" start --config "${absConfig}"\r
|
|
591
|
+
`;
|
|
592
|
+
fs.writeFileSync(wrapperPath, wrapperContent);
|
|
587
593
|
try {
|
|
588
|
-
execSync(`schtasks /create /tn "${taskName}" /tr ${
|
|
594
|
+
execSync(`schtasks /create /tn "${taskName}" /tr "${wrapperPath}" /sc onlogon /rl highest /f`, { stdio: "inherit", shell: true });
|
|
589
595
|
console.log(`\u2705 Windows \u8BA1\u5212\u4EFB\u52A1 "${taskName}" \u5DF2\u521B\u5EFA\uFF08\u5F00\u673A\u81EA\u542F\u52A8\uFF09`);
|
|
590
|
-
console.log(`
|
|
591
|
-
console.log(` cli: ${cliMjs}`);
|
|
596
|
+
console.log(` wrapper: ${wrapperPath}`);
|
|
592
597
|
} catch {
|
|
593
598
|
console.error("\u274C \u521B\u5EFA\u8BA1\u5212\u4EFB\u52A1\u5931\u8D25\uFF0C\u53EF\u80FD\u9700\u8981\u7BA1\u7406\u5458\u6743\u9650");
|
|
594
599
|
process.exit(1);
|
|
@@ -598,6 +603,8 @@ engine7 service \u2014 \u5F00\u673A\u81EA\u542F\u52A8\u7BA1\u7406
|
|
|
598
603
|
const plistDir = path.join(process.env.HOME, "Library", "LaunchAgents");
|
|
599
604
|
fs.mkdirSync(plistDir, { recursive: true });
|
|
600
605
|
const plistPath = path.join(plistDir, `${label}.plist`);
|
|
606
|
+
const localCli = path.join("node_modules", "engine7", "dist", "cli.mjs");
|
|
607
|
+
const cliMjs = fs.existsSync(localCli) ? path.resolve(localCli) : path.join(path.dirname(path.dirname(engine7Bin)), "lib", "node_modules", "engine7", "dist", "cli.mjs");
|
|
601
608
|
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
602
609
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
603
610
|
<plist version="1.0">
|
|
@@ -606,7 +613,7 @@ engine7 service \u2014 \u5F00\u673A\u81EA\u542F\u52A8\u7BA1\u7406
|
|
|
606
613
|
<key>ProgramArguments</key>
|
|
607
614
|
<array>
|
|
608
615
|
<string>${process.execPath}</string>
|
|
609
|
-
<string>${
|
|
616
|
+
<string>${cliMjs}</string>
|
|
610
617
|
<string>start</string>
|
|
611
618
|
<string>--config</string>
|
|
612
619
|
<string>${path.resolve(configPath2)}</string>
|