Files
finance/web/next.config.mjs
zeekayandHanzo Dev 6c3c2cf107 feat: converge onto the Hanzo 8.x UI stack (TypeScript 7 native)
Catch this repo up to the published 8.x fleet standard.

Packages (verified latest on npm, not assumed):
  @hanzo/gui        ^7.3.0 → ^8.0.1
  @hanzo/ui         ^8.0.0 → ^8.0.39
  @hanzogui/config  ^7.3.0 → ^8.0.1
  @hanzogui/next-theme ^7.3.0 → ^8.0.0
  @hanzo/data       ^1.2.0 → ^1.2.2
  @hanzogui/lucide-icons-2 — dropped; it is a hard dependency of @hanzo/ui now,
  so naming it here was a second place for one fact to live.

8.x moved DataTable / LineChart / Sparkline off the root barrel (the root is a
client boundary and Next 16 refuses `export *` across one), so those imports
now come from @hanzo/ui/product. The product barrel hard-imports
react-native-svg with no declared dependency on it, so web declares it.

ONE gui config. Both packages carried their own `createGui(defaultConfig)` —
exactly the fork @hanzo/ui/gui-config exists to prevent ("a second app that
copied it would fork it"). Both copies are deleted; gui.d.ts and GuiRoot read
the canonical scale, so the finance board now renders with the type ladder,
radii and spacing the console renders it with.

ONE Hanzo mark. web/src/components/Logo.tsx hand-copied the 7-path glyph
byte-for-byte; it now re-exports @hanzo/ui/product's HanzoMark. No bundle cost —
/signin and /auth/callback stayed at 104 kB.

Post-Tailwind theming: @hanzo/ui 8.x ships its identity as plain CSS custom
properties, so the app imports @hanzo/ui/theme.css + the motion/skeleton rules
and marks <html class="dark">. Body type binds --font-geist-sans. Verified in
the built CSS bundle: --background, --font-geist-sans, .dark and .hz-skeleton
all land alongside the finance brand chrome. (No Tailwind, shadcn or Radix was
ever present in this repo — nothing to strip.)

TypeScript 7 native: @typescript/native-preview, and typecheck/build run tsgo.
Both packages are clean under it. tsgo is stricter than tsc about side-effect
imports of unresolvable modules (TS2882), which is what web/css.d.ts declares —
Next only ships a `*.module.css` declaration.

next.config: @hanzo/gui and all ~114 @hanzogui/* packages ship built dist in
8.x, so the readdirSync sweep that fed transpilePackages is gone. Only the two
packages that publish raw TypeScript source (@hanzo/finance-ui, @hanzo/data)
still need transpiling.

Also: POS/NEG sign colors are exported from one place instead of the hex being
re-spelled in cards.tsx, and ad-hoc `as never` color casts go through
@hanzo/ui's sanctioned `asColor`.

Verified: pnpm install --frozen-lockfile, then the exact web/Dockerfile CI gate —
finance-ui tsgo + 27/27 vitest + next build, 11/11 static pages, exit 0. Booted
the standalone server and rendered the landing page and /signin.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-03 17:57:15 -07:00

50 lines
1.9 KiB
JavaScript

import { fileURLToPath } from 'node:url'
import { dirname, join } from 'node:path'
const __dirname = dirname(fileURLToPath(import.meta.url))
/**
* Hanzo Finance web — Next.js config.
*
* The shared @hanzo/finance-ui board renders on the canonical @hanzo/ui (product layer)
* → @hanzo/gui (Tamagui primitives) stack, consumed at RUNTIME (no optimizing compiler):
* `GuiProvider` injects its CSS on mount — exactly how the console consumes them.
*
* As of 8.x, `@hanzo/gui` and every `@hanzogui/*` package ship BUILT dist (cjs + esm),
* so Next resolves them directly. Only the two packages that publish raw TypeScript
* source still need `transpilePackages`; the readdirSync sweep of ~114 `@hanzogui/*`
* directories that used to feed it is gone with them.
*
* `react-native` is aliased to `react-native-web` for the browser — react-native-svg,
* which the @hanzo/ui icon set imports, resolves through it.
*/
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
// Lean, self-contained server for the container image. `outputFileTracingRoot`
// points at the pnpm-workspace root so the traced bundle includes the linked
// @hanzo/finance-ui package (and the hoisted @hanzo/* graph).
output: 'standalone',
outputFileTracingRoot: join(__dirname, '..'),
transpilePackages: ['@hanzo/finance-ui', '@hanzo/data'],
eslint: { ignoreDuringBuilds: true },
experimental: {
esmExternals: true,
},
env: {
NEXT_PUBLIC_APP_VERSION: process.env.npm_package_version ?? '0.1.0',
},
webpack(config) {
config.resolve.alias = {
...config.resolve.alias,
'react-native$': 'react-native-web',
}
// Gui resolves web-specific implementations via `.web.*` first.
config.resolve.extensions = ['.web.tsx', '.web.ts', '.web.jsx', '.web.js', ...config.resolve.extensions]
return config
},
}
export default nextConfig