Fix issues and add linting

This commit is contained in:
khalid@traclabs.com
2026-04-22 22:44:03 -05:00
parent 498d873c47
commit bcd047bc54
21 changed files with 10634 additions and 134 deletions

View File

@@ -34,7 +34,12 @@ export function writeContentFile(
const existing = fs.readFileSync(absPath, 'utf-8');
beforeHash = fileHash(existing);
const backupDir = path.join(REPO_ROOT, 'content', '.backups', repoRelativePath);
// Derive a clean backup subdirectory name from the repo-relative path.
// e.g. "content/sections/hero.json" → "sections/hero" (strip leading content/ and .json)
const stripped = repoRelativePath
.replace(/^content\//, '')
.replace(/\.json$/, '');
const backupDir = path.join(REPO_ROOT, 'content', '.backups', stripped);
ensureDir(backupDir);
const ts = new Date().toISOString().replace(/[:.]/g, '-');
fs.copyFileSync(absPath, path.join(backupDir, `${ts}.json`));