* Write settings combined with current settings. On failure log a warning. * Settings will be merged shallowly.
(settings: Partial<T>)
| 31 | * Settings will be merged shallowly. |
| 32 | */ |
| 33 | public async write(settings: Partial<T>): Promise<void> { |
| 34 | try { |
| 35 | const oldSettings = await this.read() |
| 36 | const nextSettings = { ...oldSettings, ...settings } |
| 37 | await fs.writeFile(this.settingsPath, JSON.stringify(nextSettings, null, 2)) |
| 38 | } catch (error: any) { |
| 39 | logger.warn(error.message) |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | export interface UpdateSettings { |
no test coverage detected