# 01-what-is-electron / app 演示 Electron 的最小可运行形态:一个窗口、一个 preload 桥、一个类型化 IPC,以及 `--smoke` 自退出。 它**不**演示 React、Tailwind、打包安装器(分别见第 14、15、54 章)。 ## 运行 ```bash pnpm --filter @tutorial/01-what-is-electron-app start ``` ## 验证 ```bash pnpm --filter @tutorial/01-what-is-electron-app smoke # 期望最后一行:{"evt":"smoke","ok":true,...} ``` ## 结构 - `main/`:主进程入口,创建窗口、注册 IPC、处理 `--smoke` / `--shots` - `preload/`:只暴露 `info()` 的桥 - `shared/`:通道名与类型(三端唯一来源) - `src/`:渲染进程(原生 TS,无框架) ## testid | testid | 用途 | | --- | --- | | `app-title` | 页面标题,smoke 断言非空 | | `info-electron` | Electron 版本 | | `info-node` | Node 版本 | | `info-chrome` | Chromium 版本 | | `tab-overview` / `tab-processes` / `tab-security` | 三个页签 | | `process-table` | 进程与 PID 表 | | `security-panel` | `webPreferences` 默认值 | ## 已知限制 - 只在 macOS arm64 上验证;Windows / Linux 的窗口与进程行为未实测。 - `--shots` 用 `webContents.capturePage()` 截页面内容,不含系统标题栏(标题栏截图需要屏幕录制权限)。