Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shaobeichen/shaoo
📦 一个Monorepo仓库带你学会Monorepo,包含详细的Monorepo操作过程
https://github.com/shaobeichen/shaoo
monorepo npm pnpm shaoo vue vue3
Last synced: about 1 month ago
JSON representation
📦 一个Monorepo仓库带你学会Monorepo,包含详细的Monorepo操作过程
- Host: GitHub
- URL: https://github.com/shaobeichen/shaoo
- Owner: shaobeichen
- Created: 2023-08-25T06:19:43.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-31T03:57:46.000Z (about 1 year ago)
- Last Synced: 2024-12-02T01:45:03.002Z (about 2 months ago)
- Topics: monorepo, npm, pnpm, shaoo, vue, vue3
- Language: JavaScript
- Homepage:
- Size: 150 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# shaoo
1. 安装 pnpm
2. npm init
3. 修改 package.json, 包管理器限制```
{
// 只允许使用pnpm来开发
// preinstall: 在install之前(首次)执行
// postinstall: 在install之后(首次)执行
"scripts": {
"preinstall": "npx only-allow pnpm"
},
// 防止最外层包被发布出去,设为true以后发布时会提醒你
"private": true,
"engines": {
"node": ">=16"
}
}
```4. 手动添加 pnpm-workspace.yaml
```bash
packages:
- 'packages/**'
```5. 添加 packages 文件夹
6. 添加一个子包 test-share
7. 进入子包 pnpm init
8. 修改 package.json```json
{
"publishConfig": {
"access": "public"
}
}
```9. 子包名叫 @shaoo/test-share
10. 添加一个子包 test
11. 进入子包 pnpm init 同时修改 package.json
12. 子包名叫 @shaoo/test
13. test 里添加依赖```bash
pnpm -F @shaoo/test add @shaoo/test-share
``````
{
"@shaoo/test-share": "workspace:*"
}
```14. 登录 npm
```bash
npm login
```15. 安装发包依赖
```bash
pnpm install @changesets/cli -w --save-dev
pnpm changeset init
```16. 预发布
```bash
pnpm changeset pre enter
# alpha 是内部测试版,一般不向外部发布,会有很多Bug,一般只有测试人员使用
# beta 也是测试版,这个阶段的版本会一直加入新的功能。在Alpha版之后推出
# rc (Release Candidate) 发行候选版本。RC版不会再加入新的功能了,主要着重于除错pnpm changeset
# major minor patch
# 1.0.0
pnpm changeset version
pnpm changeset publish
# error an error occurred while publishing @shaoo/test:
# error '@shaoo/[email protected]' is not in this registry.
# npm规定包名中,@后是用户名 或者是组织
pnpm changeset pre exit```
17. 正式发布
```bash
pnpm changeset
pnpm changeset version
pnpm changeset publish
```