From 92cdef0260b8df36850cd732328b1f528bb33e8a Mon Sep 17 00:00:00 2001 From: steel <mael.acier@ensiie.fr> Date: Thu, 12 Sep 2024 21:39:48 +0200 Subject: [PATCH] node 20 --- README.md | 4 ++-- package.json | 3 ++- pnpm-lock.yaml | 8 ++++++++ renovate.json | 4 +--- src/globals.d.ts | 3 +++ src/lib/data.ts | 7 +++---- 6 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 src/globals.d.ts diff --git a/README.md b/README.md index 157da76..b23fc97 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Ce projet utilise l'**API d'ARISE** et **AriseID Connect** (OIDC / OAuth2). ## Développement local -*Pour une présentation détaillée, lire la section [technologies](#technologies)* +_Pour une présentation détaillée, lire la section [technologies](#technologies)_ Prérequis : [Node](https://nodejs.org/en/download) Optionnel : [nvm (Node Version Manager)](https://github.com/nvm-sh/nvm#installing-and-updating) @@ -43,7 +43,7 @@ pnpm preview ## Technologies -Les pages utilisent le SSR (Server Side Rendering), ce qui implique d'avoir un serveur web pour +Les pages utilisent le SSR (Server Side Rendering), ce qui implique d'avoir un serveur web pour faire le pré-rendu des pages. [NodeJS](https://nodejs.org) est un runtime JavaScript qui est ici utilisé comme serveur web. diff --git a/package.json b/package.json index e0ddcd1..f8e3ea6 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "type": "module", "engines": { - "node": "22.x" + "node": "20.x" }, "packageManager": "pnpm@9.10.0", "scripts": { @@ -45,6 +45,7 @@ "dependencies": { "@arise/aidc-sveltekit": "^0.4.1", "@urql/core": "^5.0.6", + "array-from-async": "^3.0.0", "better-sqlite3": "^11.2.1", "formsnap": "^1.0.1", "gql.tada": "^1.8.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d44a781..b346967 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: '@urql/core': specifier: ^5.0.6 version: 5.0.6(graphql@15.9.0) + array-from-async: + specifier: ^3.0.0 + version: 3.0.0 better-sqlite3: specifier: ^11.2.1 version: 11.2.1 @@ -1021,6 +1024,9 @@ packages: arktype@2.0.0-beta.0: resolution: {integrity: sha512-fE3ssMiXjr/bLqFPzlDhRlXngdyHQreu7p7i8+dtcY1CA+f8WrVUcue6JxywhnqEJXPG4HOcIwQcC+q4VfeUMQ==} + array-from-async@3.0.0: + resolution: {integrity: sha512-gV8/L4y2QB5JTXL9DMdtspGyed2M3V6nMnSN+nNg8ejyUlAAbKAjRS6pfWWINjU/MuFJFMGWPazHPor7hThXQw==} + array-union@2.1.0: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} @@ -3359,6 +3365,8 @@ snapshots: '@ark/util': 0.1.0 optional: true + array-from-async@3.0.0: {} + array-union@2.1.0: {} autoprefixer@10.4.20(postcss@8.4.41): diff --git a/renovate.json b/renovate.json index 5db72dd..22a9943 100644 --- a/renovate.json +++ b/renovate.json @@ -1,6 +1,4 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "config:recommended" - ] + "extends": ["config:recommended"] } diff --git a/src/globals.d.ts b/src/globals.d.ts new file mode 100644 index 0000000..f6ad80b --- /dev/null +++ b/src/globals.d.ts @@ -0,0 +1,3 @@ +declare module "array-from-async" { + export default function <T>(iterable: AsyncIterable<T>): Promise<T[]>; +} diff --git a/src/lib/data.ts b/src/lib/data.ts index b4db74a..7fbe75b 100644 --- a/src/lib/data.ts +++ b/src/lib/data.ts @@ -1,6 +1,7 @@ import { pageIterator } from "$lib/graphql/query"; import { client } from "./graphql"; import { PROMOTION_QUERY, USER_DETAILS_QUERY } from "./graphql/queries"; +import fromAsync from "array-from-async"; type UserId = string; type PromoCache = { @@ -37,7 +38,7 @@ async function cachePromotionImages(year: number) { } async function fetchPromotion(year: number): Promise<PromoCache> { - const array = await Array.fromAsync(pageIterator(PROMOTION_QUERY, { year })); + const array = await fromAsync(pageIterator(PROMOTION_QUERY, { year })); const users = array.map((node) => node.id); return { @@ -73,9 +74,7 @@ export function getPromotionRange( min: number, max = min, ): Promise<Set<UserId>> { - return Array.fromAsync(promotionIterator(min, max)).then( - (array) => new Set(array), - ); + return fromAsync(promotionIterator(min, max)).then((array) => new Set(array)); } setInterval(() => { -- GitLab