teqo-backup/scripts/lib/campaignKitAssets.mjs
Francisco Solla b02a0ef236 feat(C203): gráficos do Instagram na marca e paleta oficiais do kit 1313
- rodapé com jorge-solla-positivo.png (data URI, frame 286×90) no lugar do lockup tipográfico; renderer fail-closed sem a marca
- paleta oficial: destaque/valência boa #e4102f, sinal de marca #184e92; amarelo/verde só nos ativos
- dono único da leitura do kit (scripts/lib/campaignKitAssets.mjs; root por import.meta.url) reusado pelo reel
- lineChart default alinhado ao vermelho oficial; CHART_COLORS/dossiê intactos
- skill/command e pinos de prosa/teste atualizados; SCRIPTS_SPEC_PINNED + impl plan + changelog
2026-09-19 10:55:30 -03:00

31 lines
1.2 KiB
JavaScript

/**
* Official campaign kit assets (C196/C203): reads the committed PNGs under
* `public/campaign-kit` as data URIs, so every local renderer embeds the brand
* without network access. The default root resolves from this module (never
* the cwd): the chart entry runs from temp dirs in the tests and the e2e.
*/
import { readFile } from 'node:fs/promises'
import { dirname, join, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
const KIT_ASSETS = {
namePositive: 'jorge-solla-positivo.png',
nameNegative: 'jorge-solla-negativo.png',
completePositive: 'marca-positiva-completa.png',
completeNegative: 'marca-negativa-completa.png',
star: 'estrela.png',
}
const defaultRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..')
/** Official campaign kit marks as data URIs (committed under `public/campaign-kit`). */
export const readKitAssets = async ({ root = defaultRoot } = {}) => {
const entries = await Promise.all(
Object.entries(KIT_ASSETS).map(async ([key, file]) => {
const bytes = await readFile(resolve(root, 'public/campaign-kit', file))
return [key, `data:image/png;base64,${bytes.toString('base64')}`]
}),
)
return Object.fromEntries(entries)
}