@shipers-dev/dayline 0.95.0 → 0.95.1

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.
Files changed (2) hide show
  1. package/dist/index.js +46 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -45260,7 +45260,7 @@ import { parseArgs } from "util";
45260
45260
  // package.json
45261
45261
  var package_default = {
45262
45262
  name: "@shipers-dev/dayline",
45263
- version: "0.95.0",
45263
+ version: "0.95.1",
45264
45264
  type: "module",
45265
45265
  bin: {
45266
45266
  dayline: "./dist/index.js"
@@ -46678,7 +46678,7 @@ init_lib();
46678
46678
  // package.json
46679
46679
  var package_default2 = {
46680
46680
  name: "@shipers-dev/dayline",
46681
- version: "0.95.0",
46681
+ version: "0.95.1",
46682
46682
  type: "module",
46683
46683
  bin: {
46684
46684
  dayline: "./dist/index.js"
@@ -48214,7 +48214,7 @@ ${err?.stack ?? ""}`);
48214
48214
  // src/commands/service.ts
48215
48215
  init_esm();
48216
48216
  import { existsSync as existsSync18, readFileSync as readFileSync13 } from "fs";
48217
- import { homedir as homedir6, platform } from "os";
48217
+ import { homedir as homedir6, platform, tmpdir } from "os";
48218
48218
  import { join as join19 } from "path";
48219
48219
  init_errors();
48220
48220
  init_paths();
@@ -48242,15 +48242,54 @@ var readPid = () => {
48242
48242
  return null;
48243
48243
  }
48244
48244
  };
48245
+ function isEphemeralBinary(path) {
48246
+ if (!path)
48247
+ return true;
48248
+ return path.includes("/bunx-") || path.includes("/_npx/") || path.startsWith(tmpdir() + "/") || /\/T\/bunx/.test(path);
48249
+ }
48250
+ function pickStableBinary(candidates, exists4) {
48251
+ for (const c of candidates) {
48252
+ if (!c)
48253
+ continue;
48254
+ if (isEphemeralBinary(c))
48255
+ continue;
48256
+ if (exists4(c))
48257
+ return c;
48258
+ }
48259
+ return null;
48260
+ }
48261
+ function stableCandidates(fromWhich) {
48262
+ const home = homedir6();
48263
+ return [
48264
+ fromWhich,
48265
+ join19(home, ".bun/bin/dayline"),
48266
+ "/opt/homebrew/bin/dayline",
48267
+ "/usr/local/bin/dayline",
48268
+ join19(home, ".npm-global/bin/dayline")
48269
+ ];
48270
+ }
48245
48271
  var resolveBinary = exports_Effect.fn("service.resolveBinary")(function* () {
48246
48272
  const proc = Bun.spawn(["which", "dayline"], { stdout: "pipe", stderr: "pipe" });
48247
48273
  yield* exports_Effect.promise(() => proc.exited);
48248
48274
  const out = yield* exports_Effect.promise(() => new Response(proc.stdout).text());
48249
- const path = out.trim();
48250
- if (path && existsSync18(path))
48251
- return path;
48275
+ const fromWhich = out.trim();
48276
+ const stable = pickStableBinary(stableCandidates(fromWhich), existsSync18);
48277
+ if (stable)
48278
+ return stable;
48279
+ console.log("Installing @shipers-dev/dayline globally so the service has a stable binary…");
48280
+ const bun = Bun.which("bun");
48281
+ if (bun) {
48282
+ const add6 = Bun.spawn([bun, "add", "-g", "@shipers-dev/dayline@latest"], {
48283
+ stdout: "inherit",
48284
+ stderr: "inherit"
48285
+ });
48286
+ yield* exports_Effect.promise(() => add6.exited);
48287
+ }
48288
+ const afterInstall = pickStableBinary(stableCandidates(""), existsSync18);
48289
+ if (afterInstall)
48290
+ return afterInstall;
48252
48291
  return yield* exports_Effect.fail(new DaemonError({
48253
- message: "Could not find `dayline` on PATH. Install with: bun install -g @shipers-dev/dayline"
48292
+ message: "Could not find an installed `dayline`. Install it with `bun add -g @shipers-dev/dayline`, then re-run `dayline service install`."
48254
48293
  }));
48255
48294
  });
48256
48295
  var run6 = exports_Effect.fn("service.run")(function* (cmd, args2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipers-dev/dayline",
3
- "version": "0.95.0",
3
+ "version": "0.95.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "dayline": "./dist/index.js"