2.5 KiB
2.5 KiB
Build System
Overview
WorldWideView uses a pnpm monorepo workspace for managing both the main application and its associated SDK and plugin packages. The primary build system relies on Next.js 16 with custom Webpack optimizations, specifically designed to output a standalone trace for highly efficient Docker containerization.
The core build configuration resides in package.json and next.config.ts. A custom standalone tracer strips unnecessary CLI dependencies (prisma, dotenv) from the final build to prevent fatal container runtime crashes.
Build Workflows
Standard Development
- Install Dependencies:
pnpm install(Installs all workspace packages defined inpnpm-workspace.yaml). - Initial Setup:
pnpm run setup(Executesscripts/setup.mjsto generate a.env.localwith a freshAUTH_SECRET). - Run Development Server (All):
pnpm dev:all(Concurrently starts the Next.js frontend and the localwwv-data-engine-v2+ Redis containers via Docker Compose).
Production Build
- Build Command:
pnpm build(Executesnext build --webpack). - Output: Generates a
.next/standalone/folder ready for execution. - Static Assets:
scripts/copy-cesium.mjsis executed duringpredevandbuildto copy pre-compiled CesiumJS static assets into thepublic/cesium/directory, keeping them out of the output tracer.
Platform Setup
- Database Migrations: Prisma schema is located at
prisma/schema.prisma. During development,pnpm devtriggers apredevhook runningnpx prisma migrate deployto ensure PostgreSQL tables are initialized. - Data Engine: The generic data engine runner and Redis cache are started via
docker compose up wwv-data-engine-v2 wwv-redis. Custom data seeders are placed in thelocal-seeders/community/orlocal-seeders/private/sandboxes and dynamically loaded by the engine. - Plugin Packages: Internal plugin packages must be properly listed in
tsconfig.jsonpaths andnext.config.ts'stranspilePackagesarray.
Reference
- Monorepo Config:
pnpm-workspace.yaml- defines package locations (packages/*andpackages/*/backend). - Next Config:
next.config.ts- controls the standalone output,transpilePackages, and restrictive security headers. - Prisma Config:
prisma.config.ts- Native JavaScript object export used to bypass Next.js tracer issues with dynamic imports. - Cesium Script:
scripts/copy-cesium.mjs- Handles static asset injection.