const fs = require("fs"); const path = require("path"); const front = require("front-matter"); .readFileSync(path.join(__dirname, "paths.txt"), "utf8") const covered = new Set(); function getFront(path) { const data = fs.readFileSync(path, "utf8"); const { attributes } = front(data); function getMdPaths(input) { let items = fs.readdirSync(input).map(i => path.join(input, i)); const item = items.pop(); const stat = fs.statSync(item); if (stat.isDirectory()) { const nueveau = fs.readdirSync(item).map(i => path.join(item, i)); } else if (stat.isFile() && mdRegex.test(item)) { const filepath = (__dirname.replace(/\/tools(\/)?$/, "/content")) getMdPaths(path.join(__dirname, "../content/")) let replaces = getFront(path).replaces; } else if (typeof replaces === "string") { } else if (!Array.isArray(replaces)) { `expected replaces of ${path} to be falsey, string or an array` .replace(/_index(\.\w\w)?$/, "") .forEach(page => page.replaces.forEach(path => covered.add(path))); const countOfCovered = paths.reduce( (acc, path) => acc + (covered.has(path) ? 1 : 0), `Currently there are ${countOfCovered} of ${paths.length} pages covered`