* Read version history from JSON file
()
| 150 | * Read version history from JSON file |
| 151 | */ |
| 152 | function readVersionHistory(): VersionHistory { |
| 153 | const historyPath = path.join(process.cwd(), 'version-history.json'); |
| 154 | if (fs.existsSync(historyPath)) { |
| 155 | try { |
| 156 | const jsonData = fs.readFileSync(historyPath, 'utf8'); |
| 157 | return JSON.parse(jsonData) as VersionHistory; |
| 158 | } catch (error) { |
| 159 | console.error('Error reading version history:', error instanceof Error ? error.message : 'Unknown error'); |
| 160 | return { versions: [] }; |
| 161 | } |
| 162 | } else { |
| 163 | console.log('version-history.json not found, creating a new file'); |
| 164 | return { versions: [] }; |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * Save version history to JSON file |
no outgoing calls
no test coverage detected