fix(pdf): bundle the branding assets into the app (no fetch at export), export returns its warnings and the editor reports missing elements

This commit is contained in:
bchanot committed 2026-10-11 16:09:39 +02:00
1 parent 80e95ca61d
commit 293a6e0b36
22 files changed
+199 -185

No files matched your search

+2
View File
@@ -27,6 +27,8 @@ export const LEGACY_BASELINE = resolve(
export const FIXTURES_DIR = resolve(REPO_ROOT, 'apps/app/tests/fixtures')
export const GOLDEN_DIR = resolve(FIXTURES_DIR, 'goldens/step6')
export const PUBLIC_DIR = resolve(REPO_ROOT, 'apps/app/public')
/** The logo files the app bundles into its export branding. */
export const BRAND_ASSETS_DIR = resolve(REPO_ROOT, 'apps/app/src/assets/brand')
export function readJson<T = unknown>(path: string): T {
return JSON.parse(readFileSync(path, 'utf8')) as T
+11 -11
View File
@@ -19,7 +19,7 @@ import type {
SheetSnapshot,
} from '@faunosteo/domain'
import { composeHighlightedViewSvg, type Rasterizer } from '../../src'
import { GOLDEN_DIR, PUBLIC_DIR } from './draft'
import { BRAND_ASSETS_DIR, GOLDEN_DIR } from './draft'
/**
* Step 6 Phase 0 goldens, replayed on the engine: the same recorder on
@@ -60,8 +60,8 @@ const PARTNER = {
fallbackText: '@paws.iin.harmony',
}
function publicPng(relative: string): { kind: 'png'; base64: string } {
const bytes = readFileSync(resolve(PUBLIC_DIR, relative))
function brandPng(file: string): { kind: 'png'; base64: string } {
const bytes = readFileSync(resolve(BRAND_ASSETS_DIR, file))
return { kind: 'png', base64: Buffer.from(bytes).toString('base64') }
}
@@ -76,20 +76,20 @@ export function nologosBranding(): Branding {
}
}
/** The four real `public/` files (Phase 0 fetch stub). */
/** The four real logo files the app bundles (served by a fetch stub in Phase 0). */
export function logosBranding(): Branding {
return {
siteUrl: SITE_URL,
headerLogo: publicPng('assets/faunosteo_logo_horizontal-512.png'),
footerLogo: publicPng('assets/faunosteo-horizontal-com-512.png'),
poweredBy: {
logo: publicPng('brand/zenquality-logo-fr.png'),
...POWERED_BY,
},
headerLogo: brandPng('faunosteo-logo-horizontal-512.png'),
footerLogo: brandPng('faunosteo-horizontal-com-512.png'),
poweredBy: { logo: brandPng('zenquality-logo-fr.png'), ...POWERED_BY },
partner: {
logo: {
kind: 'svg',
svg: readFileSync(resolve(PUBLIC_DIR, 'Paws_in_harmony.svg'), 'utf8'),
svg: readFileSync(
resolve(BRAND_ASSETS_DIR, 'paws-in-harmony.svg'),
'utf8',
),
},
...PARTNER,
},