appostle-installer 0.0.47 → 0.0.48

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.
@@ -9925,6 +9925,9 @@ init_config();
9925
9925
  // src/daemon-setup.ts
9926
9926
  init_execa();
9927
9927
  init_config();
9928
+ import { existsSync } from "node:fs";
9929
+ import { dirname, resolve as resolvePath } from "node:path";
9930
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
9928
9931
 
9929
9932
  // src/util.ts
9930
9933
  init_execa();
@@ -9980,6 +9983,15 @@ async function npmInstallGlobal(packages) {
9980
9983
  }
9981
9984
 
9982
9985
  // src/daemon-setup.ts
9986
+ function resolvePackagedAppostleBin() {
9987
+ try {
9988
+ const here = dirname(fileURLToPath3(import.meta.url));
9989
+ const candidate = resolvePath(here, "..", "bin", "appostle.mjs");
9990
+ if (existsSync(candidate)) return candidate;
9991
+ } catch {
9992
+ }
9993
+ return null;
9994
+ }
9983
9995
  async function installAppostleGlobal() {
9984
9996
  await npmInstallGlobal([`${INSTALLER_PACKAGE}@latest`]);
9985
9997
  }
@@ -10087,7 +10099,7 @@ async function installLaunchd() {
10087
10099
  const osHome = (await import("node:os")).homedir();
10088
10100
  const plistPath = path6.join(osHome, "Library", "LaunchAgents", "agency.ohlord.appostle.plist");
10089
10101
  const logPath = path6.join(osHome, "Library", "Logs", "appostle.log");
10090
- const appostleBin = await resolveBinary("appostle") ?? "/usr/local/bin/appostle";
10102
+ const appostleBin = resolvePackagedAppostleBin() ?? await resolveBinary("appostle") ?? "/usr/local/bin/appostle";
10091
10103
  const plist = `<?xml version="1.0" encoding="UTF-8"?>
10092
10104
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
10093
10105
  <plist version="1.0">
@@ -10192,7 +10204,7 @@ async function installSystemdSystem() {
10192
10204
  const osHome = (await import("node:os")).homedir();
10193
10205
  const user = os2.userInfo().username;
10194
10206
  const unitPath = "/etc/systemd/system/appostle.service";
10195
- const appostleBin = await resolveBinary("appostle") ?? "/usr/bin/appostle";
10207
+ const appostleBin = resolvePackagedAppostleBin() ?? await resolveBinary("appostle") ?? "/usr/bin/appostle";
10196
10208
  const logPath = path6.join(osHome, ".local", "state", "appostle", "daemon.log");
10197
10209
  const unit = `[Unit]
10198
10210
  Description=Appostle Daemon
@@ -10239,7 +10251,7 @@ async function installWindowsStartup() {
10239
10251
  const fs = await import("node:fs/promises");
10240
10252
  const path6 = await import("node:path");
10241
10253
  const osHome = (await import("node:os")).homedir();
10242
- const appostleBin = await resolveBinary("appostle") ?? "appostle.cmd";
10254
+ const appostleBin = resolvePackagedAppostleBin() ?? await resolveBinary("appostle") ?? "appostle.cmd";
10243
10255
  const logDir = path6.join(osHome, "AppData", "Local", "Appostle");
10244
10256
  const logPath = path6.join(logDir, "daemon.log");
10245
10257
  const batPath = path6.join(logDir, "appostle-daemon.bat");