Appearance
一个简单的monorepo搭建过程演示
我这里使用sh,写下如下代码
vi test-monorepo
sh
rm -rf demo-monorepo
mkdir demo-monorepo
cd demo-monorepo
pnpm init
# js生成
# `packages:
# - 'packages/*'
# - '!**/test/**'
# - docs
# - 'internal/*'`.replaceAll("\n","\\n")
echo -e "packages:\\n - 'packages/*'\\n - '!**/test/**'\\n - docs\\n - 'internal/*'" > pnpm-workspace.yaml
生成第一个演示包
mkdir packages/my-demo-module
cd packages/my-demo-module
pnpm init
pnpm install vue -F my-demo-module
给my-demo-module/package.js 添加 "private": true,
json
{
"name": "my-demo-module",
"version": "1.0.0",
"description": "",
"main": "index.js",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
bash test-monorepo
生成第二个库模式的演示包
pnpm create vite library-monkey
选择others 找到 library模式
这里选择在others/create-vite-extra/library
cd library-monkey
pnpm install
pnpm run dev