From 2f712e24c9815ad6bf65f4c18cbe578afe8441e0 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 25 Mar 2025 20:10:01 -0700 Subject: [PATCH] Add ENV type checking. --- .env.production | 7 ++----- src/env.d.ts | 10 ++++++++++ tsconfig.node.json | 2 +- tsconfig.web.json | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 src/env.d.ts diff --git a/.env.production b/.env.production index 5723d54..d300fbc 100644 --- a/.env.production +++ b/.env.production @@ -1,5 +1,2 @@ -KEY=123 # not available -MAIN_VITE_KEY=123 # only main process available -PRELOAD_VITE_KEY=123 # only preload scripts available -RENDERER_VITE_KEY=123 # only renderers available -VITE_KEY=123 # all available \ No newline at end of file +VITE_FIREBASE_CONFIG={"apiKey":"AIzaSyDSezy-jGJreo7ulgpLdlpOwAOrgcaEkhU","authDomain":"imex-prod.firebaseapp.com","databaseURL":"https://imex-prod.firebaseio.com","projectId":"imex-prod","storageBucket":"imex-prod.appspot.com","messagingSenderId":"253497221485","appId":"1:253497221485:web:3c81c483b94db84b227a64","measurementId":"G-NTWBKG2L0M"} +VITE_GRAPHQL_ENDPOINT=https://db.dev.imex.online/v1/graphql \ No newline at end of file diff --git a/src/env.d.ts b/src/env.d.ts new file mode 100644 index 0000000..33cf21d --- /dev/null +++ b/src/env.d.ts @@ -0,0 +1,10 @@ +/// + +export interface ImportMetaEnv { + readonly VITE_FIREBASE_CONFIG: string; + readonly VITE_GRAPHQL_ENDPOINT: string; +} + +export interface ImportMeta { + readonly env: ImportMetaEnv; +} diff --git a/tsconfig.node.json b/tsconfig.node.json index cc233a3..d7105fc 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -12,6 +12,6 @@ "compilerOptions": { "resolveJsonModule": true, "composite": true, - "types": ["electron-vite/node"] + "types": ["electron-vite/node", "vite/client"] } } diff --git a/tsconfig.web.json b/tsconfig.web.json index d3e4739..e46e2d2 100644 --- a/tsconfig.web.json +++ b/tsconfig.web.json @@ -12,6 +12,7 @@ "composite": true, "jsx": "react-jsx", "baseUrl": ".", + "types": ["vite/client"], "paths": { "@renderer/*": ["src/renderer/src/*"] }