Files
datacat/Dockerfile.frontend
CatoandClaude Opus 5 d88da54244 refactor(blog): bip-kit typed blocks replace contentlayer — the post body is server-rendered again (#254)
contentlayer generated a typed `.contentlayer/generated` package at
install/build time and compiled each post's MDX into a JS function. That
indirection had already cost this app a working blog: contentlayer 0.3.x
calls a React internal (`getOwner`) that React 19 removed, so the compiled
body crashed during prerender AND during SSR. The workaround shipped in
MDXContentClient.tsx was to render the post body client-only
(`next/dynamic`, `ssr: false`) — every reader and every crawler got
"Lade Inhalt…" and the article appeared only after hydration.

Posts are now markdown read from disk and parsed with bip-kit 0.2.2:

- content/blog/intake-engine.mdx → .md. The `<Callout type="tip">` became
  GitHub callout syntax (`> [!TIP]`), the `<Infographic>` a captioned
  figure, and the MDX `import` line is gone. `&nbsp;` became a real U+00A0,
  since typed blocks have no HTML passthrough to render an entity through.
  Word-level parity verified: zero words lost, and the article parses to the
  28 blocks you would expect (callout, figure, ol, table, hr, …).
- src/lib/blog.ts is the collection: parseFrontmatter + parseContentBlocks +
  extractToc + readingTime. It enforces the `title`/`date` requirement that
  contentlayer's field schema used to, and guards the slug before it reaches
  the filesystem.
- /blog/[slug] renders through bip-kit's async server ArticleBody. The route
  is prerendered (SSG) again instead of being a client-only shell, and it
  gains a scroll-spy TOC, a reading-progress hairline, server-side shiki
  highlighting, figure lightbox and reading time.
- /blog is a server component again: as a client component it shipped its
  own list-and-sort to every reader for data that comes off disk.
- setHighlighterLoader(() => import('shiki')) is registered at module scope
  because this app builds `output: standalone`, where bip-kit's zero-config
  shiki import is invisible to Next's file tracer — without the literal,
  production would ship unhighlighted while dev looked right.

Deleted with it: contentlayer, next-contentlayer, rehype-pretty-code,
remark-gfm, @mdx-js/react; contentlayer.config.ts; MDXContent.tsx,
MDXContentClient.tsx, MDXComponents.tsx; `withContentlayer` in next.config;
the `contentlayer:build` script, the `postinstall` hook that ran it, and
the SKIP_CONTENTLAYER seams in both Dockerfiles and deploy.yml.disabled that
existed only to switch that build off; the `.contentlayer` entries in
.gitignore/.prettierignore/eslint ignores; and the
estree-util-value-to-estree + toml overrides, which pinned packages nothing
depends on any more (deepmerge-ts stays — it comes via @prisma/config).

Security: contentlayer was the only path to @opentelemetry/core and
@opentelemetry/sdk-trace-node. `pnpm audit` in frontend/ goes from
"2 vulnerabilities found — 1 moderate | 1 high" to "No known
vulnerabilities found".

Visible: the article carried `prose prose-indigo dark:prose-invert` with no
@tailwindcss/typography plugin installed, so those classes matched nothing
and the post rendered as unstyled browser defaults. src/app/blog/blog.css
maps datacat's palette onto bip-kit's --bp-* contract for BOTH themes —
datacat's dark mode is prefers-color-scheme, the same axis bip-kit switches
on, so the article now darkens with the page instead of ignoring it.

Only frontend/ is touched; backend/ is untouched.


Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-07 14:55:47 +00:00

39 lines
863 B
Docker

# Frontend Development Dockerfile
# node:24 — pnpm 11 needs Node >= 22.13, and 24 is the fleet default.
FROM node:24-alpine
WORKDIR /app
# Install system dependencies
RUN apk add --no-cache libc6-compat
# corepack reads the packageManager pin from package.json
RUN corepack enable pnpm
# Copy package files
COPY package.json pnpm-lock.yaml ./
COPY frontend/package.json frontend/pnpm-lock.yaml frontend/pnpm-workspace.yaml ./frontend/
# Install dependencies
RUN pnpm install --frozen-lockfile
RUN cd frontend && pnpm install --frozen-lockfile
# Copy frontend source
COPY frontend ./frontend
# Create non-root user
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
# Change ownership
RUN chown -R nextjs:nodejs /app
USER nextjs
# Expose port
EXPOSE 3000
WORKDIR /app/frontend
# Start frontend in development mode
CMD ["pnpm", "run", "dev"]