(authJson: string)
| 392 | return JSON.stringify(config._auth); |
| 393 | } |
| 394 | return undefined; |
| 395 | } catch { |
| 396 | return undefined; |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | private writeAuthJson(authJson: string): void { |
| 401 | this.ensureFile(); |
| 402 | try { |
| 403 | const raw = fs.readFileSync(this.configPath, "utf-8"); |
| 404 | const config = JSON.parse(raw); |
| 405 | config._auth = JSON.parse(authJson); |
| 406 | fs.writeFileSync(this.configPath, JSON.stringify(config, null, 2), "utf-8"); |
| 407 | } catch { |
| 408 | // If config.json is unreadable, write a minimal file |
| 409 | const config = { _auth: JSON.parse(authJson) }; |
no test coverage detected