mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-29 21:33:54 +00:00
98 lines
2.4 KiB
TypeScript
98 lines
2.4 KiB
TypeScript
import type { Configuration } from "electron-builder"
|
|
|
|
const channel = (() => {
|
|
const raw = process.env.OPENCODE_CHANNEL
|
|
if (raw === "dev" || raw === "beta" || raw === "prod") return raw
|
|
return "dev"
|
|
})()
|
|
|
|
const getBase = (): Configuration => ({
|
|
artifactName: "opencode-electron-${os}-${arch}.${ext}",
|
|
directories: {
|
|
output: "dist",
|
|
buildResources: "resources",
|
|
},
|
|
files: ["out/**/*", "resources/**/*"],
|
|
extraResources: [
|
|
{
|
|
from: "resources/",
|
|
to: "",
|
|
filter: ["opencode-cli*"],
|
|
},
|
|
{
|
|
from: "native/",
|
|
to: "native/",
|
|
filter: ["index.js", "index.d.ts", "build/Release/mac_window.node", "swift-build/**"],
|
|
},
|
|
],
|
|
mac: {
|
|
category: "public.app-category.developer-tools",
|
|
icon: `resources/icons/icon.icns`,
|
|
hardenedRuntime: true,
|
|
gatekeeperAssess: false,
|
|
entitlements: "resources/entitlements.plist",
|
|
entitlementsInherit: "resources/entitlements.plist",
|
|
notarize: true,
|
|
target: ["dmg", "zip"],
|
|
},
|
|
dmg: {
|
|
sign: true,
|
|
},
|
|
protocols: {
|
|
name: "TF Code",
|
|
schemes: ["opencode"],
|
|
},
|
|
win: {
|
|
icon: `resources/icons/icon.ico`,
|
|
target: ["nsis"],
|
|
},
|
|
nsis: {
|
|
oneClick: false,
|
|
allowToChangeInstallationDirectory: true,
|
|
installerIcon: `resources/icons/icon.ico`,
|
|
installerHeaderIcon: `resources/icons/icon.ico`,
|
|
},
|
|
linux: {
|
|
icon: `resources/icons`,
|
|
category: "Development",
|
|
target: ["AppImage", "deb", "rpm"],
|
|
},
|
|
})
|
|
|
|
function getConfig() {
|
|
const base = getBase()
|
|
|
|
switch (channel) {
|
|
case "dev": {
|
|
return {
|
|
...base,
|
|
appId: "ai.opencode.desktop.dev",
|
|
productName: "TF Code Dev",
|
|
rpm: { packageName: "opencode-dev" },
|
|
}
|
|
}
|
|
case "beta": {
|
|
return {
|
|
...base,
|
|
appId: "ai.opencode.desktop.beta",
|
|
productName: "TF Code Beta",
|
|
protocols: { name: "TF Code Beta", schemes: ["opencode"] },
|
|
publish: { provider: "github", owner: "anomalyco", repo: "opencode-beta", channel: "latest" },
|
|
rpm: { packageName: "opencode-beta" },
|
|
}
|
|
}
|
|
case "prod": {
|
|
return {
|
|
...base,
|
|
appId: "ai.opencode.desktop",
|
|
productName: "TF Code",
|
|
protocols: { name: "TF Code", schemes: ["opencode"] },
|
|
publish: { provider: "github", owner: "anomalyco", repo: "opencode", channel: "latest" },
|
|
rpm: { packageName: "opencode" },
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
export default getConfig()
|