18 changed files with 183 additions and 165 deletions
@ -1,12 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|
||||
<plist version="1.0"> |
|
||||
<dict> |
|
||||
<key>com.apple.security.cs.allow-jit</key> |
|
||||
<true/> |
|
||||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key> |
|
||||
<true/> |
|
||||
<key>com.apple.security.cs.allow-dyld-environment-variables</key> |
|
||||
<true/> |
|
||||
</dict> |
|
||||
</plist> |
|
@ -0,0 +1,11 @@ |
|||||
|
{ |
||||
|
"storagePath": "$storagePath$", |
||||
|
"language": "zh", |
||||
|
"dev:debug": 2, |
||||
|
"common.theme": "auto", |
||||
|
"update.hoturl": "https://alist.xieyaxin.top/d/%E8%B5%84%E6%BA%90/%E6%B5%8B%E8%AF%95%E6%96%87%E4%BB%B6.zip?sign=eqy35CR-J1SOQZz0iUN2P3B0BiyZPdYH0362nLXbUhE=:1749085071", |
||||
|
"update.repo": "wood-desktop", |
||||
|
"update.owner": "npmrun", |
||||
|
"update.allowDowngrade": false, |
||||
|
"update.allowPrerelease": false |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
{ |
||||
|
"name": "zephyr", |
||||
|
"appId": "com.zephyr.app", |
||||
|
"win": { |
||||
|
"executableName": "zephyr" |
||||
|
}, |
||||
|
"linux": { |
||||
|
"target": ["AppImage", "snap", "deb"], |
||||
|
"maintainer": "electronjs.org", |
||||
|
"category": "Utility" |
||||
|
}, |
||||
|
"publish": { |
||||
|
"provider": "generic", |
||||
|
"url": "https://example.com/auto-updates" |
||||
|
} |
||||
|
} |
@ -1,52 +1,20 @@ |
|||||
import { LogLevel } from "logger/common" |
import { LogLevel } from "logger/common" |
||||
|
import AppConfig from "./app_config.json" |
||||
|
import ExeConfig from "./exe_config.json" |
||||
|
|
||||
// 定义主题类型
|
// 定义主题类型
|
||||
type ThemeType = "light" | "dark" | "auto" |
type ThemeType = "light" | "dark" | "auto" |
||||
// 定义语言类型
|
// 定义语言类型
|
||||
type LanguageType = "zh" | "en" |
type LanguageType = "zh" | "en" |
||||
// 定义编辑器logo类型
|
|
||||
type LogoType = "logo" | "bg" |
|
||||
|
|
||||
// 配置接口定义
|
export type IConfig = typeof AppConfig & |
||||
export interface IDefaultConfig { |
Pick<Partial<typeof AppConfig>, "common.theme"> & { |
||||
language: LanguageType |
language: LanguageType |
||||
"common.theme": ThemeType |
"common.theme": ThemeType |
||||
debug: LogLevel |
"dev:debug": LogLevel |
||||
"desktop:wallpaper": string |
|
||||
"update.hoturl": string |
|
||||
"update.repo"?: string |
|
||||
"update.owner"?: string |
|
||||
"update.allowDowngrade": boolean |
|
||||
"update.allowPrerelease": boolean |
|
||||
"editor.bg": string |
|
||||
"editor.logoType": LogoType |
|
||||
"editor.fontFamily": string |
|
||||
"snippet.storagePath": string |
|
||||
storagePath: string |
|
||||
} |
|
||||
|
|
||||
interface IConfig { |
|
||||
app_title: string |
|
||||
default_config: IDefaultConfig |
|
||||
} |
} |
||||
|
|
||||
// 默认配置导出
|
|
||||
export default { |
export default { |
||||
app_title: "zephyr", // 和风
|
AppConfig, |
||||
default_config: { |
ExeConfig, |
||||
storagePath: "$storagePath$", |
} |
||||
language: "zh", |
|
||||
debug: LogLevel.INFO, |
|
||||
"common.theme": "auto", |
|
||||
"desktop:wallpaper": "", |
|
||||
"editor.bg": "", |
|
||||
"editor.logoType": "logo", |
|
||||
"editor.fontFamily": "Cascadia Mono, Consolas, 'Courier New', monospace", |
|
||||
"update.hoturl": |
|
||||
"https://alist.xieyaxin.top/d/%E8%B5%84%E6%BA%90/%E6%B5%8B%E8%AF%95%E6%96%87%E4%BB%B6.zip?sign=eqy35CR-J1SOQZz0iUN2P3B0BiyZPdYH0362nLXbUhE=:1749085071", |
|
||||
"update.repo": "wood-desktop", |
|
||||
"update.owner": "npmrun", |
|
||||
"update.allowDowngrade": false, |
|
||||
"update.allowPrerelease": false, |
|
||||
"snippet.storagePath": "$storagePath$/snippets", |
|
||||
}, |
|
||||
} as const satisfies IConfig |
|
||||
|
@ -0,0 +1,41 @@ |
|||||
|
import fs from "node:fs" |
||||
|
const text = fs.readFileSync("./config/exe_config.json", "utf8") |
||||
|
const ExeConfig = JSON.parse(text) |
||||
|
|
||||
|
export default { |
||||
|
appId: ExeConfig.appId, |
||||
|
productName: ExeConfig.name, |
||||
|
directories: { |
||||
|
buildResources: "build", |
||||
|
}, |
||||
|
files: [ |
||||
|
"!**/.vscode/*", |
||||
|
"!src/*", |
||||
|
"!electron.vite.config.{js,ts,mjs,cjs}", |
||||
|
"!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}", |
||||
|
"!{.env,.env.*,.npmrc,pnpm-lock.yaml}", |
||||
|
"!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}", |
||||
|
], |
||||
|
asarUnpack: ["node_modules/sqlite3", "out/main/chunks/*.node", "resources/*"], |
||||
|
win: { |
||||
|
executableName: ExeConfig.win.executableName, |
||||
|
}, |
||||
|
nsis: { |
||||
|
artifactName: "${name}-${version}-setup.${ext}", |
||||
|
shortcutName: "${productName}", |
||||
|
uninstallDisplayName: "${productName}", |
||||
|
createDesktopShortcut: "always", |
||||
|
}, |
||||
|
dmg: { |
||||
|
artifactName: "${name}-${version}.${ext}", |
||||
|
}, |
||||
|
linux: ExeConfig.linux, |
||||
|
appImage: { |
||||
|
artifactName: "${name}-${version}.${ext}", |
||||
|
}, |
||||
|
npmRebuild: false, |
||||
|
publish: ExeConfig.publish, |
||||
|
electronDownload: { |
||||
|
mirror: "https://npmmirror.com/mirrors/electron/", |
||||
|
}, |
||||
|
} |
@ -1,20 +1,24 @@ |
|||||
type Api = { |
type FireFN = (...argu: any[]) => void |
||||
call: (command: string, ...args: any[]) => Promise<any> |
|
||||
callLong: (command: string, ...args: any[]) => Promise<any> |
type Api<T extends Record<string | symbol, FireFN>> = { |
||||
callSync: (command: string, ...args: any[]) => any |
call: <S extends keyof T>(command: S, ...args: Parameters<T[S]>) => ReturnType<T[S]> |
||||
send: (command: string, ...argu: any[]) => any |
callLong: <S extends keyof T>(command: S, ...args: Parameters<T[S]>) => ReturnType<T[S]> |
||||
sendSync: (command: string, ...argu: any[]) => any |
callSync: <S extends keyof T>(command: S, ...args: Parameters<T[S]>) => ReturnType<T[S]> |
||||
on: <T extends string>(command: T, cb: (event: IpcRendererEvent, ...args: any[]) => void) => () => void |
send: <S extends keyof T>(command: S, ...argu: Parameters<T[S]>) => ReturnType<T[S]> |
||||
once: (command: string, cb: (event: IpcRendererEvent, ...args: any[]) => void) => () => void |
sendSync: <S extends keyof T>(command: S, ...argu: Parameters<T[S]>) => ReturnType<T[S]> |
||||
off: (command: string, cb: (event: IpcRendererEvent, ...args: any[]) => void) => void |
on: <S extends keyof T>(command: S, cb: (event: IpcRendererEvent, ...args: Parameters<T[S]>) => void) => () => void |
||||
offAll: (command: string) => void |
once: <S extends keyof T>(command: S, cb: (event: IpcRendererEvent, ...args: Parameters<T[S]>) => void) => () => void |
||||
|
off: <S extends keyof T>(command: S, cb: (event: IpcRendererEvent, ...args: Parameters<T[S]>) => void) => void |
||||
|
offAll: <S extends keyof T>(command: S) => void |
||||
popupMenu: (options: IPopupMenuOption) => void |
popupMenu: (options: IPopupMenuOption) => void |
||||
} |
} |
||||
|
|
||||
declare const electron: typeof import("@electron-toolkit/preload").electronAPI |
declare const electron: typeof import("@electron-toolkit/preload").electronAPI |
||||
declare const api: Api |
declare const api: Api |
||||
|
declare const getApi: <T>() => Api<T> |
||||
|
|
||||
interface Window { |
interface Window { |
||||
electron: typeof import("@electron-toolkit/preload").electronAPI |
electron: typeof import("@electron-toolkit/preload").electronAPI |
||||
api: Api |
api: Api |
||||
|
getApi: getApi |
||||
} |
} |
||||
|
Loading…
Reference in new issue