Skip to content

The VS Code of video editing, built for agents.

TypeScript

feat: update version to 0.216.0 across all modules and implement auto-update notifications

konstantin-paulus98ea0c986b60
diff --git a/apps/cli/package.json b/apps/cli/package.json
index 91aa0d1e..5f9401dd 100644
--- a/apps/cli/package.json
+++ b/apps/cli/package.json
@@ -1,7 +1,7 @@
{
"name": "@diffusionstudio/cli",
"private": true,
- "version": "0.215.0",
+ "version": "0.216.0",
"license": "MPL-2.0",
"bin": {
"diffusion": "./dist/index.js",
diff --git a/apps/desktop/package.json b/apps/desktop/package.json
index f10ac7af..eb59353c 100644
--- a/apps/desktop/package.json
+++ b/apps/desktop/package.json
@@ -1,7 +1,7 @@
{
"name": "@diffusionstudio/desktop",
"private": true,
- "version": "0.215.0",
+ "version": "0.216.0",
"license": "MPL-2.0",
"repository": {
"type": "git",
diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts
index a52a327b..3839fae4 100644
--- a/apps/desktop/src/main.ts
+++ b/apps/desktop/src/main.ts
@@ -8,6 +8,7 @@ import { existsSync } from "node:fs";
import { mkdir, open, rename, unlink } from "node:fs/promises";
import { randomUUID } from "node:crypto";
import type { FileHandle } from "node:fs/promises";
+import type { IUpdateInfo } from "update-electron-app";
import { makeUserNotifier, updateElectronApp } from "update-electron-app";
import { tempPathFor } from "./atomic";
import { DapiServer } from "./dapi/server";
@@ -111,14 +112,25 @@ function setColorMode(mode: "dark" | "light") {
mainWindow.setTitleBarOverlay({ ...WINDOWS_OVERLAY_COLORS[mode], height: WINDOWS_OVERLAY_HEIGHT });
}
+// A downloaded update is offered while the user has the window out; one that
+// lands while the app runs in the background waits for the next show, since
+// the app rarely quits on its own to apply it.
+const notifyUser = makeUserNotifier();
+let pendingUpdate: IUpdateInfo | null = null;
+
+function offerUpdate() {
+ if (!pendingUpdate || !windows.visible()) return;
+ const info = pendingUpdate;
+ pendingUpdate = null;
+ notifyUser(info);
+}
+
if (app.isPackaged && !squirrelLaunch) {
- const notifyUser = makeUserNotifier();
updateElectronApp({
repo: "diffusionstudio/editor",
onNotifyUser: function (info) {
- if (windows.visible()) {
- notifyUser(info);
- }
+ pendingUpdate = info;
+ offerUpdate();
},
});
}
@@ -131,7 +143,10 @@ let lastProject: string | null = null;
const windows = new WindowHost({
create: createWindow,
idleMs: WINDOW_IDLE_MS,
- onChange: () => tray.refresh(),
+ onChange: () => {
+ tray.refresh();
+ offerUpdate();
+ },
});
const tray = new AppTray({
diff --git a/apps/desktop/src/window-host.test.ts b/apps/desktop/src/window-host.test.ts
index c2ff5f94..7b35af46 100644
--- a/apps/desktop/src/window-host.test.ts
+++ b/apps/desktop/src/window-host.test.ts
@@ -6,10 +6,12 @@ import { EventEmitter } from "node:events";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
const appEvents = new EventEmitter();
+const updaterEvents = new EventEmitter();
const dock = { show: vi.fn(async () => { }), hide: vi.fn() };
vi.mock("electron", () => ({
app: { on: (event: string, listener: () => void) => appEvents.on(event, listener), dock, focus: () => { } },
+ autoUpdater: { on: (event: string, listener: () => void) => updaterEvents.on(event, listener) },
}));
const { WindowHost } = await import("./window-host");
@@ -45,6 +47,7 @@ let host: InstanceType<typeof WindowHost>;
beforeEach(() => {
vi.useFakeTimers();
appEvents.removeAllListeners();
+ updaterEvents.removeAllListeners();
created = [];
host = new WindowHost({
create: () => {
@@ -132,4 +135,11 @@ describe("WindowHost", () => {
expect(created[0]!.isDestroyed()).toBe(true);
expect(host.current()).toBeNull();
});
+
+ it("lets the window close when an update quits the app to install", async () => {
+ await host.show();
+ updaterEvents.emit("before-quit-for-update");
+ created[0]!.close();
+ expect(created[0]!.isDestroyed()).toBe(true);
+ });
});
diff --git a/apps/desktop/src/window-host.ts b/apps/desktop/src/window-host.ts
index 8ad66241..d186cac7 100644
--- a/apps/desktop/src/window-host.ts
+++ b/apps/desktop/src/window-host.ts
@@ -12,7 +12,7 @@
// the Dock icon (macOS) follows whether the window is showing, and closing
// the window hides it rather than ending what the renderer is doing.
-import { app } from "electron";
+import { app, autoUpdater } from "electron";
import type { BrowserWindow } from "electron";
@@ -47,6 +47,11 @@ export class WindowHost {
app.on("before-quit", () => {
this.quitting = true;
});
+ // quitAndInstall closes the windows before `before-quit`; a close turned
+ // into a hide there would leave the app running and the update unapplied.
+ autoUpdater.on("before-quit-for-update", () => {
+ this.quitting = true;
+ });
}
/** The window, if there is one. */
diff --git a/apps/web/package.json b/apps/web/package.json
index 97650c96..bdd2ca0e 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -1,7 +1,7 @@
{
"name": "@diffusionstudio/web",
"private": true,
- "version": "0.215.0",
+ "version": "0.216.0",
"license": "MPL-2.0",
"type": "module",
"scripts": {
diff --git a/package-lock.json b/package-lock.json
index 96e2240e..4ead85de 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@diffusionstudio/editor",
- "version": "0.215.0",
+ "version": "0.216.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@diffusionstudio/editor",
- "version": "0.215.0",
+ "version": "0.216.0",
"hasInstallScript": true,
"license": "MPL-2.0",
"workspaces": [
@@ -19,7 +19,7 @@
},
"apps/cli": {
"name": "@diffusionstudio/cli",
- "version": "0.215.0",
+ "version": "0.216.0",
"license": "MPL-2.0",
"dependencies": {
"@diffusionstudio/dapi": "*",
@@ -39,7 +39,7 @@
},
"apps/desktop": {
"name": "@diffusionstudio/desktop",
- "version": "0.215.0",
+ "version": "0.216.0",
"license": "MPL-2.0",
"dependencies": {
"@babel/core": "^7.29.7",
@@ -88,7 +88,7 @@
},
"apps/web": {
"name": "@diffusionstudio/web",
- "version": "0.215.0",
+ "version": "0.216.0",
"license": "MPL-2.0",
"dependencies": {
"@diffusionstudio/agent-chat": "*",
@@ -14210,7 +14210,7 @@
},
"packages/jsx": {
"name": "@diffusionstudio/jsx",
- "version": "0.215.0",
+ "version": "0.216.0",
"license": "MPL-2.0",
"dependencies": {
"koota": "^0.6.6"
diff --git a/package.json b/package.json
index 1976a5e0..1bc11288 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@diffusionstudio/editor",
- "version": "0.215.0",
+ "version": "0.216.0",
"private": true,
"license": "MPL-2.0",
"type": "module",
diff --git a/packages/jsx/package.json b/packages/jsx/package.json
index 60b92882..e66610d8 100644
--- a/packages/jsx/package.json
+++ b/packages/jsx/package.json
@@ -1,6 +1,6 @@
{
"name": "@diffusionstudio/jsx",
- "version": "0.215.0",
+ "version": "0.216.0",
"description": "Types and authoring API for Diffusion Studio compositions: the JSX element vocabulary and the hooks the editor implements when it mounts a project.",
"license": "MPL-2.0",
"type": "module",