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
npm i -g lerna@7
-
创建项目
npx lerna init --dryRun # 检查是否可以创建 npx lerna init --packages="packages/*" # 指定 packages 目录`
近期项目中 pnpm 用的较为频繁,所以这里使用 pnpm 作为包管理器。
cd ./packages
pnpm vite create [my-first-package]
cd ..
pnpm install