Snippet format update

To match the starter (for the migration)
This commit is contained in:
Angelos Chalaris
2019-08-13 10:29:12 +03:00
parent a5164f392a
commit 611729214a
381 changed files with 1951 additions and 1989 deletions

24
migrator.js Normal file
View File

@ -0,0 +1,24 @@
const snippets = require('./snippet_data/snippets.json');
const fs = require('fs-extra');
const path = require('path');
snippets.data.forEach(snippet => {
fs.writeFileSync(
path.join(
snippet.meta.archived ? './snippets_archive' : './snippets',
`${snippet.attributes.fileName}`),
`---
title: ${snippet.id}
tags: ${snippet.attributes.tags.join(',')}
---
${snippet.attributes.text}
\`\`\`js
${snippet.attributes.codeBlocks.es6}
\`\`\`
\`\`\`js
${snippet.attributes.codeBlocks.example}
\`\`\``);
});