jason/nest

Parents de7c7c192848
Children 8397c4461ce6
migration tracker to ignore protocol and track unmigrated pages
--- a/tools/migrate-tracker.js Sat Jan 04 02:19:01 2020 +0000
+++ b/tools/migrate-tracker.js Sun Jan 05 18:17:12 2020 +0000
@@ -42,7 +42,9 @@
.filter(path => !/\.\w+\.md$/.test(path))
.map(path => {
const frontMatter = getFrontMatter(path)
- const replaces = castReplacesDataToArray(frontMatter.replaces)
+ const replaces = castReplacesDataToArray(frontMatter.replaces).map(
+ path => path.replace(/^http(s?):\/\//, '')
+ )
return {
replaces,
@@ -68,6 +70,7 @@
(acc, path) => acc + (covered.has(path) ? 1 : 0),
0
)
+const missing = migrating.filter(path => !covered.has(path))
const percentComplete = ((countOfCovered / migrating.length) * 100).toPrecision(
2
@@ -79,8 +82,16 @@
tracking ${paths.length} pages
${countOfCovered}/${migrating.length} (${percentComplete}%) migrated
${countOfObsolete} obsoleted
+ ${missing.length} missing
`)
+if (process.argv.includes('--write-missing')) {
+ fs.writeFileSync(
+ path.join(__dirname, 'missing-paths.txt'),
+ missing.join('\n')
+ )
+}
+
/*****************************************************************************
* Generate redirection mapping
*****************************************************************************/