--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/migrate-tracker.js Thu Jan 17 19:54:21 2019 +0000
@@ -0,0 +1,75 @@
+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); +const mdRegex = /\.md$/; +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)); + items.push(...nueveau); + } else if (stat.isFile() && mdRegex.test(item)) { +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("/mnt/c/Users/J/code/pidgin-nest/content", "") + .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`