feat(docs): add mkdocs

This commit is contained in:
Jef LeCompte
2020-12-07 00:18:43 -05:00
parent bc2272e59a
commit 243109a4ff
53 changed files with 1112 additions and 644 deletions
+3 -1
View File
@@ -26,7 +26,9 @@ export const AmazonNl: Store = {
},
{
container: '#outOfStock',
text: ['we weten niet of en wanneer dit item weer op voorraad is']
text: [
'we weten niet of en wanneer dit item weer op voorraad is'
]
}
]
},
+4 -2
View File
@@ -55,13 +55,15 @@ export const Asus: Store = {
],
name: 'asus',
realTimeInventoryLookup: async (itemNumber: string) => {
const request_url = 'https://store.asus.com/us/category/get_real_time_data';
const request_url =
'https://store.asus.com/us/category/get_real_time_data';
const response = await fetch(request_url, {
body: 'sm_seq_list%5B%5D=' + itemNumber,
headers: {
'accept-language': 'en-US,en;q=0.9',
'cache-control': 'no-cache',
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
'content-type':
'application/x-www-form-urlencoded; charset=UTF-8'
},
method: 'POST'
});
+2 -1
View File
@@ -3,7 +3,8 @@ import {Store} from './store';
export const BestBuy: Store = {
labels: {
inStock: {
container: '[data-sticky-media-gallery] .fulfillment-add-to-cart-button',
container:
'[data-sticky-media-gallery] .fulfillment-add-to-cart-button',
text: ['add to cart']
},
maxPrice: {
+4 -2
View File
@@ -59,7 +59,8 @@ export const Computeruniverse: Store = {
brand: 'evga',
model: 'xc3 black',
series: '3070',
url: 'https://www.computeruniverse.net/de/evga-geforce-rtx3070-xc3-black'
url:
'https://www.computeruniverse.net/de/evga-geforce-rtx3070-xc3-black'
},
{
brand: 'gainward',
@@ -142,7 +143,8 @@ export const Computeruniverse: Store = {
brand: 'pny',
model: 'dual fan',
series: '3070',
url: 'https://www.computeruniverse.net/de/pny-geforce-rtx3070-m-dual-8-gb'
url:
'https://www.computeruniverse.net/de/pny-geforce-rtx3070-m-dual-8-gb'
},
{
brand: 'pny',
+2 -1
View File
@@ -8,7 +8,8 @@ export const Currys: Store = {
text: ['add to basket']
},
maxPrice: {
container: '#product-actions span[class*="ProductPriceBlock__Price"]',
container:
'#product-actions span[class*="ProductPriceBlock__Price"]',
euroFormat: false // Note: Currys uses non-euroFromat as price seperator
},
outOfStock: {
+2 -1
View File
@@ -28,7 +28,8 @@ export const Ebuyer: Store = {
brand: 'sony',
model: 'ps5 console',
series: 'sonyps5c',
url: 'https://www.ebuyer.com/1125329-sony-playstation-5-console-cfi-1015a'
url:
'https://www.ebuyer.com/1125329-sony-playstation-5-console-cfi-1015a'
},
{
brand: 'sony',
+2 -1
View File
@@ -12,7 +12,8 @@ export const Elcorteingles: Store = {
// },
inStock: [
{
container: '.product_detail-purchase.mb-2.c12 .js-add-cart-text',
container:
'.product_detail-purchase.mb-2.c12 .js-add-cart-text',
text: ['a la cesta']
}
],
+4 -2
View File
@@ -10,7 +10,8 @@ export const Expert: Store = {
}
],
maxPrice: {
container: '.widget-Container-subContent .widget-ArticlePrice-price',
container:
'.widget-Container-subContent .widget-ArticlePrice-price',
euroFormat: false
},
outOfStock: [
@@ -30,7 +31,8 @@ export const Expert: Store = {
brand: 'test:brand',
model: 'test:model',
series: 'test:series',
url: 'https://www.expert.de/shop/11364114744-ps4-pro-1tb-jet-black.html'
url:
'https://www.expert.de/shop/11364114744-ps4-pro-1tb-jet-black.html'
},
{
brand: 'sony',
+2 -1
View File
@@ -33,7 +33,8 @@ export const Game: Store = {
brand: 'sony',
model: 'ps5 digital',
series: 'sonyps5de',
url: 'https://www.game.co.uk/en/playstation-5-digital-edition-2826341'
url:
'https://www.game.co.uk/en/playstation-5-digital-edition-2826341'
}
],
name: 'game'
+4 -1
View File
@@ -38,7 +38,10 @@ export async function processBackoffDelay(
if (!isBackoff) {
if (backoff.count > 0) {
backoff.count--;
backoff.time = Math.max(backoff.time / 2, config.browser.minBackoff);
backoff.time = Math.max(
backoff.time / 2,
config.browser.minBackoff
);
}
return -1;
+3 -1
View File
@@ -23,7 +23,9 @@ export function getProductLinksBuilder(options: LinksBuilderOptions) {
const links: Link[] = [];
for (let i = 0; i < productElements.length; i++) {
const productElement = productElements.eq(i);
const titleElement = productElement.find(options.titleSelector).first();
const titleElement = productElement
.find(options.titleSelector)
.first();
const title = options.titleAttribute
? titleElement.attr()?.[options.titleAttribute]
+14 -5
View File
@@ -62,7 +62,9 @@ export class NvidiaCart {
public async addToCard(productId: number, name: string): Promise<string> {
let cartUrl: string | undefined;
logger.info(`🚀🚀🚀 [nvidia] ${name}, starting auto add to cart 🚀🚀🚀`);
logger.info(
`🚀🚀🚀 [nvidia] ${name}, starting auto add to cart 🚀🚀🚀`
);
try {
logger.info(`🚀🚀🚀 [nvidia] ${name}, adding to cart 🚀🚀🚀`);
let lastError: Error | string | undefined;
@@ -70,7 +72,9 @@ export class NvidiaCart {
/* eslint-disable no-await-in-loop */
for (let i = 0; i < config.nvidia.addToCardAttempts; i++) {
try {
cartUrl = await this.addToCartAndGetLocationRedirect(productId);
cartUrl = await this.addToCartAndGetLocationRedirect(
productId
);
break;
} catch (error: unknown) {
@@ -92,7 +96,9 @@ export class NvidiaCart {
throw lastError;
}
logger.info(`🚀🚀🚀 [nvidia] ${name}, opening checkout page 🚀🚀🚀`);
logger.info(
`🚀🚀🚀 [nvidia] ${name}, opening checkout page 🚀🚀🚀`
);
logger.info(cartUrl);
await open(cartUrl);
@@ -129,7 +135,9 @@ export class NvidiaCart {
this.browser,
this.sessionUrl,
async (response) => {
return response?.json() as NvidiaSessionTokenJSON | undefined;
return response?.json() as
| NvidiaSessionTokenJSON
| undefined;
}
);
if (
@@ -154,7 +162,8 @@ export class NvidiaCart {
protected async addToCartAndGetLocationRedirect(
productId: number
): Promise<string> {
const url = 'https://api-prod.nvidia.com/direct-sales-shop/DR/add-to-cart';
const url =
'https://api-prod.nvidia.com/direct-sales-shop/DR/add-to-cart';
const sessionToken = await this.getSessionToken();
logger.info(` [nvidia] session_token=${sessionToken}`);
+4 -1
View File
@@ -67,7 +67,10 @@ export function generateLinks(): Link[] {
links.push({
brand: 'test:brand',
model: 'test:model',
openCartAction: generateOpenCartAction(fe2060SuperId, 'TEST CARD debug'),
openCartAction: generateOpenCartAction(
fe2060SuperId,
'TEST CARD debug'
),
series: 'test:series',
url: nvidiaStockUrl(fe2060SuperId, drLocale, currency)
});
+6 -2
View File
@@ -208,7 +208,9 @@ function printConfig() {
}
if (config.store.showOnlyBrands.length > 0) {
logger.info(` selected brands: ${config.store.showOnlyBrands.join(', ')}`);
logger.info(
` selected brands: ${config.store.showOnlyBrands.join(', ')}`
);
}
if (config.store.showOnlyModels.length > 0) {
@@ -224,7 +226,9 @@ function printConfig() {
}
if (config.store.showOnlySeries.length > 0) {
logger.info(` selected series: ${config.store.showOnlySeries.join(', ')}`);
logger.info(
` selected series: ${config.store.showOnlySeries.join(', ')}`
);
}
}
+2 -1
View File
@@ -12,7 +12,8 @@ export const NeweggCa: Store = {
text: ['add to cart']
},
maxPrice: {
container: 'div#app div.product-price > ul > li.price-current > strong',
container:
'div#app div.product-price > ul > li.price-current > strong',
euroFormat: false
}
},
+2 -1
View File
@@ -271,7 +271,8 @@ export const Notebooksbilliger: Store = {
brand: 'amd',
model: '5800x',
series: 'ryzen5800',
url: 'https://www.notebooksbilliger.de/amd+ryzen+ryzen+7+5800x+cpu+684018'
url:
'https://www.notebooksbilliger.de/amd+ryzen+ryzen+7+5800x+cpu+684018'
},
{
brand: 'amd',
+2 -1
View File
@@ -28,7 +28,8 @@ export const Nvidia: Store = {
brand: 'test:brand',
model: 'test:model',
series: 'test:series',
url: 'https://www.nvidia.com/en-us/geforce/graphics-cards/rtx-2060-super/'
url:
'https://www.nvidia.com/en-us/geforce/graphics-cards/rtx-2060-super/'
},
{
brand: 'nvidia',
+3 -1
View File
@@ -15,7 +15,9 @@ export const Otto: Store = {
},
outOfStock: {
container: 'div.p_message.p_message--hint > strong',
text: ['Deinen gewünschten Artikel können wir leider nicht mehr liefern']
text: [
'Deinen gewünschten Artikel können wir leider nicht mehr liefern'
]
}
},
links: [
+4 -2
View File
@@ -41,7 +41,8 @@ export const PCComponentes: Store = {
brand: 'asus',
model: 'tuf',
series: '3080',
url: 'https://www.pccomponentes.com/asus-tuf-geforce-rtx-3080-10gb-gddr6x'
url:
'https://www.pccomponentes.com/asus-tuf-geforce-rtx-3080-10gb-gddr6x'
},
{
brand: 'gigabyte',
@@ -246,7 +247,8 @@ export const PCComponentes: Store = {
brand: 'asus',
model: 'dual',
series: '3070',
url: 'https://www.pccomponentes.com/asus-geforce-rtx-3070-dual-8gb-gddr6'
url:
'https://www.pccomponentes.com/asus-geforce-rtx-3070-dual-8gb-gddr6'
},
{
brand: 'asus',
+6 -2
View File
@@ -32,13 +32,17 @@ export const Very: Store = {
const links: Link[] = [];
for (let i = 0; i < productElements.length; i++) {
const productElement = productElements.eq(i);
const titleElement = productElement.find('.productTitle').first();
const titleElement = productElement
.find('.productTitle')
.first();
const title = titleElement.text()?.replace(/\n/g, ' ').trim();
if (
!title ||
['RTX', series]
.map((x) => title.toLowerCase().includes(x.toLowerCase()))
.map((x) =>
title.toLowerCase().includes(x.toLowerCase())
)
.filter((x) => !x).length > 0
) {
continue;
+8 -4
View File
@@ -23,25 +23,29 @@ export const VsGamers: Store = {
brand: 'amd',
model: '5600x',
series: 'ryzen5600',
url: 'https://www.vsgamers.es/product/procesador-amd-ryzen-5-5600x-37-ghz'
url:
'https://www.vsgamers.es/product/procesador-amd-ryzen-5-5600x-37-ghz'
},
{
brand: 'amd',
model: '5800x',
series: 'ryzen5800',
url: 'https://www.vsgamers.es/product/procesador-amd-ryzen-7-5800x-38-ghz'
url:
'https://www.vsgamers.es/product/procesador-amd-ryzen-7-5800x-38-ghz'
},
{
brand: 'amd',
model: '5900x',
series: 'ryzen5900',
url: 'https://www.vsgamers.es/product/procesador-amd-ryzen-9-5900x-37-ghz'
url:
'https://www.vsgamers.es/product/procesador-amd-ryzen-9-5900x-37-ghz'
},
{
brand: 'amd',
model: '5950x',
series: 'ryzen5950',
url: 'https://www.vsgamers.es/product/procesador-amd-ryzen-9-5950x-34-ghz'
url:
'https://www.vsgamers.es/product/procesador-amd-ryzen-9-5950x-34-ghz'
},
{
brand: 'zotac',
+2 -1
View File
@@ -3,7 +3,8 @@ import {Store} from './store';
export const Walmart: Store = {
labels: {
inStock: {
container: '.button.spin-button.prod-ProductCTA--primary.button--primary',
container:
'.button.spin-button.prod-ProductCTA--primary.button--primary',
text: ['add to cart']
},
maxPrice: {
+2 -1
View File
@@ -20,7 +20,8 @@ export const Wipoid: Store = {
brand: 'test:brand',
model: 'test:model',
series: 'test:series',
url: 'https://www.wipoid.com/pny-geforce-rtx-1650-dual-fan-4gb-gddr6.html'
url:
'https://www.wipoid.com/pny-geforce-rtx-1650-dual-fan-4gb-gddr6.html'
},
{
brand: 'gigabyte',