monorepo-project-standard

Monorepo 项目规范,涵盖 pnpm workspace、Turborepo、Nx 的目录结构、依赖管理、任务编排、包发布。当用户提到 monorepo、workspace、多包、pnpm workspace、Turborepo、Nx 时自动激活。

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "monorepo-project-standard" with this command: npx skills add bovinphang/monorepo-project-standard

Monorepo 项目规范

适用于使用 pnpm workspace、Turborepo 或 Nx 的多包前端仓库。

适用场景

  • 新建或调整 Monorepo 结构
  • 管理多包依赖与任务
  • 配置 Turborepo / Nx 任务编排
  • 包发布与版本管理

工具选择

工具适用特点
pnpm workspace基础依赖提升、链接、脚本聚合
Turborepo推荐缓存、并行、依赖图
Nx大型增量构建、云缓存、插件生态

目录结构

pnpm + Turborepo

├── package.json                # 根 package,workspace 配置
├── pnpm-workspace.yaml         # workspace 包列表
├── turbo.json                  # Turborepo 配置
│
├── apps/
│   ├── web/                    # 主应用
│   │   ├── package.json
│   │   └── ...
│   ├── admin/                  # 管理后台
│   └── docs/                   # 文档站
│
├── packages/
│   ├── ui/                     # 共享 UI 组件
│   │   ├── package.json
│   │   └── src/
│   ├── utils/                  # 工具函数
│   ├── config-eslint/         # 共享 ESLint 配置
│   └── config-typescript/     # 共享 TS 配置
│
└── tooling/                    # 构建/测试工具(可选)
    └── scripts/

pnpm-workspace.yaml

packages:
  - 'apps/*'
  - 'packages/*'

依赖管理

  • 内部包使用 workspace:* 协议
  • package.json 统一部分依赖版本,子包可覆盖
  • 禁止循环依赖,通过 pnpm why 检查
{
  "dependencies": {
    "@repo/ui": "workspace:*",
    "@repo/utils": "workspace:*"
  }
}

Turborepo 任务编排

{
  "$schema": "https://turbo.build/schema.json",
  "tasks": {
    "build": {
      "dependsOn": ["^build"],
      "outputs": ["dist/**", ".next/**"]
    },
    "lint": {
      "dependsOn": ["^build"]
    },
    "test": {
      "dependsOn": ["^build"]
    }
  }
}
  • ^build 表示先执行依赖包的 build
  • outputs 用于缓存命中判断

Nx 任务编排

{
  "targetDefaults": {
    "build": {
      "dependsOn": ["^build"],
      "outputs": ["{projectRoot}/dist"],
      "cache": true
    }
  }
}

包命名

  • 内部包:@org/package-name@repo/package-name
  • 发布到 npm:遵循 @scope/name 规范

强约束

  • 子包之间通过 workspace:* 引用,不发布到 npm 再安装
  • 共享配置(ESLint、TS)放在 packages/config-*,子包 extends
  • 构建顺序由依赖图决定,不手动指定无关依赖
  • 根目录执行 pnpm -r buildturbo run build 时,所有包按序构建

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Huo15 Openclaw Enhance

火一五·克劳德·龙虾增强插件 v5.7.8 — 全面适配 openclaw 2026.4.24:peerDep ^4.24 + build/compat 同步到 4.24 + 14 处 api.on 全部去掉 as any 改成 typed hook(hookName 联合类型 + handler 自动推断 Pl...

Registry SourceRecently Updated
General

Content Trend Analyzer

Aggregates and analyzes content trends across platforms to identify hot topics, user intent, content gaps, and generates data-driven article outlines.

Registry SourceRecently Updated
General

Prompt Debugger

Debug prompts that produce unexpected AI outputs — diagnose failure modes, identify ambiguity and conflicting instructions, test variations, compare model re...

Registry SourceRecently Updated
General

Indie Maker News

独行者 Daily - 变现雷达。读对一条新闻,少走一年弯路。每天5分钟,给创业者装上商业雷达。聚焦一人公司、副业、创业变现资讯,智能分类,行动导向。用户下载即能用,无需本地部署!

Registry SourceRecently Updated