Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions scripts/build-desktop-artifact.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
assert.notInclude(error.message, secret);
});

it.effect("adds passkey entitlements and both renderer protocols to signed macOS builds", () =>
it.effect("adds passkey entitlements and the external protocol to signed macOS builds", () =>
Effect.gen(function* () {
const config = yield* createBuildConfig("mac", "dmg", "1.2.3", true, false, undefined, {
entitlementsPath: "/tmp/entitlements.mac.plist",
Expand All @@ -559,9 +559,30 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
assert.equal(config.appId, "com.t3tools.t3code");
assert.equal(mac.entitlements, "/tmp/entitlements.mac.plist");
assert.equal(mac.provisioningProfile, "/tmp/t3code.provisionprofile");
assert.deepStrictEqual(mac.protocols, [
{ name: "T3 Code", schemes: ["t3code", "t3code-dev"] },
]);
assert.deepStrictEqual(config.protocols, [{ name: "T3 Code", schemes: ["t3code"] }]);
assert.notProperty(mac, "protocols");
}).pipe(Effect.provide(ConfigProvider.layer(ConfigProvider.fromEnv({ env: {} })))),
);

it.effect("declares the external protocol for Linux desktop integration", () =>
Effect.gen(function* () {
const config = yield* createBuildConfig(
"linux",
"AppImage",
"1.2.3",
false,
false,
undefined,
undefined,
);

const linux = config.linux as Record<string, unknown>;
assert.deepStrictEqual(config.protocols, [{ name: "T3 Code", schemes: ["t3code"] }]);
assert.notProperty(linux, "protocols");
assert.notProperty(
(linux.desktop as { readonly entry: Record<string, unknown> }).entry,
"MimeType",
);
}).pipe(Effect.provide(ConfigProvider.layer(ConfigProvider.fromEnv({ env: {} })))),
);

Expand All @@ -578,6 +599,7 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
);

const win = config.win as Record<string, unknown>;
assert.deepStrictEqual(config.protocols, [{ name: "T3 Code", schemes: ["t3code"] }]);
assert.equal(win.icon, "icon.ico");
assert.equal(win.signAndEditExecutable, true);
assert.notProperty(win, "azureSignOptions");
Expand Down
24 changes: 9 additions & 15 deletions scripts/build-desktop-artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1573,6 +1573,15 @@ export const createBuildConfig = Effect.fn("createBuildConfig")(function* (
artifactName: "T3-Code-${version}-${arch}.${ext}",
electronLanguages: [...DESKTOP_ELECTRON_LANGUAGES],
files: [...DESKTOP_FILE_EXCLUSIONS],
// electron-builder writes this into macOS CFBundleURLTypes and Linux
// x-scheme-handler metadata. Windows NSIS builds register the same scheme
// at runtime through app.setAsDefaultProtocolClient.
protocols: [
{
name: "T3 Code",
schemes: ["t3code"],
},
],
directories: {
buildResources: "apps/desktop/resources",
},
Expand Down Expand Up @@ -1600,12 +1609,6 @@ export const createBuildConfig = Effect.fn("createBuildConfig")(function* (
target: target === "dmg" ? [target, "zip"] : [target],
icon: "icon.icns",
category: "public.app-category.developer-tools",
protocols: [
{
name: "T3 Code",
schemes: ["t3code", "t3code-dev"],
},
],
...(macPasskeySigning
? {
entitlements: macPasskeySigning.entitlementsPath,
Expand All @@ -1624,17 +1627,8 @@ export const createBuildConfig = Effect.fn("createBuildConfig")(function* (
desktop: {
entry: {
StartupWMClass: "t3code",
// Register the external deep-link scheme so xdg-open can launch T3.
// electron-builder keeps %U on Exec when MimeType is present.
MimeType: "x-scheme-handler/t3code;",
},
},
protocols: [
{
name: "T3 Code",
schemes: ["t3code"],
},
],
};
}

Expand Down
Loading