refactor: drop macOS launchd and nohup service install paths
The service only runs under Linux systemd. Remove setupLaunchd, setupNohupFallback, buildLaunchdPlist, the launchd/nohup service checks in setup/verify-services.ts, ServiceDef.launchdLabel, launchd/ and the unused repo-tokens/ GitHub action. Without systemd, `setup --step service` now fails with systemd_unavailable instead of writing a nohup wrapper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,26 +7,6 @@ export function buildRuntimePathEnv(nodePath: string, homeDir: string): string {
|
||||
return `${path.dirname(nodePath)}:/usr/local/bin:/usr/bin:/bin:${homeDir}/.local/bin:${homeDir}/.npm-global/bin`;
|
||||
}
|
||||
|
||||
function buildLaunchdEnvironmentEntries(
|
||||
nodePath: string,
|
||||
homeDir: string,
|
||||
extraEnv?: Record<string, string>,
|
||||
): string[] {
|
||||
const envEntries = [
|
||||
` <key>PATH</key>`,
|
||||
` <string>${buildRuntimePathEnv(nodePath, homeDir)}</string>`,
|
||||
` <key>HOME</key>`,
|
||||
` <string>${homeDir}</string>`,
|
||||
];
|
||||
if (extraEnv) {
|
||||
for (const [k, v] of Object.entries(extraEnv)) {
|
||||
envEntries.push(` <key>${k}</key>`);
|
||||
envEntries.push(` <string>${v}</string>`);
|
||||
}
|
||||
}
|
||||
return envEntries;
|
||||
}
|
||||
|
||||
function buildSystemdEnvironmentLines(
|
||||
nodePath: string,
|
||||
homeDir: string,
|
||||
@@ -44,47 +24,6 @@ function buildSystemdEnvironmentLines(
|
||||
return envLines;
|
||||
}
|
||||
|
||||
export function buildLaunchdPlist(
|
||||
def: ServiceDef,
|
||||
projectRoot: string,
|
||||
nodePath: string,
|
||||
homeDir: string,
|
||||
): string {
|
||||
const envEntries = buildLaunchdEnvironmentEntries(
|
||||
nodePath,
|
||||
homeDir,
|
||||
def.extraEnv,
|
||||
);
|
||||
|
||||
return `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>${def.launchdLabel}</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>${nodePath}</string>
|
||||
<string>${projectRoot}/dist/index.js</string>
|
||||
</array>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>${projectRoot}</string>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
${envEntries.join('\n')}
|
||||
</dict>
|
||||
<key>StandardOutPath</key>
|
||||
<string>${projectRoot}/logs/${def.logName}.log</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>${projectRoot}/logs/${def.logName}.error.log</string>
|
||||
</dict>
|
||||
</plist>`;
|
||||
}
|
||||
|
||||
export function buildSystemdUnit(
|
||||
def: ServiceDef,
|
||||
projectRoot: string,
|
||||
|
||||
Reference in New Issue
Block a user