export function writeCleanResources()

in tools/cleaner.ts [182:196]


export function writeCleanResources(): void {
	/* Crawl the tree and write files for all cleaned up resources */
	const root = getRoot();
	const resourceFiles = getAllFiles(root, []);
	const markdownResources = parseFrontmatter(resourceFiles);
	const cleanedResources = cleanAllResources(markdownResources);

	Object.entries(cleanedResources).forEach(([filePath, markdown]) => {
		const pattern = /\n+$/; // Matches one or more newline characters at the end of the string
		const replacement = "\n"; // Replace with a single newline character

		const m = markdown.replace(pattern, replacement);
		fs.writeFileSync(filePath, m, { flag: "w+" });
	});
}