mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 05:17:35 +00:00
chore: update dependencies (#874)
Additional linting fixes Signed-off-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
Generated
+874
-711
File diff suppressed because it is too large
Load Diff
+5
-5
@@ -42,11 +42,11 @@
|
|||||||
"play-sound": "^1.1.3",
|
"play-sound": "^1.1.3",
|
||||||
"puppeteer": "^5.5.0",
|
"puppeteer": "^5.5.0",
|
||||||
"puppeteer-extra": "^3.1.15",
|
"puppeteer-extra": "^3.1.15",
|
||||||
"puppeteer-extra-plugin-adblocker": "^2.11.8",
|
"puppeteer-extra-plugin-adblocker": "^2.11.9",
|
||||||
"puppeteer-extra-plugin-block-resources": "^2.2.7",
|
"puppeteer-extra-plugin-block-resources": "^2.2.7",
|
||||||
"puppeteer-extra-plugin-stealth": "^2.6.5",
|
"puppeteer-extra-plugin-stealth": "^2.6.5",
|
||||||
"pushover-notifications": "^1.2.2",
|
"pushover-notifications": "^1.2.2",
|
||||||
"twilio": "^3.51.0",
|
"twilio": "^3.52.0",
|
||||||
"twitch": "^4.3.0",
|
"twitch": "^4.3.0",
|
||||||
"twitch-auth": "^4.3.0",
|
"twitch-auth": "^4.3.0",
|
||||||
"twitch-chat-client": "^4.3.0",
|
"twitch-chat-client": "^4.3.0",
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/async": "^3.2.4",
|
"@types/async": "^3.2.4",
|
||||||
"@types/cheerio": "^0.22.22",
|
"@types/cheerio": "^0.22.22",
|
||||||
"@types/node": "^14.14.8",
|
"@types/node": "^14.14.9",
|
||||||
"@types/node-fetch": "^2.5.7",
|
"@types/node-fetch": "^2.5.7",
|
||||||
"@types/node-notifier": "^8.0.0",
|
"@types/node-notifier": "^8.0.0",
|
||||||
"@types/nodemailer": "^6.4.0",
|
"@types/nodemailer": "^6.4.0",
|
||||||
@@ -65,9 +65,9 @@
|
|||||||
"husky": "^4.3.0",
|
"husky": "^4.3.0",
|
||||||
"nodemon": "^2.0.6",
|
"nodemon": "^2.0.6",
|
||||||
"ts-node": "^9.0.0",
|
"ts-node": "^9.0.0",
|
||||||
"typescript": "^4.0.5",
|
"typescript": "^4.1.2",
|
||||||
"webpack": "^5.6.0",
|
"webpack": "^5.6.0",
|
||||||
"xo": "^0.33.1"
|
"xo": "^0.35.0"
|
||||||
},
|
},
|
||||||
"xo": {
|
"xo": {
|
||||||
"prettier": true,
|
"prettier": true,
|
||||||
|
|||||||
+1
-1
@@ -94,7 +94,7 @@ async function stopAndExit() {
|
|||||||
async function loopMain() {
|
async function loopMain() {
|
||||||
try {
|
try {
|
||||||
await main();
|
await main();
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
logger.error(
|
logger.error(
|
||||||
'✖ something bad happened, resetting streetmerchant in 5 seconds',
|
'✖ something bad happened, resetting streetmerchant in 5 seconds',
|
||||||
error
|
error
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export function sendDiscordMessage(link: Link, store: Store) {
|
|||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
|
|
||||||
logger.info('✔ discord message sent');
|
logger.info('✔ discord message sent');
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
logger.error("✖ couldn't send discord message", error);
|
logger.error("✖ couldn't send discord message", error);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export function sendMqttMessage(link: Link, store: Store) {
|
|||||||
try {
|
try {
|
||||||
client.publish(topic, message, pubOptions);
|
client.publish(topic, message, pubOptions);
|
||||||
logger.info('✔ mqtt message sent');
|
logger.info('✔ mqtt message sent');
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
logger.error("✖ couldn't send mqtt message", error);
|
logger.error("✖ couldn't send mqtt message", error);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -60,9 +60,10 @@ const adjustLightsWithAPI = (hueBridge: Api) => {
|
|||||||
.then((allLights: any[]) => {
|
.then((allLights: any[]) => {
|
||||||
allLights.forEach((light: any) => {
|
allLights.forEach((light: any) => {
|
||||||
logger.debug('adjusting specified lights');
|
logger.debug('adjusting specified lights');
|
||||||
(hueBridge.lights.setLightState(light, lightState) as Promise<
|
(hueBridge.lights.setLightState(
|
||||||
any
|
light,
|
||||||
>).catch((error: Error) => {
|
lightState
|
||||||
|
) as Promise<any>).catch((error: Error) => {
|
||||||
logger.error('Failed to adjust specified lights.');
|
logger.error('Failed to adjust specified lights.');
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export function sendSlackMessage(link: Link, store: Store) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.info('✔ slack message sent');
|
logger.info('✔ slack message sent');
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
logger.error("✖ couldn't send slack message", error);
|
logger.error("✖ couldn't send slack message", error);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export function sendTelegramMessage(link: Link, store: Store) {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
logger.info('✔ telegram message sent');
|
logger.info('✔ telegram message sent');
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
logger.error("✖ couldn't send telegram message", error);
|
logger.error("✖ couldn't send telegram message", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export function sendTwilioMessage(link: Link, store: Store) {
|
|||||||
to: twilio.to
|
to: twilio.to
|
||||||
});
|
});
|
||||||
logger.info('✔ twilio message sent');
|
logger.info('✔ twilio message sent');
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
logger.error("✖ couldn't send twilio message", error);
|
logger.error("✖ couldn't send twilio message", error);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ chatClient.onJoin((channel: string, user: string) => {
|
|||||||
try {
|
try {
|
||||||
chatClient.say(channel, message);
|
chatClient.say(channel, message);
|
||||||
logger.info('✔ twitch message sent');
|
logger.info('✔ twitch message sent');
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
logger.error("✖ couldn't send twitch message", error);
|
logger.error("✖ couldn't send twitch message", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ export async function extractPageContents(
|
|||||||
selector: Selector
|
selector: Selector
|
||||||
): Promise<string | null> {
|
): Promise<string | null> {
|
||||||
return page.evaluate((options: Selector) => {
|
return page.evaluate((options: Selector) => {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
const element: globalThis.HTMLElement | null = document.querySelector(
|
const element: globalThis.HTMLElement | null = document.querySelector(
|
||||||
options.selector
|
options.selector
|
||||||
);
|
);
|
||||||
|
|||||||
+9
-11
@@ -57,7 +57,7 @@ async function lookup(browser: Browser, store: Store) {
|
|||||||
if (store.disableAdBlocker) {
|
if (store.disableAdBlocker) {
|
||||||
try {
|
try {
|
||||||
await disableBlockerInPage(page);
|
await disableBlockerInPage(page);
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,10 +66,10 @@ async function lookup(browser: Browser, store: Store) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
statusCode = await lookupCard(browser, store, page, link);
|
statusCode = await lookupCard(browser, store, page, link);
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
logger.error(
|
logger.error(
|
||||||
`✖ [${store.name}] ${link.brand} ${link.series} ${link.model} - ${
|
`✖ [${store.name}] ${link.brand} ${link.series} ${link.model} - ${
|
||||||
error.message as string
|
(error as Error).message
|
||||||
}`
|
}`
|
||||||
);
|
);
|
||||||
const client = await page.target().createCDPSession();
|
const client = await page.target().createCDPSession();
|
||||||
@@ -122,11 +122,9 @@ async function lookupCard(
|
|||||||
logger.info(`${Print.inStock(link, store, true)}\n${givenUrl}`);
|
logger.info(`${Print.inStock(link, store, true)}\n${givenUrl}`);
|
||||||
|
|
||||||
if (config.browser.open) {
|
if (config.browser.open) {
|
||||||
if (link.openCartAction === undefined) {
|
await (link.openCartAction === undefined
|
||||||
await open(givenUrl);
|
? open(givenUrl)
|
||||||
} else {
|
: link.openCartAction(browser));
|
||||||
await link.openCartAction(browser);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sendNotification(link, store);
|
sendNotification(link, store);
|
||||||
@@ -232,8 +230,8 @@ export async function tryLookupAndLoop(browser: Browser, store: Store) {
|
|||||||
try {
|
try {
|
||||||
await fetchLinks(store, browser);
|
await fetchLinks(store, browser);
|
||||||
linkBuilderLastRunTimes[store.name] = Date.now();
|
linkBuilderLastRunTimes[store.name] = Date.now();
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
logger.error(error.message);
|
logger.error((error as Error).message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,7 +239,7 @@ export async function tryLookupAndLoop(browser: Browser, store: Store) {
|
|||||||
logger.debug(`[${store.name}] Starting lookup...`);
|
logger.debug(`[${store.name}] Starting lookup...`);
|
||||||
try {
|
try {
|
||||||
await lookup(browser, store);
|
await lookup(browser, store);
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,13 +24,10 @@ export function getProductLinksBuilder(options: LinksBuilderOptions) {
|
|||||||
for (let i = 0; i < productElements.length; i++) {
|
for (let i = 0; i < productElements.length; i++) {
|
||||||
const productElement = productElements.eq(i);
|
const productElement = productElements.eq(i);
|
||||||
const titleElement = productElement.find(options.titleSelector).first();
|
const titleElement = productElement.find(options.titleSelector).first();
|
||||||
let title: string;
|
|
||||||
|
|
||||||
if (options.titleAttribute) {
|
const title = options.titleAttribute
|
||||||
title = titleElement.attr()?.[options.titleAttribute];
|
? titleElement.attr()?.[options.titleAttribute]
|
||||||
} else {
|
: titleElement.text()?.replace(/\n/g, ' ').trim();
|
||||||
title = titleElement.text()?.replace(/\n/g, ' ').trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!title) {
|
if (!title) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export class NvidiaCart {
|
|||||||
cartUrl = await this.addToCartAndGetLocationRedirect(productId);
|
cartUrl = await this.addToCartAndGetLocationRedirect(productId);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
logger.error(
|
logger.error(
|
||||||
`✖ [nvidia] ${name} could not automatically add to cart, attempt ${
|
`✖ [nvidia] ${name} could not automatically add to cart, attempt ${
|
||||||
i + 1
|
i + 1
|
||||||
@@ -82,7 +82,7 @@ export class NvidiaCart {
|
|||||||
);
|
);
|
||||||
logger.debug(error);
|
logger.debug(error);
|
||||||
|
|
||||||
lastError = error;
|
lastError = error as Error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* eslint-enable no-await-in-loop */
|
/* eslint-enable no-await-in-loop */
|
||||||
@@ -96,11 +96,11 @@ export class NvidiaCart {
|
|||||||
logger.info(cartUrl);
|
logger.info(cartUrl);
|
||||||
|
|
||||||
await open(cartUrl);
|
await open(cartUrl);
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
logger.error(
|
logger.error(
|
||||||
`✖ [nvidia] ${name} could not automatically add to cart, opening page`
|
`✖ [nvidia] ${name} could not automatically add to cart, opening page`,
|
||||||
|
error
|
||||||
);
|
);
|
||||||
logger.debug(error);
|
|
||||||
|
|
||||||
cartUrl = this.fallbackCartUrl;
|
cartUrl = this.fallbackCartUrl;
|
||||||
|
|
||||||
@@ -142,8 +142,11 @@ export class NvidiaCart {
|
|||||||
|
|
||||||
this.sessionToken = result.session_token;
|
this.sessionToken = result.session_token;
|
||||||
logger.debug(`ℹ [nvidia] session_token=${result.session_token}`);
|
logger.debug(`ℹ [nvidia] session_token=${result.session_token}`);
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
const message: string = typeof error === 'object' ? error.message : error;
|
const message: string =
|
||||||
|
typeof error === 'object'
|
||||||
|
? (error as Error).message
|
||||||
|
: (error as string);
|
||||||
logger.error(`✖ [nvidia] ${message}`);
|
logger.error(`✖ [nvidia] ${message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-3
@@ -4,9 +4,7 @@ declare module 'play-sound' {
|
|||||||
player?: string;
|
player?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PlayOptions {
|
export type PlayOptions = Record<string, any>;
|
||||||
[key: string]: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface PlaySound {
|
export interface PlaySound {
|
||||||
player: string;
|
player: string;
|
||||||
|
|||||||
Vendored
+6
-6
@@ -1,5 +1,5 @@
|
|||||||
declare module '@jef/pushbullet' {
|
declare module '@jef/pushbullet' {
|
||||||
export type DeviceParams = string | number | Record<string, any>;
|
export type DeviceParameters = string | number | Record<string, any>;
|
||||||
|
|
||||||
export type PushBulletCallback =
|
export type PushBulletCallback =
|
||||||
| ((error: Error) => void)
|
| ((error: Error) => void)
|
||||||
@@ -38,26 +38,26 @@ declare module '@jef/pushbullet' {
|
|||||||
);
|
);
|
||||||
deleteDevice(deviceIden: string, callback: PushBulletCallback);
|
deleteDevice(deviceIden: string, callback: PushBulletCallback);
|
||||||
note(
|
note(
|
||||||
deviceParams: DeviceParams,
|
deviceParameters: DeviceParameters,
|
||||||
title: string,
|
title: string,
|
||||||
body: string,
|
body: string,
|
||||||
callback: PushBulletCallback
|
callback: PushBulletCallback
|
||||||
);
|
);
|
||||||
link(
|
link(
|
||||||
deviceParams: DeviceParams,
|
deviceParameters: DeviceParameters,
|
||||||
name: string,
|
name: string,
|
||||||
url: string,
|
url: string,
|
||||||
body: string,
|
body: string,
|
||||||
callback: PushBulletCallback
|
callback: PushBulletCallback
|
||||||
);
|
);
|
||||||
file(
|
file(
|
||||||
deviceParams: DeviceParams,
|
deviceParameters: DeviceParameters,
|
||||||
filePath: string,
|
filePath: string,
|
||||||
message: string,
|
message: string,
|
||||||
callback: PushBulletCallback
|
callback: PushBulletCallback
|
||||||
);
|
);
|
||||||
dismissPush(pushIden: DeviceParams, callback: PushBulletCallback);
|
dismissPush(pushIden: DeviceParameters, callback: PushBulletCallback);
|
||||||
deletePush(pushIden: DeviceParams, callback: PushBulletCallback);
|
deletePush(pushIden: DeviceParameters, callback: PushBulletCallback);
|
||||||
deleteAllPushes(callback: PushBulletCallback);
|
deleteAllPushes(callback: PushBulletCallback);
|
||||||
history(options: HistoryOptions, callback: PushBulletCallback);
|
history(options: HistoryOptions, callback: PushBulletCallback);
|
||||||
history(callback: PushBulletCallback);
|
history(callback: PushBulletCallback);
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ export async function usingPage<T>(
|
|||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
await closePage(page);
|
await closePage(page);
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -13,7 +13,7 @@ import {join, normalize} from 'path';
|
|||||||
const approot = join(__dirname, '../../');
|
const approot = join(__dirname, '../../');
|
||||||
const webroot = join(approot, './web');
|
const webroot = join(approot, './web');
|
||||||
|
|
||||||
const contentTypeMap: {[key: string]: string} = {
|
const contentTypeMap: Record<string, string> = {
|
||||||
css: 'text/css',
|
css: 'text/css',
|
||||||
htm: 'text/html',
|
htm: 'text/html',
|
||||||
html: 'text/html',
|
html: 'text/html',
|
||||||
@@ -49,8 +49,8 @@ function sendFile(
|
|||||||
|
|
||||||
stream.on('end', () => response.end());
|
stream.on('end', () => response.end());
|
||||||
stream.pipe(response);
|
stream.pipe(response);
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
sendError(response, error);
|
sendError(response, (error as Error).message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,6 +182,6 @@ export async function stopAPIServer() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve();
|
resolve(null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user