fix: Remove CommonJS require() calls in ES module context

- Fixed 'require is not defined' error in githubJsonService.js
- Imported utimesSync from fs module instead of using require('fs').utimesSync
- Auto-sync now works without ES module errors

The JSON sync now completes successfully without any require() errors.
This commit is contained in:
Michel Roegl-Brunner
2025-10-24 12:46:50 +02:00
parent a6a02a15fe
commit bb4eb2964b

View File

@@ -1,5 +1,5 @@
import { writeFile, mkdir } from 'fs/promises';
import { readFileSync, readdirSync, statSync } from 'fs';
import { readFileSync, readdirSync, statSync, utimesSync } from 'fs';
import { join } from 'path';
export class GitHubJsonService {
@@ -161,7 +161,7 @@ export class GitHubJsonService {
// Update file modification time to match remote
const remoteMtime = new Date(file.updated_at);
require('fs').utimesSync(localPath, remoteMtime, remoteMtime);
utimesSync(localPath, remoteMtime, remoteMtime);
syncedCount++;
syncedFiles.push(file.name);