Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(cron): replace require("fs") with ESM renameSync import

Jiang Bohan2129feaf3a6f
diff --git a/src/cron/store.ts b/src/cron/store.ts
index fe4ca903de..c7896a8a22 100644
--- a/src/cron/store.ts
+++ b/src/cron/store.ts
@@ -5,7 +5,7 @@
* Based on OpenClaw's implementation (MIT License)
*/
-import { existsSync, mkdirSync, readFileSync, writeFileSync, appendFileSync } from "fs";
+import { existsSync, mkdirSync, readFileSync, writeFileSync, appendFileSync, renameSync } from "fs";
import path from "path";
import type { CronJob, CronRunLogEntry } from "./types.js";
@@ -98,8 +98,7 @@ export class CronStore {
}
// Rename temp to actual (atomic on most filesystems)
- const fs = require("fs");
- fs.renameSync(tmpPath, this.jobsPath);
+ renameSync(tmpPath, this.jobsPath);
} catch (error) {
console.error("[CronStore] Failed to save jobs:", error);
throw error;