* Removes history field from projects (migrated to history.jsonl) * @internal
( projects: Record<string, ProjectConfig> | undefined, )
| 1038 | * @internal |
| 1039 | */ |
| 1040 | function removeProjectHistory( |
| 1041 | projects: Record<string, ProjectConfig> | undefined, |
| 1042 | ): Record<string, ProjectConfig> | undefined { |
| 1043 | if (!projects) { |
| 1044 | return projects |
| 1045 | } |
| 1046 | |
| 1047 | const cleanedProjects: Record<string, ProjectConfig> = {} |
| 1048 | let needsCleaning = false |
| 1049 | |
| 1050 | for (const [path, projectConfig] of Object.entries(projects)) { |
| 1051 | // history is removed from the type but may exist in old configs |
| 1052 | const legacy = projectConfig as ProjectConfig & { history?: unknown } |
| 1053 | if (legacy.history !== undefined) { |
| 1054 | needsCleaning = true |
| 1055 | const { history, ...cleanedConfig } = legacy |
| 1056 | cleanedProjects[path] = cleanedConfig |
| 1057 | } else { |
| 1058 | cleanedProjects[path] = projectConfig |
| 1059 | } |
| 1060 | } |
| 1061 | |
| 1062 | return needsCleaning ? cleanedProjects : projects |
| 1063 | } |
| 1064 | |
| 1065 | // fs.watchFile poll interval for detecting writes from other instances (ms) |
| 1066 | const CONFIG_FRESHNESS_POLL_MS = 1000 |
no test coverage detected