MCPcopy Create free account
hub / github.com/AntonPalmqvist/physically-based-api / updateDatabaseVersion

Function updateDatabaseVersion

scripts/pre-commit.mjs:15–26  ·  view source on GitHub ↗
(filePath)

Source from the content-addressed store, hash-verified

13}
14
15async 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)
29async function main() {

Callers 1

mainFunction · 0.85

Calls 1

getCurrentDateAsNumberFunction · 0.85

Tested by

no test coverage detected