wealth/docs/decisions/0006-pnpm-workspaces-and-pa...

18 lines
1.1 KiB
Markdown

# 0006 pnpm workspaces with package.json exports
Status: Proposed · Area: architecture · Date: 2026-10-04 · Decided by: agent
## Context
The workspace had no TypeScript or package wiring. The skill allows either package.json `exports` with workspaces or `tsconfig.base.json` path aliases.
## Decision
- Every non-app project is a pnpm workspace package (`pnpm-workspace.yaml`) named `@lumina/<name>` with subpath `exports` that point at its TypeScript sources (`@lumina/island/atoms/button`).
- Third-party dependencies stay in the root package.json (one version policy); each package lists only the `@lumina/*` packages it imports, as `workspace:*`. `tsconfig.base.json` holds the shared compiler options, and each project's `tsconfig.json` extends it.
## Alternatives
- Path aliases: CSS `@import` can't resolve them, so apps would import `island.css` by relative path.
## Consequences
- Apps import `@lumina/island/styles/island.css` by package name, and Node, Next.js, and TypeScript resolve the same subpaths.
- Each new package needs a package.json with `exports` and `sideEffects`.