corregir types + ci types

This commit is contained in:
Cat /dev/Nulo 2024-01-04 19:56:18 -03:00
parent 6a29ed257d
commit 92e814b13a
6 changed files with 12 additions and 6 deletions

View file

@ -10,7 +10,7 @@ env:
jobs: jobs:
check: check:
name: chequear typescript del sitio name: chequear typescript
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -20,6 +20,10 @@ jobs:
working-directory: ./sitio working-directory: ./sitio
- run: bun check - run: bun check
working-directory: ./sitio working-directory: ./sitio
- run: bun install
working-directory: ./scraper
- run: bun check
working-directory: ./scraper
build-and-push-scraper: build-and-push-scraper:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View file

@ -5,8 +5,7 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"build:container": "podman build -t gitea.nulo.in/nulo/preciazo/scraper -f ./Containerfile ..", "check": "tsc"
"push:container": "bun build:container && podman push gitea.nulo.in/nulo/preciazo/scraper"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",

View file

@ -21,7 +21,7 @@ function parseJsonLds(dom: Window): object[] {
const scripts = dom.window.document.querySelectorAll( const scripts = dom.window.document.querySelectorAll(
'script[type="application/ld+json"]' '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 { function findJsonLd(dom: Window, type: string): object | undefined {
return parseJsonLds(dom).find((x) => "@type" in x && x["@type"] === type); return parseJsonLds(dom).find((x) => "@type" in x && x["@type"] === type);

View file

@ -1,3 +1,4 @@
/// <reference lib="dom" />
import * as schema from "db-datos/schema.js"; import * as schema from "db-datos/schema.js";
import { writeFile, mkdir } from "fs/promises"; import { writeFile, mkdir } from "fs/promises";
import { createHash } from "crypto"; import { createHash } from "crypto";

View file

@ -1,3 +1,4 @@
{ {
"extends": "../tsconfig.json" "extends": "../tsconfig.json",
"exclude": ["../sitio"]
} }

View file

@ -15,5 +15,6 @@
"noEmit": true, "noEmit": true,
"forceConsistentCasingInFileNames": true "forceConsistentCasingInFileNames": true
}, },
"include": ["**/*.ts", "**/*.js"] "include": ["**/*.ts", "**/*.js"],
"exclude": ["sitio/build"]
} }