- Remove electron-store dependency usage (ESM-only) - Implement JSON file storage using native fs module - Read/write config.json and secure.json directly - Maintain same API for domain and version storage
2.2 KiB
2.2 KiB
Learnings
[2026-03-12] Kintone Customize Manager Core Features
Technical Decisions
-
Type System Organization
- Created separate type files for domain, kintone, version, and ipc types
- Used
Result<T>pattern for unified IPC response handling - Added path alias
@renderer/*to tsconfig.node.json for main process imports
-
SafeStorage for Password Encryption
- Used Electron's built-in
safeStorageAPI instead of deprecatedkeytar - Implemented
isSecureStorageAvailable()check for Linux compatibility - Store encrypted passwords as base64 strings in separate secure store
- Used Electron's built-in
-
Kintone API Client
- Used native
fetchAPI (Node.js 18+) instead of axios - Implemented 30-second timeout with AbortController
- Support both password authentication and API token authentication
- Used native
-
IPC Architecture
- All handlers return
{ success: boolean, data?: T, error?: string } - Used
contextBridgeto expose safe API to renderer - Created typed
ElectronAPIinterface for window.api
- All handlers return
-
State Management
- Zustand with persist middleware for domain persistence
- Separate stores for domain, app, deploy, and version state
- IPC calls in store actions, not in components
-
UI Components
- LobeHub UI + Ant Design 6 + antd-style for styling
- CodeMirror 6 for code viewing with syntax highlighting
- Step-by-step deploy dialog with confirmation
Gotchas
-
tsconfig.node.json needs @renderer/* path alias
- Main process files import from
@renderer/types - Without the alias, build fails
- Main process files import from
-
JSON import in preload requires named exports
- Use
{ Component }syntax, notimport Component from ... - Default exports don't work with contextBridge
- Use
-
CodeMirror extensions must match file type
- Use
javascript()for JS,css()for CSS files - Extensions are loaded dynamically based on file type
- Use
Files Created
- Types: domain.ts, kintone.ts, version.ts, ipc.ts
- Main: storage.ts, kintone-api.ts, ipc-handlers.ts
- Preload: index.ts, index.d.ts (updated)
- Stores: domainStore.ts, appStore.ts, deployStore.ts, versionStore.ts
- Components: DomainManager/, SpaceTree/, AppDetail/, CodeViewer/, FileUploader/, DeployDialog/, VersionHistory/