From 8af71be2b766325cbe4c46ca8f53029a66c8b578 Mon Sep 17 00:00:00 2001 From: Artea <sepush@outlook.com> Date: Wed, 8 Jan 2025 03:50:56 +0800 Subject: [PATCH] chore: update packageManager version and contribution guide Signed-off-by: Artea <sepush@outlook.com> --- CONTRIBUTING.md | 17 ++++++++++++++++- CONTRIBUTING.zh-CN.md | 17 ++++++++++++++++- package.json | 2 +- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3bbe748575b..394ee75b8ce 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,13 +3,25 @@ - For new features & bug fixes, please create pull request to `main` branch. - For documentation, please create pull request to `docs` branch. +## Recommend Tool + +- [fnm](https://github.com/Schniz/fnm) to manage node version +- [corepack](https://github.com/nodejs/corepack) to manage packageManager version + +```bash +# set node version to 22 or above +fnm use v22 +# prepreck package manager +corepack enable&&corepack prepare +``` + ## Useful Commands ```bash # open the dev server, please note that hot module reload doesn't work well # if you find anything doesn't work, just refresh the page # if you aren't able to open the page at the first time, try to refresh a couple of times -# pnpm version 7.0.0 and above is required +# The version of the package manager must match the version specified in the packageManager field of package.json. pnpm run dev # testing @@ -30,6 +42,9 @@ pnpm run lint:type # lint code & type pnpm run lint +# lint auto fix +pnpm lint:fix + # build site (if vercel preview failed, you might need to run `git clean -fdx` first) pnpm run build:site ``` diff --git a/CONTRIBUTING.zh-CN.md b/CONTRIBUTING.zh-CN.md index 78b83c37560..7e3d9bd498e 100644 --- a/CONTRIBUTING.zh-CN.md +++ b/CONTRIBUTING.zh-CN.md @@ -3,13 +3,25 @@ - 对于新特性和 bug fix,请对 `main` 分支提交 Pull Request - 对于文档更新,请对 `docs` 分支提交 Pull Request +## 推荐工具 + +- [fnm](https://github.com/Schniz/fnm) 管理 node 版本 +- [corepack](https://github.com/nodejs/corepack) 管理包管理器版本 + +```bash +# 设置 node 版本 +fnm use v22 +# 准备对应版本的包管理器 +corepack enable&&corepack prepare +``` + ## 有用的指令 ```bash # 开启开发服务器,注意热更新不是很好用 # 如果你觉得哪里有问题,刷新页面即可 # 第一次运行打不开时,你可以试试刷新几次浏览器 -# 需要 pnpm 在 7.0.0 及以上版本 +# 需要 pnpm 版本和 package.json 的 packageManager 字段一致 pnpm run dev # 测试 @@ -30,6 +42,9 @@ pnpm run lint:type # 上面俩个都检查 pnpm run lint +# 自动修复以上 lint 错误 +pnpm lint:fix + # 构建文档网站(如果 vercel 的预览挂掉了,你可能需要先运行一下 `git clean -fdx`) pnpm run build:site ``` diff --git a/package.json b/package.json index 937bf3eec17..48e4dca745f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "naive-ui", "version": "2.41.0", - "packageManager": "pnpm@9.5.0", + "packageManager": "pnpm@10.0.0", "description": "A Vue 3 Component Library. Fairly Complete, Theme Customizable, Uses TypeScript, Fast", "author": "07akioni", "license": "MIT",