@open-press/core
Workspace
An internal component used by OpenPress to group discovered Press folders into a single workspace manifest.
<Workspace> is a system-generated top-level logical grouping component that aggregates automatically detected <Press> instances into a single environment configuration and output structure.
Design Contract: Developers do not write the <Workspace> declaration directly. The system automatically creates this node by parsing the folder structure (press/*/press.tsx).
A group node constructed internally by the engine. Unifies the management of operational configurations, routing manifests, and deployment parameters for multiple documents.
import { Workspace } from "@open-press/core"; <Workspace name? children /> Internal Props
| Name | Type | Default | Description |
|---|---|---|---|
name | string | Project global identification name, displayed in the output gallery and PDF metadata. | |
children required | Press[] | List of parsed document instances, each possessing a unique `slug`. |
Folder and Routing Structure
The Workspace architecture supports relying on a single repository and package layer to generate multiple correlated independent documents.
Structure Demonstration: Multi-document Configuration
my-launch/
├── package.json # Global dependencies and deployment scripts
└── press/
├── shared/ # Optional intentionally shared source: assets, facts, components
├── proposal/
│ ├── press.tsx # <Press slug="proposal">
│ ├── theme/ # proposal tokens and fonts
│ └── chapters/ # proposal specific MDX
└── pitch-deck/
├── press.tsx # <Press slug="pitch-deck">
├── theme/ # deck tokens and fonts
└── layouts/ # pitch-deck specific components
Workspace System Impacts
Build & CLI
| Name | Type | Default | Description |
|---|---|---|---|
Path Resolution | Routing | Automatically generates the index page `/` and corresponding sub-document paths `/proposal`, `/pitch-deck`. | |
Per-Press Style Binding | Theme | Each Press reads its own `press/ | |
Output Artifact Structure | Build | Individually outputs `public/openpress/ | |
Build Cascading | Command | `npm run build` forces validation of all sub-documents; any single-point structural error will interrupt the output of the entire Workspace. |
Isolation Boundary Guidelines
Documents meeting the following conditions should be split into completely independent Workspaces (different repositories or different packages in a monorepo), rather than configured as sub-documents in a shared Workspace:
- Lacking shared context, brand assets, or code-sharing scenarios.
- Version control snapshots of the same document content generated over time (should be managed by Git branches).
- Projects demanding routing to distinct deployment targets or independent adapters.
Cross-document State Management
Data sharing adopts the ES Module declaration pattern and does not introduce a dedicated global state library:
// press/shared/data.ts
export const RAISE = { amount: "$8M", round: "Series A" };
// press/proposal/chapters/01-overview.mdx
import { RAISE } from "../../../data";
Goal: {RAISE.round} stage.