const fs = require('fs'); // const showdown = require('showdown'); const cheerio = require('cheerio'); // const Parcel = require('parcel-bundler'); const dayjs = require('dayjs'); const metaData = require('./data/2018-06-06T17.54.30-fetched_repo_data.json'); process.env.NODE_ENV = 'production'; process.on('unhandledRejection', error => { console.log('unhandledRejection', error.message); }); // const table = 'data/table.md'; const templateHTML = 'website/table.tmpl.html'; // const merged = 'website/table.html'; const destination = 'website/table.html'; const valueNames = [ 'name', 'description', 'homepage', 'star', 'updated', 'language', 'license', 'author', ]; const icons = { C: '', Go: '', Ruby: '', CSS: '', 'C#': '', 'C++': '', Clojure: '', 'Emacs Lisp': '', Groovy: '', Haskell: '', HTML: '', Java: '', JavaScript: '', Lua: '', Makefile: '', Nginx: '', Perl: '', PHP: '', Python: '', Roff: '', Rust: '', Scala: '', Shell: '', Vue: '', XSLT: '', }; const getLastUpdate = updated => { const updt = Number(dayjs(updated).diff(dayjs(), 'days')); if (updt < 0) { if (Math.abs(updt) === 1) return `1 day ago`; return `${Math.abs(updt)} days ago`; } else if (updt === 0) return 'today'; return updated; }; const formatEntry = ( { name, html_url: repoURL, description, homepage, stargazers_count: stargazers, updated_at: updated, language, license, owner, }, i, ) => [ `
${description || '-'}
`, ` `, (homepage && `🔗 website`) || '', ` `, (language && `${icons[language] || '💻'}${language}
`) || '', (license && `📃 ${ license.name }`) || '', owner && `Made by
${owner.login}`, '