]> git.r.bdr.sh - rbdr/blog/blobdiff - lib/archivers/gemlog.js
Lint
[rbdr/blog] / lib / archivers / gemlog.js
index d56a1f6d4c647f45609f34118d943aa24743b1a8..1bb0c10d6d31740c930c09e29436018c0abc142a 100644 (file)
@@ -11,22 +11,26 @@ const internals = {
   debuglog: debuglog('blog'),
 
   buildUrl(id, slug) {
+
     return `./${id}/${slug}`;
   },
 
-  buildTitle (id, slug) {
+  buildTitle(id, slug) {
+
     const date = new Date(Number(id));
-    const shortDate = date.toISOString().split('T')[0]
+    const shortDate = date.toISOString().split('T')[0];
     const title = slug.split('-').join(' ');
-    return `${shortDate} ${title}`
+    return `${shortDate} ${title}`;
   },
 
   buildLink(id, slug) {
+
     return `=> ${internals.buildUrl(id,slug)} ${internals.buildTitle(id,slug)}`;
   }
 };
 
-export default async function(templateDirectory, source, target) {
+export default async function (templateDirectory, source, target) {
+
   internals.debuglog(`Reading archive ${source}`);
   const postIds = (await readdir(source))
     .sort((a, b) => Number(b) - Number(a));
@@ -34,10 +38,10 @@ export default async function(templateDirectory, source, target) {
   for (const id of postIds) {
     const postDirectory = join(source, id);
     const slug = (await readdir(postDirectory))
-        .filter((entry) => internals.kGeminiRe.test(entry))[0];
+      .filter((entry) => internals.kGeminiRe.test(entry))[0];
 
-      posts.push({ id, slug })
-  };
+    posts.push({ id, slug });
+  }
 
   internals.debuglog(`Read ${posts.length} posts`);
 
@@ -52,7 +56,7 @@ export default async function(templateDirectory, source, target) {
     ...Dot.templateSettings,
     strip: false
   })({
-    posts: posts.map((post) => internals.buildLink(post.id, post.slug)).join('\n'),
+    posts: posts.map((post) => internals.buildLink(post.id, post.slug)).join('\n')
   });
 
   try {
@@ -68,4 +72,4 @@ export default async function(templateDirectory, source, target) {
     internals.debuglog('Copying posts to archive');
     await cp(source, target, { recursive: true });
   }
-};
+}