Getting Started
Prerequisites
- Node.js >= 18
- pnpm >= 9
Installation
Clone the Repository
bash
git clone https://github.com/YunYouJun/starter-monorepo.git
cd starter-monorepoInstall Dependencies
bash
pnpm installProject Structure
starter-monorepo/
├── docs/ # Documentation site
│ ├── .vitepress/ # VitePress config
│ ├── guide/ # Guide docs
│ ├── api/ # API docs (auto-generated)
│ └── public/ # Static assets
├── packages/
│ └── pkg-placeholder/ # Example package
│ ├── src/ # Source code
│ ├── test/ # Tests
│ └── dist/ # Build output
├── package.json # Root package.json
├── pnpm-workspace.yaml # pnpm workspace config
└── tsconfig.json # TypeScript configDevelopment
Build All Packages
bash
pnpm buildRun in Development Mode
bash
pnpm devRun Tests
bash
pnpm testType Check
bash
pnpm typecheckLint Code
bash
pnpm lintWorking with Documentation
Start Documentation Site
bash
pnpm docs:devVisit http://localhost:5173 to view the documentation.
Generate API Documentation
bash
pnpm docs:apiThis will:
- Read source code from
packages/*/src - Parse JSDoc comments and TypeScript types
- Generate Markdown docs in
docs/api/
Build Documentation
bash
pnpm docs:buildPreview Built Documentation
bash
pnpm docs:previewCreating a New Package
- Create a new directory in
packages/:
bash
mkdir packages/my-package
cd packages/my-package- Initialize package.json:
json
{
"name": "my-package",
"version": "0.0.0",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs"
}
},
"main": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": ["dist"]
}- Create source files:
bash
mkdir src
echo "export const hello = 'world'" > src/index.ts- Add build config (
build.config.ts):
typescript
import { defineBuildConfig } from 'unbuild'
export default defineBuildConfig({
entries: ['src/index'],
declaration: true,
clean: true,
rollup: {
emitCJS: false,
},
})Next Steps
- Learn about Configuration
- Explore the API Reference
- Read the Changelog