import { existsSync } from "node:fs" import { readFile } from "node:fs/promises" import { homedir } from "node:os" import { join } from "node:path" import type { EditorConfigType, SyncEditorSettingSource } from "./syncEditorSetting" export interface SyncEditorFileConfig { backup?: boolean } export interface SyncEditorConfig { fileConfigs?: Record types?: EditorConfigType[] source?: SyncEditorSettingSource targets?: SyncEditorSettingSource[] onlinePath?: string } export interface ZixuluSetting { vscodeDownloadHistory?: string[] softwareDownloadHistory?: string[] upgradeWorkspaceDependcenyHistory?: Record syncEditor?: SyncEditorConfig verdaccioPath?: string templateProjects?: string[] } export async function readZixuluSetting(): Promise { const userDir = homedir() const settingPath = join(userDir, ".zixulu.json") if (existsSync(settingPath)) { const setting = JSON.parse(await readFile(settingPath, "utf-8")) return setting } return {} }