chore: refactor config and fix audits (#406)

This commit is contained in:
Jef LeCompte
2020-10-03 13:15:39 -04:00
committed by GitHub
parent f006a8595b
commit 8098a31092
28 changed files with 1765 additions and 403 deletions
+6 -6
View File
@@ -1,5 +1,5 @@
import {Link, Series, Store} from './model';
import {Logger, Print} from '../logger';
import {Print, logger} from '../logger';
import {Browser} from 'puppeteer';
import cheerio from 'cheerio';
import {filterSeries} from './filter';
@@ -7,7 +7,7 @@ import {usingResponse} from '../util';
function addNewLinks(store: Store, links: Link[], series: Series) {
if (links.length === 0) {
Logger.error(Print.message('NO STORE LINKS FOUND', series, store, true));
logger.error(Print.message('NO STORE LINKS FOUND', series, store, true));
return;
}
@@ -19,8 +19,8 @@ function addNewLinks(store: Store, links: Link[], series: Series) {
return;
}
Logger.info(Print.message(`FOUND ${newLinks.length} STORE LINKS`, series, store, true));
Logger.debug(JSON.stringify(newLinks, null, 2));
logger.info(Print.message(`FOUND ${newLinks.length} STORE LINKS`, series, store, true));
logger.debug(JSON.stringify(newLinks, null, 2));
store.links = store.links.concat(newLinks);
}
@@ -37,13 +37,13 @@ export async function fetchLinks(store: Store, browser: Browser) {
continue;
}
Logger.info(Print.message('DETECTING STORE LINKS', series, store, true));
logger.info(Print.message('DETECTING STORE LINKS', series, store, true));
promises.push(usingResponse(browser, url, async response => {
const text = await response?.text();
if (!text) {
Logger.error(Print.message('NO RESPONSE', series, store, true));
logger.error(Print.message('NO RESPONSE', series, store, true));
return;
}