All files / adapters/standalone/src frontend-path.ts

100% Statements 7/7
100% Branches 6/6
100% Functions 1/1
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27                          6x 6x 1x       5x 5x 2x     3x    
/**
 * Frontend build path resolution for standalone mode.
 */
 
import { existsSync } from 'fs';
import { join } from 'path';
 
/**
 * Find the frontend build directory.
 * Checks FRONTEND_PATH env var first, then the default monorepo location.
 */
export function findFrontendBuildDir(rootPath: string): string | undefined {
  // Environment variable override
  const envPath = process.env.FRONTEND_PATH;
  if (envPath && existsSync(join(envPath, 'index.html'))) {
    return envPath;
  }
 
  // Default monorepo location
  const defaultPath = join(rootPath, 'packages', 'frontend', 'build');
  if (existsSync(join(defaultPath, 'index.html'))) {
    return defaultPath;
  }
 
  return undefined;
}