feat(image): complete reviewed generation delivery
Memind CI / Test, build, and release guards (pull_request) Successful in 2m47s
Memind CI / Test, build, and release guards (pull_request) Successful in 2m47s
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
export const RUN_PUBLIC_HTML_LOOKBACK_MS = 0;
|
||||
|
||||
export function listRecentlyModifiedPublicHtmlRelativePaths(
|
||||
publishDir,
|
||||
{ sinceMs = null, lookbackMs = RUN_PUBLIC_HTML_LOOKBACK_MS } = {},
|
||||
) {
|
||||
const startedAt = Number(sinceMs);
|
||||
if (!Number.isFinite(startedAt) || startedAt <= 0) return [];
|
||||
|
||||
const publicDir = path.join(path.resolve(String(publishDir ?? '')), 'public');
|
||||
if (!fs.existsSync(publicDir) || !fs.statSync(publicDir).isDirectory()) return [];
|
||||
|
||||
const cutoff = Math.max(0, startedAt - Math.max(0, Number(lookbackMs) || 0));
|
||||
return fs.readdirSync(publicDir)
|
||||
.filter((name) => name.toLowerCase().endsWith('.html'))
|
||||
.filter((name) => {
|
||||
try {
|
||||
return fs.statSync(path.join(publicDir, name)).mtimeMs >= cutoff;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.map((name) => `public/${name}`)
|
||||
.sort();
|
||||
}
|
||||
Reference in New Issue
Block a user