Extract a project from a monorepo
The docs starter lives in apps/docs and the component library in packages/ui. A new docs site only needs the starter, but copying that directory still leaves test files to remove and workspace: dependencies to fix.
The config below handles those steps together: take files from apps/docs, exclude src/__tests__, and set the component library dependency to a specific version.
Example note
apps/docs/src/page.ts
import { Button } from '@example/ui'
export const action = Button({ label: 'Get started' })
Create command
pnpm create preset init my-docs --from ./presets/docs.jsonSubdirectory and file exclusions
With source.directory set to apps/docs, that directory's contents become the new project's root files. Neither packages/ui nor the repository's root pnpm-workspace.yaml is copied.
Paths in exclude start from the selected directory too. Use src/__tests__, without the apps/docs prefix.
Workspace dependency conversion
Enable packageJson.resolveWorkspace and set @example/ui to 1.2.3 in workspaceVersions. The generated package.json uses that version in place of workspace:*, with no registry lookup for this package.
@example/ui is an example name. Use a published package and version that the environment can install. This changes the dependency version; it does not copy or bundle the component source from packages/ui.
Without a specified version, the CLI queries npm view using the current npm registry settings. See Resolve workspace dependencies for the full rules.