mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-02 19:17:23 +00:00
chore: Enable linting in scripts.
This commit is contained in:
@@ -27,7 +27,9 @@ const statMtime = (filePath) => {
|
||||
|
||||
const isExcludedSource = (filePath) => {
|
||||
const relativePath = path.relative(srcRoot, filePath);
|
||||
if (relativePath.startsWith("..")) return false;
|
||||
if (relativePath.startsWith("..")) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
relativePath.endsWith(".test.ts") ||
|
||||
relativePath.endsWith(".test.tsx") ||
|
||||
@@ -40,7 +42,9 @@ const findLatestMtime = (dirPath, shouldSkip) => {
|
||||
const queue = [dirPath];
|
||||
while (queue.length > 0) {
|
||||
const current = queue.pop();
|
||||
if (!current) continue;
|
||||
if (!current) {
|
||||
continue;
|
||||
}
|
||||
let entries = [];
|
||||
try {
|
||||
entries = fs.readdirSync(current, { withFileTypes: true });
|
||||
@@ -53,10 +57,16 @@ const findLatestMtime = (dirPath, shouldSkip) => {
|
||||
queue.push(fullPath);
|
||||
continue;
|
||||
}
|
||||
if (!entry.isFile()) continue;
|
||||
if (shouldSkip?.(fullPath)) continue;
|
||||
if (!entry.isFile()) {
|
||||
continue;
|
||||
}
|
||||
if (shouldSkip?.(fullPath)) {
|
||||
continue;
|
||||
}
|
||||
const mtime = statMtime(fullPath);
|
||||
if (mtime == null) continue;
|
||||
if (mtime == null) {
|
||||
continue;
|
||||
}
|
||||
if (latest == null || mtime > latest) {
|
||||
latest = mtime;
|
||||
}
|
||||
@@ -66,23 +76,35 @@ const findLatestMtime = (dirPath, shouldSkip) => {
|
||||
};
|
||||
|
||||
const shouldBuild = () => {
|
||||
if (env.OPENCLAW_FORCE_BUILD === "1") return true;
|
||||
if (env.OPENCLAW_FORCE_BUILD === "1") {
|
||||
return true;
|
||||
}
|
||||
const stampMtime = statMtime(buildStampPath);
|
||||
if (stampMtime == null) return true;
|
||||
if (statMtime(distEntry) == null) return true;
|
||||
if (stampMtime == null) {
|
||||
return true;
|
||||
}
|
||||
if (statMtime(distEntry) == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const filePath of configFiles) {
|
||||
const mtime = statMtime(filePath);
|
||||
if (mtime != null && mtime > stampMtime) return true;
|
||||
if (mtime != null && mtime > stampMtime) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
const srcMtime = findLatestMtime(srcRoot, isExcludedSource);
|
||||
if (srcMtime != null && srcMtime > stampMtime) return true;
|
||||
if (srcMtime != null && srcMtime > stampMtime) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const logRunner = (message) => {
|
||||
if (env.OPENCLAW_RUNNER_LOG === "0") return;
|
||||
if (env.OPENCLAW_RUNNER_LOG === "0") {
|
||||
return;
|
||||
}
|
||||
process.stderr.write(`[openclaw] ${message}\n`);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user