From 48d9499f1bb3fec953c7f94ac9016127e02efc75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Bryxi=CC=81?= Date: Fri, 16 Aug 2019 23:42:24 +0100 Subject: [PATCH] make import scripts more stable --- lib/import.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/import.js b/lib/import.js index 41543c00..93f43ba4 100644 --- a/lib/import.js +++ b/lib/import.js @@ -11,6 +11,10 @@ function ensureFolder(dir) { } } +function dump(data) { + return safeDump(data, { skipInvalid: true }); +} + module.exports = { name: 'empress-blog:import', description: 'Imports data from other blog systems', @@ -38,7 +42,7 @@ module.exports = { data.tags.forEach((tag) => { writeFileSync(`tag/${tag.id}.md`, `--- -${safeDump({ +${dump({ name: tag.name, image: '', })}--- @@ -51,7 +55,7 @@ ${tag.description}`) data.authors.forEach((author) => { writeFileSync(`author/${author.id}.md`, `--- -${safeDump({ +${dump({ name: author.name, id: author.id, image: author.image, @@ -70,7 +74,7 @@ ${author.bio}`) data.content.forEach((content) => { writeFileSync(`content/${content.id}.md`, `--- -${safeDump({ +${dump({ title: content.title, image: content.image, authors: content.authors,