chore(bikegear): add scrape-only cache command

This commit is contained in:
MOHAN 2026-07-31 01:19:46 +05:30
parent 6891ebf4bf
commit 78bc7c5140
2 changed files with 26 additions and 0 deletions

View File

@ -7,6 +7,7 @@
"postinstall": "playwright install chromium",
"setup": "playwright install chromium",
"setup:ubuntu": "playwright install --with-deps chromium",
"scrape:bikegear-cache": "node scripts/scrapeBikegearCache.js",
"test:bikegear-proxy": "node scripts/testBikegearProxy.js",
"start": "node server.js",
"dev": "node server.js"

View File

@ -0,0 +1,25 @@
require("dotenv").config();
const bikegear = require("../src/business-logic/import-pipeline/sources/bikegear");
async function main() {
process.env.BIKEGEAR_CACHE_ONLY = "false";
process.env.BIKEGEAR_CACHE_HOURS = "0";
process.env.BIKEGEAR_FETCH_MODE = process.env.BIKEGEAR_FETCH_MODE || "browser";
process.env.BIKEGEAR_REQUEST_DELAY = process.env.BIKEGEAR_REQUEST_DELAY || "5000";
const runPaths = bikegear.paths();
console.log("[BIKEGEAR-CACHE] Starting BikeGear scrape-only run.");
console.log(`[BIKEGEAR-CACHE] Output: ${runPaths.aggregatedJson}`);
const summary = await bikegear.fetchWebsiteData({ paths: runPaths });
const total = summary?.analysis?.totalProductsUnique ?? summary?.analysis?.detailSuccess ?? 0;
console.log(`[BIKEGEAR-CACHE] Done. Cached products: ${total}`);
console.log(`[BIKEGEAR-CACHE] File ready: ${summary.outputJsonPath}`);
}
main().catch((error) => {
process.exitCode = 1;
console.error(`[BIKEGEAR-CACHE] Failed: ${error.message}`);
});