simvyn 2.2.0 → 2.5.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.
@@ -38,8 +38,8 @@
38
38
  }
39
39
  </style>
40
40
  <title>simvyn</title>
41
- <script type="module" crossorigin src="/assets/index-B_mApJSj.js"></script>
42
- <link rel="stylesheet" crossorigin href="/assets/index-B6SC-KfX.css">
41
+ <script type="module" crossorigin src="/assets/index-D67XE6HO.js"></script>
42
+ <link rel="stylesheet" crossorigin href="/assets/index-C-atBUQQ.css">
43
43
  </head>
44
44
  <body>
45
45
  <div id="root"></div>
package/dist/index.js CHANGED
@@ -8859,7 +8859,7 @@ function createStubProcessManager() {
8859
8859
  };
8860
8860
  }
8861
8861
  async function createApp(opts = {}) {
8862
- const { modulesDir, modules, dashboardDir: dashboardDir2, logger = true } = opts;
8862
+ const { modulesDir, modules, dashboardDir: dashboardDir2, logger = true, version = "0.0.0" } = opts;
8863
8863
  const fastify = Fastify({ logger });
8864
8864
  await fastify.register(fastifyWebsocket);
8865
8865
  if (dashboardDir2) {
@@ -8935,6 +8935,32 @@ async function createApp(opts = {}) {
8935
8935
  deviceCount: fastify.deviceManager.devices.length
8936
8936
  };
8937
8937
  });
8938
+ fastify.get("/api/update-check", async () => {
8939
+ try {
8940
+ const controller = new AbortController();
8941
+ const timeout = setTimeout(() => controller.abort(), 3e3);
8942
+ const res = await fetch("https://registry.npmjs.org/simvyn/latest", {
8943
+ signal: controller.signal
8944
+ });
8945
+ clearTimeout(timeout);
8946
+ if (!res.ok) return { current: version, latest: null, needsUpdate: false };
8947
+ const data = await res.json();
8948
+ const latest = data.version;
8949
+ const l = latest.split(".").map(Number);
8950
+ const c = version.split(".").map(Number);
8951
+ let needsUpdate = false;
8952
+ for (let i = 0; i < 3; i++) {
8953
+ if ((l[i] ?? 0) > (c[i] ?? 0)) {
8954
+ needsUpdate = true;
8955
+ break;
8956
+ }
8957
+ if ((l[i] ?? 0) < (c[i] ?? 0)) break;
8958
+ }
8959
+ return { current: version, latest, needsUpdate };
8960
+ } catch {
8961
+ return { current: version, latest: null, needsUpdate: false };
8962
+ }
8963
+ });
8938
8964
  fastify.get("/api/tool-settings/config", async () => {
8939
8965
  const config = await toolSettingsStorage.read("config");
8940
8966
  return config ?? { port: 3847, autoOpen: true, pollInterval: 5e3 };
@@ -9049,7 +9075,8 @@ async function startServer(opts = {}) {
9049
9075
  modulesDir: opts.modules ? void 0 : modulesDir,
9050
9076
  modules: opts.modules,
9051
9077
  dashboardDir: hasDashboard ? dashboardDir2 : void 0,
9052
- logger: { level: "warn" }
9078
+ logger: { level: "warn" },
9079
+ version: opts.version
9053
9080
  });
9054
9081
  await app.listen({ port, host });
9055
9082
  const url = `http://${host}:${port}`;
@@ -9127,7 +9154,8 @@ async function runStart(cliOpts, ctx) {
9127
9154
  host: cliOpts.host,
9128
9155
  open: cliOpts.open,
9129
9156
  dashboardDir: ctx.dashboardDir,
9130
- modules: ctx.modules
9157
+ modules: ctx.modules,
9158
+ version: ctx.version
9131
9159
  });
9132
9160
  checkForUpdate(ctx.version).then((result) => {
9133
9161
  if (!result || !result.needsUpdate) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simvyn",
3
- "version": "2.2.0",
3
+ "version": "2.5.1",
4
4
  "type": "module",
5
5
  "description": "Universal mobile device devtool — control iOS Simulators, Android Emulators, and real devices from a single dashboard and CLI",
6
6
  "main": "./dist/index.js",