Fable clean up

This commit is contained in:
Andras Schmelczer 2026-06-11 21:35:45 +01:00
parent 3441a7e4af
commit 4ce8a4f41d
46 changed files with 642 additions and 911 deletions

View file

@ -1,5 +1,6 @@
import { readdir, readFile, stat } from 'node:fs/promises';
import { readFile, stat } from 'node:fs/promises';
import path from 'node:path';
import { walk } from './lib/walk.mjs';
const forbidden = String.fromCodePoint(0x2014);
const root = process.cwd();
@ -37,25 +38,6 @@ async function exists(filePath) {
}
}
async function walk(entryPath) {
const entryStat = await stat(entryPath);
if (entryStat.isFile()) return [entryPath];
const entries = await readdir(entryPath, { withFileTypes: true });
const files = [];
for (const entry of entries) {
const fullPath = path.join(entryPath, entry.name);
if (entry.isDirectory()) {
files.push(...(await walk(fullPath)));
} else if (entry.isFile()) {
files.push(fullPath);
}
}
return files;
}
function lineAndColumn(text, index) {
const before = text.slice(0, index);
const lines = before.split('\n');