From 96efe2b326b23b622bc46625dd6cf6c1080c3e35 Mon Sep 17 00:00:00 2001 From: Emmanuel Raviart <emmanuel@raviart.com> Date: Tue, 19 Oct 2021 00:07:44 +0200 Subject: [PATCH] Use variables files in @openfisca/france-json package instead of openFiscaDir. --- .gitignore | 1 - .prettierignore | 1 - src/lib/auditors/config.ts | 1 - src/lib/server/config.ts | 2 -- src/routes/variables/[variable]/index.json.ts | 8 +++----- 5 files changed, 3 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index ebc7c7a15..b2e8eafe3 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ node_modules !/example.env /.svelte-kit /build/ -/src/lib/openfisca diff --git a/.prettierignore b/.prettierignore index 5421174f8..7dde8a0ae 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,4 @@ .svelte-kit/** build/** node_modules/** -src/lib/openfisca/** static/** diff --git a/src/lib/auditors/config.ts b/src/lib/auditors/config.ts index 841b00e8c..d82225854 100644 --- a/src/lib/auditors/config.ts +++ b/src/lib/auditors/config.ts @@ -68,7 +68,6 @@ export function auditConfig( for (const key of [ "childrenKey", "familyEntityKey", - "openfiscaDir", "simulationsDir", "title", ]) { diff --git a/src/lib/server/config.ts b/src/lib/server/config.ts index 528817291..aa87f97ae 100644 --- a/src/lib/server/config.ts +++ b/src/lib/server/config.ts @@ -26,7 +26,6 @@ export interface Config { jwtSecret: string profileUrl: string } - openfiscaDir: string openfiscaRepository: { branch: string group: string @@ -70,7 +69,6 @@ const [validConfig, error] = validateConfig({ profileUrl: process.env["OAUTH2_PROFILE_URL"], } : null, - openfiscaDir: "src/lib/openfisca", openfiscaRepository: { branch: process.env["OPENFISCA_BRANCH"], group: process.env["OPENFISCA_GROUP"], diff --git a/src/routes/variables/[variable]/index.json.ts b/src/routes/variables/[variable]/index.json.ts index 8a897082b..50f7c387b 100644 --- a/src/routes/variables/[variable]/index.json.ts +++ b/src/routes/variables/[variable]/index.json.ts @@ -3,14 +3,12 @@ import fs from "fs-extra" import path from "path" import sanitizeFilename from "sanitize-filename" -import config from "$lib/server/config" - -const { openfiscaDir } = config - export const get: RequestHandler = async ({ params }) => { const { variable: name } = params const variableFilePath = path.join( - openfiscaDir, + "node_modules", + "@openfisca", + "france-json", "variables", `${sanitizeFilename(name)}.json`, ) -- GitLab