(callback: (config: ConfigYaml) => ConfigYaml)
| 263 | } |
| 264 | |
| 265 | function editConfigYaml(callback: (config: ConfigYaml) => ConfigYaml): void { |
| 266 | const configPath = getConfigYamlPath(); |
| 267 | const config = fs.readFileSync(configPath, "utf8"); |
| 268 | let configYaml = YAML.parse(config); |
| 269 | // Check if it's an object |
| 270 | if (typeof configYaml === "object" && configYaml !== null) { |
| 271 | configYaml = callback(configYaml as any) as any; |
| 272 | fs.writeFileSync(configPath, YAML.stringify(configYaml)); |
| 273 | setConfigFilePermissions(configPath); |
| 274 | } else { |
| 275 | console.warn("config.yaml is not a valid object"); |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | export function editConfigFile( |
| 280 | configJsonCallback: ( |
no test coverage detected