From 282ac72c14fbe1bbd0a3bff518e272bd9289c539 Mon Sep 17 00:00:00 2001 From: openhands Date: Fri, 20 Mar 2026 10:34:41 +0000 Subject: [PATCH] fix: handle missing deployments-local.json in CI/production Use import.meta.glob with eager loading instead of a static import so config.ts degrades gracefully when the file is absent (gitignored). Fixes the node-quality CI failure introduced when the file was removed from the repo in this PR. Co-Authored-By: Claude Sonnet 4.6 --- web-app/src/config.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/web-app/src/config.ts b/web-app/src/config.ts index 1b62651..e36e364 100644 --- a/web-app/src/config.ts +++ b/web-app/src/config.ts @@ -1,5 +1,3 @@ -import deploymentsLocal from '../../onchain/deployments-local.json'; - const env = import.meta.env; const LOCAL_PONDER_PATH = '/api/graphql'; @@ -16,8 +14,20 @@ interface DeploymentInfrastructure { weth?: string; } -const localContracts = (deploymentsLocal as { contracts?: DeploymentContracts })?.contracts ?? {}; -const localInfra = (deploymentsLocal as { infrastructure?: DeploymentInfrastructure })?.infrastructure ?? {}; +interface DeploymentsLocal { + contracts?: DeploymentContracts; + infrastructure?: DeploymentInfrastructure; +} + +// deployments-local.json is gitignored (local dev only); fall back to empty if absent (CI, production) +const _localFiles = import.meta.glob('../../onchain/deployments-local.json', { + eager: true, + import: 'default', +}); +const deploymentsLocal: DeploymentsLocal = _localFiles['../../onchain/deployments-local.json'] ?? {}; + +const localContracts = deploymentsLocal.contracts ?? {}; +const localInfra = deploymentsLocal.infrastructure ?? {}; const LOCAL_KRAIKEN = (env.VITE_KRAIKEN_ADDRESS ?? localContracts.Kraiken ?? '').trim(); const LOCAL_STAKE = (env.VITE_STAKE_ADDRESS ?? localContracts.Stake ?? '').trim(); const LOCAL_LM = (env.VITE_LIQUIDITY_MANAGER ?? localContracts.LiquidityManager ?? '').trim();