(filePath)
| 13 | } |
| 14 | |
| 15 | async function updateDatabaseVersion(filePath) { |
| 16 | try { |
| 17 | let data = await readFile(filePath, "utf8"); |
| 18 | const newVersion = getCurrentDateAsNumber(); |
| 19 | data = data.replace(/"updated":\s*\d+,/, `"updated": ${newVersion},`); |
| 20 | await writeFile(filePath, data, "utf8"); |
| 21 | console.log(`Updated database version in ${filePath}`); |
| 22 | } catch (err) { |
| 23 | console.error(`Error updating ${filePath}:`, err); |
| 24 | process.exit(1); |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | // Only process files passed as arguments (from lint-staged) |
| 29 | async function main() { |
no test coverage detected