@floless/app 0.5.1 → 0.5.2

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.
@@ -6005,7 +6005,7 @@ var require_thread_stream = __commonJS({
6005
6005
  var require_transport = __commonJS({
6006
6006
  "node_modules/pino/lib/transport.js"(exports2, module2) {
6007
6007
  "use strict";
6008
- var { createRequire: createRequire5 } = require("module");
6008
+ var { createRequire: createRequire4 } = require("module");
6009
6009
  var { existsSync: existsSync17 } = require("node:fs");
6010
6010
  var getCallers = require_caller();
6011
6011
  var { join: join19, isAbsolute: isAbsolute2, sep: sep3 } = require("node:path");
@@ -6208,7 +6208,7 @@ var require_transport = __commonJS({
6208
6208
  for (const filePath of callers) {
6209
6209
  try {
6210
6210
  const context = filePath === "node:repl" ? process.cwd() + sep3 : filePath;
6211
- fixTarget2 = createRequire5(context).resolve(origin);
6211
+ fixTarget2 = createRequire4(context).resolve(origin);
6212
6212
  break;
6213
6213
  } catch (err) {
6214
6214
  continue;
@@ -52251,10 +52251,18 @@ function appVersion() {
52251
52251
  return resolveVersion({
52252
52252
  isSea: isSea2(),
52253
52253
  sqVersionXml: readSqVersionXml(),
52254
- define: true ? "0.5.1" : void 0,
52254
+ define: true ? "0.5.2" : void 0,
52255
52255
  pkgVersion: readPkgVersion()
52256
52256
  });
52257
52257
  }
52258
+ function resolveChannel(s) {
52259
+ if (s.isSea) return "desktop";
52260
+ if (typeof s.define === "string") return "npm";
52261
+ return "dev";
52262
+ }
52263
+ function appChannel() {
52264
+ return resolveChannel({ isSea: isSea2(), define: true ? "0.5.2" : void 0 });
52265
+ }
52258
52266
 
52259
52267
  // bake.ts
52260
52268
  var import_yaml2 = __toESM(require_dist6(), 1);
@@ -53558,21 +53566,10 @@ var import_node_fs14 = require("node:fs");
53558
53566
  var import_node_stream = require("node:stream");
53559
53567
  var import_promises = require("node:stream/promises");
53560
53568
  var import_node_path12 = require("node:path");
53561
- var import_node_module4 = require("node:module");
53562
53569
  var CHANNEL = "win";
53563
53570
  var FEED_TIMEOUT_MS = 15e3;
53564
53571
  var DOWNLOAD_TIMEOUT_MS = 3e5;
53565
53572
  var NUPKG_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*\.nupkg$/;
53566
- var _isSea;
53567
- function isPackaged() {
53568
- if (_isSea !== void 0) return _isSea;
53569
- try {
53570
- _isSea = (0, import_node_module4.createRequire)(__import_meta_url)("node:sea").isSea();
53571
- } catch {
53572
- _isSea = false;
53573
- }
53574
- return _isSea;
53575
- }
53576
53573
  function currentVersion() {
53577
53574
  return appVersion();
53578
53575
  }
@@ -53623,14 +53620,32 @@ function versionGt(a, b) {
53623
53620
  }
53624
53621
  return false;
53625
53622
  }
53623
+ var NPM_LATEST_URL = "https://registry.npmjs.org/@floless/app/latest";
53624
+ var NPM_UPDATE_COMMAND = "npm i -g @floless/app@latest";
53625
+ async function checkNpmUpdate(cur) {
53626
+ const base = { supported: true, channel: "npm", currentVersion: cur };
53627
+ try {
53628
+ const res = await fetch(NPM_LATEST_URL, { redirect: "follow", signal: AbortSignal.timeout(FEED_TIMEOUT_MS) });
53629
+ if (!res.ok) return { ...base, updateAvailable: false, reason: `npm registry returned HTTP ${res.status}` };
53630
+ const body = await res.json();
53631
+ const latest = typeof body.version === "string" ? body.version : null;
53632
+ if (!latest) return { ...base, updateAvailable: false, reason: "npm registry returned no version" };
53633
+ if (!versionGt(latest, cur)) return { ...base, updateAvailable: false, targetVersion: latest, reason: `already up to date (v${cur})` };
53634
+ return { ...base, updateAvailable: true, targetVersion: latest, command: NPM_UPDATE_COMMAND };
53635
+ } catch (err) {
53636
+ return { ...base, updateAvailable: false, reason: `npm registry unreachable: ${err instanceof Error ? err.message : String(err)}` };
53637
+ }
53638
+ }
53626
53639
  async function checkForUpdate() {
53627
53640
  const cur = currentVersion();
53628
- if (!isPackaged()) {
53641
+ const channel = appChannel();
53642
+ if (channel === "npm") return checkNpmUpdate(cur);
53643
+ if (channel !== "desktop") {
53629
53644
  return {
53630
53645
  supported: false,
53631
53646
  currentVersion: cur,
53632
53647
  updateAvailable: false,
53633
- reason: "auto-update is for the installed app; update the npm package with `npm i -g @floless/app`"
53648
+ reason: "auto-update runs in the installed app; from source just `git pull`"
53634
53649
  };
53635
53650
  }
53636
53651
  const base = feedUrl();
package/dist/web/aware.js CHANGED
@@ -1477,17 +1477,31 @@
1477
1477
  const r = await fetch('/api/update');
1478
1478
  const d = await r.json();
1479
1479
  if (r.ok && d.supported && d.updateAvailable && d.targetVersion) {
1480
+ const npm = d.channel === 'npm';
1480
1481
  $appUpdate.textContent = '↑ Update to v' + d.targetVersion;
1481
- $appUpdate.dataset.tip = 'A newer floless.app is available — click to download and relaunch into v' + d.targetVersion;
1482
+ $appUpdate.dataset.channel = d.channel || 'desktop';
1483
+ $appUpdate.dataset.command = (npm && d.command) ? d.command : '';
1484
+ $appUpdate.dataset.tip = npm
1485
+ ? 'A newer floless.app (v' + d.targetVersion + ') is on npm — click to copy the update command'
1486
+ : 'A newer floless.app is available — click to download and relaunch into v' + d.targetVersion;
1482
1487
  $appUpdate.hidden = false;
1483
1488
  } else {
1484
- $appUpdate.hidden = true; // up-to-date / unsupported (dev/npm) / feed error → no tag
1489
+ $appUpdate.hidden = true; // up-to-date / dev / registry-or-feed error → no tag
1485
1490
  }
1486
1491
  } catch { $appUpdate.hidden = true; }
1487
1492
  }
1488
1493
  if ($appUpdate) {
1489
1494
  $appUpdate.onclick = async () => {
1490
- const v = $appUpdate.textContent.replace(/^[^0-9]*/, ''); // "↑ Update to v0.4.1" "0.4.1"
1495
+ // npm channel can't self-apply (no Update.exe) copy the command for the user's terminal.
1496
+ if ($appUpdate.dataset.channel === 'npm') {
1497
+ const cmd = $appUpdate.dataset.command || 'npm i -g @floless/app@latest';
1498
+ // Best-effort copy — fire-and-forget so the toast never blocks on clipboard permission.
1499
+ if (navigator.clipboard) navigator.clipboard.writeText(cmd).catch(() => {});
1500
+ showToast('Update in your terminal — ' + cmd, 'info');
1501
+ return;
1502
+ }
1503
+ // desktop (Velopack): one-click download + relaunch
1504
+ const v = $appUpdate.textContent.replace(/^[^0-9]*/, ''); // "↑ Update to v0.5.2" → "0.5.2"
1491
1505
  if (!window.confirm('Download v' + v + ' and relaunch floless.app now?')) return;
1492
1506
  $appUpdate.disabled = true;
1493
1507
  $appUpdate.textContent = '↑ Updating…';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "type": "module",
5
5
  "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {