()
| 117 | } |
| 118 | |
| 119 | async clear() { |
| 120 | try { |
| 121 | this.store = {}; |
| 122 | this.updatedStore = {}; |
| 123 | // Delete the state file entirely to avoid corrupted/partial JSON issues |
| 124 | if (await fsOperation(this.storeUrl).exists()) { |
| 125 | try { |
| 126 | await fsOperation(this.storeUrl).delete(); |
| 127 | } catch (delErr) { |
| 128 | console.error( |
| 129 | "InstallState: Failed to delete state file during clear:", |
| 130 | delErr, |
| 131 | ); |
| 132 | // As a fallback, overwrite with a valid empty JSON |
| 133 | await fsOperation(this.storeUrl).writeFile("{}"); |
| 134 | } |
| 135 | } |
| 136 | } catch (error) { |
| 137 | console.error("Failed to clear install state:", error); |
| 138 | } |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | /** |
no test coverage detected