docs: pnpm instead of yarn (#6625)

* docs: `pnpm` instead of `yarn`

* chore: ++
This commit is contained in:
kalykun 2023-02-17 14:09:50 +08:00 committed by GitHub
parent 3b48c738df
commit 665d7c494d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 36 deletions

View File

@ -5,13 +5,13 @@
Install dev deps after git clone the repo.
```bash
$ yarn
$ pnpm i
```
run start
```bash
$ yarn start
$ pnpm start
```
## Build
@ -19,13 +19,13 @@ $ yarn start
Transform with babel and rollup.
```bash
$ yarn build
$ pnpm build
# Build and monitor file changes
$ yarn build --watch
$ pnpm build --watch
# Build specified package only
$ PACKAGE=plugin-antd yarn build --watch
$ PACKAGE=plugin-antd pnpm build --watch
```
## Test
@ -33,16 +33,16 @@ $ PACKAGE=plugin-antd yarn build --watch
Run test.
```bash
$ yarn test
$ pnpm test
# Test specified file and watch
$ yarn test getMockData.test.js -w
$ pnpm test getMockData.test.js -w
# Test specified package
$ yarn test --package core
$ pnpm test --package core
# Generate coverage
$ yarn test --coverage
$ pnpm test --coverage
```
## Release
@ -62,7 +62,7 @@ Such as creating package `foo`.
```bash
$ mkdir -p packages/foo
$ yarn bootstrap
$ pnpm bootstrap
```
Then you will find the `README.md` and `package.json` is generated in `packages/foo`.

View File

@ -72,7 +72,7 @@ When we clone the project we will see the following directory structure.
- lerna.json * configuration for multiple packages
- package.json * configuration for the project
- tsconfig.json * configuration for typescript
- yarn.lock * dependency lock file
- pnpm-lock.yaml * dependency lock file
```
@ -100,18 +100,18 @@ However, there are some styles that `linter` can't handle. If you're not sure ab
We use [monorepo](https://danluu.com/monorepo/) to manage our repository in a way that the repository contains multiple separate packages so that changes can be co-located together, so that we can run test cases together, and if there is a problem with a change, we can quickly pinpoint the problem.
Because we use monorepo, we require yarn to install the dependencies. The [`workspace`](https://classic.yarnpkg.com/en/docs/workspaces#search) can help us share dependencies across multiple packages.
The [`pnpm-workspace.yaml`](https://pnpm.io/pnpm-workspace_yaml) can help us share dependencies across multiple packages.
After the installation is complete you can use the following command.
- `yarn start` to preview your changes
- `yarn lint` to check the code style
- `yarn tsc` to check if TypeScript conforms to the specification
- `yarn test` Test if the code passes the test case
- `yarn test:coverage` Test the test coverage of the repository
- `yarn build` Compile the current component library
- `pnpm start` to preview your changes
- `pnpm lint` to check the code style
- `pnpm tsc` to check if TypeScript conforms to the specification
- `pnpm test` Test if the code passes the test case
- `pnpm test:coverage` Test the test coverage of the repository
- `pnpm build` Compile the current component library
We recommend running `yarn test` or the aforementioned linter to make sure that your code changes do not affect the original functionality and that every line of code you write is tested correctly, which will improve the overall quality of the component library anyway.
We recommend running `pnpm test` or the aforementioned linter to make sure that your code changes do not affect the original functionality and that every line of code you write is tested correctly, which will improve the overall quality of the component library anyway.
If you add a new feature, please add tests before committing pr, so we can make sure your code doesn't have problems in the future.

View File

@ -74,7 +74,7 @@ Ant Design 定义了基础的设计规范,对应也提供了大量的基础组
- lerna.json * 多包的配置
- package.json * 项目的配置
- tsconfig.json * typescript 的配置
- yarn.lock * 依赖 lock 文件
- pnpm-lock.yaml * 依赖 lock 文件
```
`coverage``.umi` 这两个文件夹比较特殊,`coverage` 是测试覆盖率文件,在跑完测试覆盖率后才会出现,`.umi` 是运行时的一些临时文件,在执行 `npm run start` 时生成。
@ -101,18 +101,18 @@ Ant Design 定义了基础的设计规范,对应也提供了大量的基础组
我们使用了 [monorepo](https://danluu.com/monorepo/) 的方式来管理我们的仓库,仓库中包含多个独立的包,以便于更改可以一起联调,这样可以一起跑测试用例,如果变更出现问题,我们可以很快的定位到问题。
因为使用了 monorepo ,我们要求必须要使用 yarn 来安装依赖。[`workspace`](https://classic.yarnpkg.com/en/docs/workspaces#search) 可以帮助我们在多个包中共享依赖。
[`pnpm-workspace.yaml`](https://pnpm.io/zh/pnpm-workspace_yaml) 可以帮助我们在多个包中共享依赖。
安装完成后你可以使用以下命令:
- `yarn start` 预览你的改动
- `yarn lint` 检查代码风格
- `yarn tsc` 检查 TypeScript 是否符合规范
- `yarn test` 测试代码是否可以通过测试用例
- `yarn test:coverage` 测试仓库的测试覆盖率
- `yarn build` 编译当前组件库
- `pnpm start` 预览你的改动
- `pnpm lint` 检查代码风格
- `pnpm tsc` 检查 TypeScript 是否符合规范
- `pnpm test` 测试代码是否可以通过测试用例
- `pnpm test:coverage` 测试仓库的测试覆盖率
- `pnpm build` 编译当前组件库
我们建议运行 `yarn test` 或前文提及的 linter 以确保你的代码变更有没有影响原有功能,同时保证你写的每行代码都被正确的测试到,不管怎样这样都会提升组件库的整体质量。
我们建议运行 `pnpm test` 或前文提及的 linter 以确保你的代码变更有没有影响原有功能,同时保证你写的每行代码都被正确的测试到,不管怎样这样都会提升组件库的整体质量。
如果你增加了一个新功能,请添加测试后再提交 pr,这样我们能确保以后你的代码不出问题。

View File

@ -1,6 +1,6 @@
{
"version": "independent",
"npmClient": "yarn",
"npmClient": "pnpm",
"useWorkspaces": true,
"changelog": {
"repo": "ant-design/pro-components",

View File

@ -1,9 +1,6 @@
{
"private": true,
"license": "MIT",
"workspaces": [
"packages/*"
],
"scripts": {
"bootstrap": "node ./scripts/bootstrap.js",
"build": "npm run version && npm run build-components",
@ -27,7 +24,7 @@
"test:update": "pnpm run version && cross-env TZ=UTC jest --updateSnapshot",
"tsc": "tsc --noEmit",
"tsc:duplicate": "tsc -p ./tests/tsconfig.duplicate.json",
"update:deps": "yarn upgrade-interactive --latest",
"update:deps": "pnpm up --latest",
"version": "node ./scripts/gen_version.js"
},
"browserslist": [

View File

@ -83,10 +83,10 @@ Using npm:
$ npm install --save ${name}
\`\`\`
or using yarn:
or using pnpm:
\`\`\`bash
$ yarn add ${name}
$ pnpm add ${name}
\`\`\`
`,
);

View File

@ -9,7 +9,7 @@ const { join } = require('path');
const distExists = existsSync(distPath);
if (!distExists) {
// 如果没有先生成 dist 目录,dumi build 之后,在 codesandbox 里面会找不到 css 样式。
console.error('Please execute "yarn build" first!');
console.error('Please execute "pnpm build" first!');
process.exit(1);
}
});