From 92e814b13ae4e73b217bb023a2484b18a9d18162 Mon Sep 17 00:00:00 2001 From: Nulo Date: Thu, 4 Jan 2024 19:56:18 -0300 Subject: [PATCH] corregir types + ci types --- .github/workflows/container.yml | 6 +++++- scraper/package.json | 3 +-- scraper/parsers/common.ts | 2 +- scraper/scrap.ts | 1 + scraper/tsconfig.json | 3 ++- tsconfig.json | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 9d5a36e..208c673 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -10,7 +10,7 @@ env: jobs: check: - name: chequear typescript del sitio + name: chequear typescript runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -20,6 +20,10 @@ jobs: working-directory: ./sitio - run: bun check working-directory: ./sitio + - run: bun install + working-directory: ./scraper + - run: bun check + working-directory: ./scraper build-and-push-scraper: runs-on: ubuntu-latest diff --git a/scraper/package.json b/scraper/package.json index edaf0ca..3fb8c34 100644 --- a/scraper/package.json +++ b/scraper/package.json @@ -5,8 +5,7 @@ "description": "", "main": "index.js", "scripts": { - "build:container": "podman build -t gitea.nulo.in/nulo/preciazo/scraper -f ./Containerfile ..", - "push:container": "bun build:container && podman push gitea.nulo.in/nulo/preciazo/scraper" + "check": "tsc" }, "keywords": [], "author": "", diff --git a/scraper/parsers/common.ts b/scraper/parsers/common.ts index a4a2a99..34804aa 100644 --- a/scraper/parsers/common.ts +++ b/scraper/parsers/common.ts @@ -21,7 +21,7 @@ function parseJsonLds(dom: Window): object[] { const scripts = dom.window.document.querySelectorAll( 'script[type="application/ld+json"]' ); - return [...scripts].map((scripts) => JSON.parse(scripts.innerHTML)); + return Array.from(scripts, (script) => JSON.parse(script.innerHTML)); } function findJsonLd(dom: Window, type: string): object | undefined { return parseJsonLds(dom).find((x) => "@type" in x && x["@type"] === type); diff --git a/scraper/scrap.ts b/scraper/scrap.ts index 195d424..d8acc55 100644 --- a/scraper/scrap.ts +++ b/scraper/scrap.ts @@ -1,3 +1,4 @@ +/// import * as schema from "db-datos/schema.js"; import { writeFile, mkdir } from "fs/promises"; import { createHash } from "crypto"; diff --git a/scraper/tsconfig.json b/scraper/tsconfig.json index 3c43903..18a0a92 100644 --- a/scraper/tsconfig.json +++ b/scraper/tsconfig.json @@ -1,3 +1,4 @@ { - "extends": "../tsconfig.json" + "extends": "../tsconfig.json", + "exclude": ["../sitio"] } diff --git a/tsconfig.json b/tsconfig.json index d975f54..3a51a30 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,5 +15,6 @@ "noEmit": true, "forceConsistentCasingInFileNames": true }, - "include": ["**/*.ts", "**/*.js"] + "include": ["**/*.ts", "**/*.js"], + "exclude": ["sitio/build"] }