Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 927 Bytes

how-to-create-a-monorepo.md

File metadata and controls

42 lines (29 loc) · 927 Bytes

如何创建一个 Monorepo 仓库

为什么 Monorepo

Monorepos let you develop multiple packages in the same repository, which is
fantastic for productivity. You can share code, establish clear ownership, and
have fast unified CI. That is why more and more teams are switching to this way
of development.

安装 Lerna

  • 全局安装 Lerna

    npm i -g lerna@7
  • 创建项目

    getting-started

    npx lerna init --dryRun  # 检查是否可以创建
    npx lerna init --packages="packages/*"  # 指定 packages 目录`

基于 pnpm 的 配置

近期项目中 pnpm 用的较为频繁,所以这里使用 pnpm 作为包管理器。

using-pnpm-with-lerna

创建第一个 Package

cd ./packages
pnpm vite create [my-first-package]
cd ..
pnpm install