()
| 378 | if (!fs.existsSync(dir)) { |
| 379 | fs.mkdirSync(dir, { recursive: true }); |
| 380 | } |
| 381 | if (!fs.existsSync(this.configPath)) { |
| 382 | fs.writeFileSync(this.configPath, "{}", "utf-8"); |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | private readAuthJson(): string | undefined { |
| 387 | this.ensureFile(); |
| 388 | try { |
| 389 | const raw = fs.readFileSync(this.configPath, "utf-8"); |
| 390 | const config = JSON.parse(raw); |
| 391 | if (config._auth && typeof config._auth === "object") { |
| 392 | return JSON.stringify(config._auth); |
| 393 | } |
| 394 | return undefined; |
| 395 | } catch { |
no test coverage detected