跳转到内容
选择主题
选择语言简体中文

acde.config.jsonc

工程配置. JSON Schema 是 acde.config.schema.json, acdev new 把它放在配置文件旁边 (它随 acdev 一起来), TypeScript 类型是 AcdeConfig (来自 @dopame/acde-api):

type AcdeConfig = AppConfig | DesktopConfig
字段 类型 默认 说明
$schema string JSON Schema 的路径
type "app" | "desktop" 必填
name string package.json 的 name 包名
version string package.json 的 version
apiLevel 整数 ≥ 1 SDK 的 API_LEVEL (1) 契约级别; acdev build 把它写进清单. 不用写
public string "public" 原样复制的静态文件目录
字段 类型 默认 说明
id string 由包名得出 [a-z0-9][a-z0-9-]*
label string 显示名
icon 图标名 | 路径 "app" 见 图标
entry string "index.html" HTML 或默认导出 WindowApp 的模块; 用框架时不写
framework Framework "auto" 见下
capabilities Capabilities {} 系统能力, 见 包清单. 在这里写桌面服务的名字是错误
optional string[] [] 同时也在 capabilities 里的名字: 没有它们应用也能跑, 用动态的 import('acde:<名字>') 取
services string[] [] 应用用到的桌面服务, 以 acde:<名字> 导入; 不能是系统模块的名字
size [number, number] [800, 600] 内容区的逻辑像素, 正整数. acdev dev 单独跑这个应用时, 是宿主窗口打开时的尺寸 (应用铺满它); 带 --headless 时不生效
frame boolean true 系统标题栏
multiple boolean false 允许多个窗口
mimeTypes string[] [] type/subtype 或 type/*
schemes string[] [] 应用打开的链接的 URL scheme: [a-z][a-z0-9+.-]*, 不带冒号, 不能是 file
requests string[] [] 应用从 open() 接受的请求种类: [a-z][a-z0-9-]*, 不能是 open-file 或 open-link
heapMb number 256 每窗口的 JS 堆上限, ≥ 32
backend false | {entry?, port?} 自动找 见 后端

Framework: auto none next nuxt sveltekit astro react-router remix angular vite cra script.

字段 类型 默认 说明
id / label / description string
entry string "index.html" 桌面页面
heapMb number 1024
services Record<string, string | ServiceConfig> 服务名 → 模块路径, 或 { module, modules? }: 模块路径和服务从 ctx.import() 拿到的 shell 模块; 见 服务
apps WindowAppConfig[] 自带应用 (系统应用): AppConfig 的字段, 除了 framework; id 和 entry 必填, capabilities 里可以写 shell 模块