From c13649f8f33cba2c81277870e5d85ba3adb1d9ce Mon Sep 17 00:00:00 2001 From: Emile Rolley Date: Wed, 13 Nov 2024 16:45:27 +0100 Subject: [PATCH] pkg: upgrade @betagouv/aides-velo --- package-lock.json | 8 ++++---- package.json | 2 +- retrofit/routes/api/ville/+server.js | 4 ++-- src/lib/engine.ts | 3 +-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 477b712..87019c8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "hasInstallScript": true, "dependencies": { - "@betagouv/aides-velo": "^0.1.0", + "@betagouv/aides-velo": "^0.2.0", "@etalab/decoupage-administratif": "^4.0.0", "fuzzysort": "^2.0.4", "jsdom": "^23.0.1", @@ -97,9 +97,9 @@ } }, "node_modules/@betagouv/aides-velo": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@betagouv/aides-velo/-/aides-velo-0.1.0.tgz", - "integrity": "sha512-3ZTg6RbSAVCf8z4Rl5KQKE0Cv8Nv3sA3ZIH602Z7heEtEN3Cbg384voZVDIgSjjcgbu640viGqk9jwzDV24nzg==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@betagouv/aides-velo/-/aides-velo-0.2.0.tgz", + "integrity": "sha512-7I2VH/qzSwKQJCcr9nnP13sUl8ggJzuM57Msj9+azJxw3eljxNNsl5setk6er9Wg+S78alWMNZgTH0yhfTCYbw==", "license": "Apache-2.0", "dependencies": { "publicodes": "^1.5.1" diff --git a/package.json b/package.json index b6bdaa1..824d459 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "yaml": "^2.3.4" }, "dependencies": { - "@betagouv/aides-velo": "^0.1.0", + "@betagouv/aides-velo": "^0.2.0", "@etalab/decoupage-administratif": "^4.0.0", "fuzzysort": "^2.0.4", "jsdom": "^23.0.1", diff --git a/retrofit/routes/api/ville/+server.js b/retrofit/routes/api/ville/+server.js index 84ad53b..cc434d9 100644 --- a/retrofit/routes/api/ville/+server.js +++ b/retrofit/routes/api/ville/+server.js @@ -1,10 +1,10 @@ -import { data } from '@betagouv/aides-velo'; import { error } from '@sveltejs/kit'; +import communes from '$lib/data/communes.json'; import { rawCityToFullLocalisation } from '$lib/utils'; export function GET({ url }) { const slug = url.searchParams.get('slug'); - const ville = data.communes.find((v) => v.slug === slug); + const ville = communes.find((v) => v.slug === slug); if (!ville) { error(404); } diff --git a/src/lib/engine.ts b/src/lib/engine.ts index caa9c1d..4838f2f 100644 --- a/src/lib/engine.ts +++ b/src/lib/engine.ts @@ -1,5 +1,4 @@ import Engine, { type Situation } from 'publicodes'; -import { rules as aidesVelo } from '@betagouv/aides-velo'; // @ts-ignore import aidesRetrofit from '$lib/../../retrofit/aides.yaml'; import { IS_RETROFIT } from './env'; @@ -7,7 +6,7 @@ import { aidesVeloEngine } from './aides-velo-utils'; export const engine: Engine = IS_RETROFIT ? new Engine(aidesRetrofit) - : aidesVeloEngine?.getEngine() ?? new Engine(aidesVelo); + : aidesVeloEngine?.getEngine(); export function getEngine(situation: Situation): Engine { const engineBis = engine.shallowCopy();