From 6653ab14d31e821d6133b205186892c6df43573f Mon Sep 17 00:00:00 2001 From: ivan-aksamentov Date: Tue, 30 Aug 2022 19:36:21 +0200 Subject: [PATCH] chore: remove unused files --- scripts/renderPageHtml.js | 33 ----------------- scripts/renderPathogenHtml.js | 63 --------------------------------- views/components/plausible.jade | 8 ----- views/pathogens.jade | 12 ------- 4 files changed, 116 deletions(-) delete mode 100644 scripts/renderPageHtml.js delete mode 100644 scripts/renderPathogenHtml.js delete mode 100644 views/components/plausible.jade delete mode 100644 views/pathogens.jade diff --git a/scripts/renderPageHtml.js b/scripts/renderPageHtml.js deleted file mode 100644 index 9c5e4f6..0000000 --- a/scripts/renderPageHtml.js +++ /dev/null @@ -1,33 +0,0 @@ -const dotenv = require('dotenv') -const jade = require('jade') -const fs = require('fs') -const util = require('util') - -dotenv.config() - -const writeFile = util.promisify(fs.writeFile) - -const PLAUSIBLE_IO_DOMAIN = process.env.PLAUSIBLE_IO_DOMAIN - -async function renderPageHtml(page) { - const html = jade.renderFile(`views/${page}.jade`, { - pretty: true, - PLAUSIBLE_IO_DOMAIN - }) - return writeFile(`public/${page}.html`, html) -} - -async function main() { - return Promise.all([ - '404', - 'compare', - 'download', - 'gridstack', - 'index', - 'pipeline', - 'tutorial', - ].map((page) => renderPageHtml(page))) -} - -main().catch(console.error) - diff --git a/scripts/renderPathogenHtml.js b/scripts/renderPathogenHtml.js deleted file mode 100644 index 7c577ed..0000000 --- a/scripts/renderPathogenHtml.js +++ /dev/null @@ -1,63 +0,0 @@ -const dotenv = require('dotenv') -const fetch = require('node-fetch') -const fs = require('fs') -const jade = require('jade') -const util = require('util') - -dotenv.config() - -const DATA_ROOT_URL = process.env.DATA_ROOT_URL -if(!DATA_ROOT_URL) { - throw new Error('Environment variable \'DATA_ROOT_URL\' needs to be set') -} - -const PLAUSIBLE_IO_DOMAIN = process.env.PLAUSIBLE_IO_DOMAIN - -const readFile = util.promisify(fs.readFile) -const writeFile = util.promisify(fs.writeFile) - -async function renderPathogenHtml(pathogen) { - const html = jade.renderFile('views/pathogen_template.jade', { - pretty: true, - ...pathogen, - DATA_ROOT_URL, - PLAUSIBLE_IO_DOMAIN, - }) - return writeFile(`public/${pathogen.pathogenName}.html`, html) -} - -function renderPathogenList(pathogens) { - const html = jade.renderFile('views/pathogens.jade', { - pretty: true, - pathogens - }) - return writeFile(`public/pathogens.html`, html) -} - -async function getIndexJson(indexJsonPathOrUrl) { - if(indexJsonPathOrUrl.startsWith('http')) { - const res = await fetch(indexJsonPathOrUrl) - return await res.text() - } - else { - return readFile(indexJsonPathOrUrl, 'utf8') - } -} - -function getIndexPathOrUrl() { - const indexJsonPathOrUrl = process.argv[2] - if(indexJsonPathOrUrl) { - return indexJsonPathOrUrl - } - return `${DATA_ROOT_URL}/index.json` -} - -async function main() { - const indexJsonPathOrUrl = getIndexPathOrUrl() - const indexJsonStr = await getIndexJson(indexJsonPathOrUrl) - const indexJson = JSON.parse(indexJsonStr) - return Promise.all([renderPathogenList(indexJson.datasets), ...(indexJson.datasets.map((pathogen) => renderPathogenHtml(pathogen)))]) -} - -main().catch(console.error) - diff --git a/views/components/plausible.jade b/views/components/plausible.jade deleted file mode 100644 index af6ce07..0000000 --- a/views/components/plausible.jade +++ /dev/null @@ -1,8 +0,0 @@ -// Plausible.io analytics (https://plausible.io/) - -script( - id="plausible", - defer, - data-domain="#{PLAUSIBLE_IO_DOMAIN}", - src="https://plausible.io/js/script.hash.outbound-links.file-downloads.compat.js" -) diff --git a/views/pathogens.jade b/views/pathogens.jade deleted file mode 100644 index 9dfde96..0000000 --- a/views/pathogens.jade +++ /dev/null @@ -1,12 +0,0 @@ -html - head - block head - meta(charset='utf-8') - meta(name='viewport', content='width=device-width, initial-scale=1.0') - body - block body - a(href="/") Home - ul(style={ columnns: 5, '-webkit-columns': 5, '-moz-columns': 5 }) - each pathogen in pathogens - li - a(href="/#{pathogen.pathogenName}") #{pathogen.pathogenName}