@koda-sl/baker-cli 0.281.2-dev.1f1c09c80 → 0.281.3-dev.1f1c09c80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -33278,6 +33278,17 @@ async function readBrandFromWorkspace(root = ".") {
33278
33278
  function svgIsLiveText(svg) {
33279
33279
  return /<text[\s>]/i.test(svg);
33280
33280
  }
33281
+ async function markDirectoryIsReal(dir) {
33282
+ const files = await readdir8(dir).catch(() => null);
33283
+ if (!files) return false;
33284
+ const marks = files.filter((f) => /\.(svg|png|webp)$/i.test(f));
33285
+ if (marks.length === 0) return false;
33286
+ for (const f of marks.filter((f2) => /\.svg$/i.test(f2))) {
33287
+ const svg = await readFile15(path22.join(dir, f), "utf-8").catch(() => null);
33288
+ if (svg === null || svgIsLiveText(svg)) return false;
33289
+ }
33290
+ return true;
33291
+ }
33281
33292
 
33282
33293
  // src/commands/canvas/composition-path.ts
33283
33294
  import { existsSync as existsSync4 } from "fs";
@@ -33478,13 +33489,25 @@ var scaffoldAdCommand = defineCommand105({
33478
33489
  error: {
33479
33490
  code: "VALIDATION_ERROR",
33480
33491
  message: `The mark at \`${resolvedLogo}\` draws its wordmark with live \`<text>\`, not outlines. That is a typed stand-in, not a logo: it renders in whatever font the machine happens to have, and the one that shipped this way came out reading "greenle\xE1" in every frame.`,
33481
- fix: `Ask the client for their real logo file and put it in \`${BRAND_DIR}/logos/\` \u2014 an outlined SVG, or a PNG at 1000px or wider. Do not redraw it.`
33492
+ fix: `Ask the client for their real logo file and put it in \`${BRAND_DIR}/logos/\` \u2014 the one their designer delivered, as an outlined SVG or a PNG they gave you. Do not redraw it, and do not export this file to PNG: rasterising it only bakes the invented letters into pixels, where nothing downstream can tell they are wrong.`
33482
33493
  }
33483
33494
  });
33484
33495
  process.exit(1);
33485
33496
  return;
33486
33497
  }
33487
33498
  }
33499
+ if (resolvedLogo && !await markDirectoryIsReal(path24.dirname(resolvedLogo))) {
33500
+ writeJson({
33501
+ ok: false,
33502
+ error: {
33503
+ code: "VALIDATION_ERROR",
33504
+ message: `There is no real logo in \`${BRAND_DIR}/logos/\` \u2014 what is there is a typed stand-in, whose wordmark is drawn as live text in a font the renderer does not have. An ad built on it wears letters the machine invented, and converting it to a PNG only bakes them in.`,
33505
+ fix: `Ask the client for their actual logo file and put it in \`${BRAND_DIR}/logos/\` \u2014 the one their designer delivered, as an outlined SVG or a PNG they gave you. Do not redraw it and do not export the stand-in to another format.`
33506
+ }
33507
+ });
33508
+ process.exit(1);
33509
+ return;
33510
+ }
33488
33511
  const blueprint = adSpecToBlueprint(spec.data);
33489
33512
  const slug = args.slug ?? path24.basename(specPath).replace(/\.[^.]+$/, "");
33490
33513
  const outPath = args.out ?? (args.slug ? path24.join("src/creatives", slug, `${slug}.canvas.json`) : path24.join(path24.dirname(specPath), `${slug}.canvas.json`));