dow-prod-tracker/src
DJP d5467348a7 Precompile seed to CJS + plain <img> for the logo
Two runtime-surface fixes surfacing from the optical-dev deploy.

1) Seed's `postgres-array/index.js` kept missing even after --no-cache
   rebuilds. Root cause: the Next.js standalone output traces package
   manifests aggressively but sometimes leaves the `main` file body
   out when the package isn't reachable from the app's import graph
   (postgres-array is a transitive of pg, only reached via the seed
   script, not the app runtime). Our `npm install --no-save
   @prisma/adapter-pg` at build time then saw the partial install and
   short-circuited. Runtime tsx resolution then blew up on `require
   postgres-array`.

   Fixed two ways, layered:
   a) In the builder stage, after `npm run build`, esbuild the seed
      into a self-contained CJS bundle at prisma/seed-dow.cjs.
      `--packages=external` keeps npm packages as runtime require()s
      so native .node files (via @prisma/client) work, but everything
      else is bundled so the seed no longer depends on runtime module
      resolution in the fragile standalone tree.
   b) In the runner stage, `npm install --no-save --force` (plus
      explicit `pg@8` which pulls its postgres-* deps cleanly)
      overwrites any partial packages the standalone shipped with.
      Belt-and-braces with the bundled seed.
   c) package.json `db:seed` now prefers `node prisma/seed-dow.cjs`
      and falls back to `tsx prisma/seed-dow.ts` if the .cjs isn't
      there (e.g. when running the seed from a dev box where no build
      happened). Both paths produce identical output.

   No more runtime tsx install — dropped `npm install -g tsx@4` from
   the runner image. That was always a workaround; the bundle is the
   actual fix.

2) Sidebar logo not rendering — Next.js's `<Image>` with basePath +
   the standalone image optimizer is finicky; the image file IS at
   /app/public/navbar-logo.png in the container but Next's
   `/_next/image?url=...` pipeline was returning 404 for it. Swapped
   to a plain `<img>` (with the eslint-disable comment so the rule
   doesn't whine). The file is ~4KB, image optimization added
   nothing. Desktop + mobile sidebars both use the plain tag now.

Verified: tsc --noEmit ✓ zero errors.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 22:46:15 -04:00
..
app Dow-ify project form + seed placeholder roster + Resource Manager + docs 2026-04-20 22:31:19 -04:00
components Precompile seed to CJS + plain <img> for the logo 2026-04-20 22:46:15 -04:00
hooks Dow-ify project form + seed placeholder roster + Resource Manager + docs 2026-04-20 22:31:19 -04:00
lib Dow-ify project form + seed placeholder roster + Resource Manager + docs 2026-04-20 22:31:19 -04:00
stores feat: add pipeline stage resolver and organization access control 2026-03-14 22:43:43 -05:00
types Phase 2: per-client-team visibility enforcement 2026-04-20 18:50:00 -04:00
instrumentation.ts automation rules added to settings 2026-03-17 23:07:44 -05:00
middleware.ts Smoke-test fixes: routing collision + XLSX parser + defaults 2026-04-20 19:47:22 -04:00