Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(web): automatically update idle servers #7503

Closedt3-code-bot[bot](GitHub profile, opens in a new tab)wants to merge 9 commits intomain fromfeat/automatic-server-updatesopened View on GitHub

Showing 22 changed files with 201 additions and 0 deletions (loading 21).

x
0 of 22 viewed, 22 left
201 additions and 0 deletionsapps/server/src/cloud/selfUpdate.test.tsModified
View file
@@ -1,5 +1,6 @@
import * as NodeServices from "@effect/platform-node/NodeServices";
import { expect, it } from "@effect/vitest";
+import { ServerAutomaticUpdateDeferredError, ServerSelfUpdateError } from "@t3tools/contracts";
import { HostProcessExecutablePath } from "@t3tools/shared/hostProcess";
import * as Deferred from "effect/Deferred";
import * as Effect from "effect/Effect";
@@ -18,6 +19,11 @@
readonly mode?: "web" | "desktop";
readonly managed?: boolean;
readonly preflight?: "ready" | "blocked";
+ readonly automaticUpdateIdle?: (
+ order: string[],
+ targetVersion: string,
+ ) => Effect.Effect<void, ServerSelfUpdateError | ServerAutomaticUpdateDeferredError>;
+ readonly install?: (order: string[]) => Effect.Effect<void>;
readonly requestUpdate?: ServiceLauncherClient.ServiceLauncherClient["Service"]["requestUpdate"];
​
@@ -33,6 +39,7 @@
Effect.gen(function* () {
if (input.command === "npm") {
order.push("install");
+ yield* options.install?.(order) ?? Effect.void;
const prefix = input.args[input.args.indexOf("--prefix") + 1];
if (prefix === undefined) return yield* Effect.die("missing npm prefix");
const entry = path.join(prefix, "node_modules", "t3", "dist", "bin.mjs");
@@ -89,6 +96,13 @@