Skip to content

Commit 3af7081

Browse files
authored
chore: upgrade yarn to pnpm (alibaba#1656)
* chore: upgrade yarn to pnpm * fix: 修复 ci * chore: add ci install pnpm * chore: add ci install pnpm * chore: adjust ci node-version * chore: optimize the document * chore: optimize the document * chore: Optimization tools * chore: update dependencies * chore: update dependencies
1 parent 39fff7f commit 3af7081

22 files changed

+19823
-16532
lines changed

.github/workflows/node-ci.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,22 @@ jobs:
88

99
strategy:
1010
matrix:
11-
node-version: [12.x, 16.x]
11+
node-version: [14.x, 16.x]
1212

1313
steps:
1414
- uses: actions/checkout@v1
15+
16+
- name: Install pnpm
17+
uses: pnpm/[email protected]
18+
1519
- name: Use Node.js ${{ matrix.node-version }}
1620
uses: actions/setup-node@v1
1721
with:
1822
node-version: ${{ matrix.node-version }}
19-
- name: yarn intall, build, and test
23+
24+
- name: pnpm run intall, build, and test
2025
run: |
21-
yarn run init
22-
yarn run test
26+
pnpm run init
27+
pnpm run test
2328
env:
2429
CI: true

.gitleaks.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,4 @@ title = "gitleaks config"
121121
tags = ["key", "twilio"]
122122
[whitelist]
123123
description = "Whitelisted files"
124-
file = '''(^\.?gitleaks.toml$|(.*?)(jpg|gif|doc|pdf|bin)$|^package-lock.json$|yarn.lock|node_modules)'''
124+
file = '''(^\.?gitleaks.toml$|(.*?)(jpg|gif|doc|pdf|bin)$|^package-lock.json$|yarn.lock|pnpm-lock.yaml|node_modules)'''

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm run pretty

.npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
shamefully-hoist=true
2+
auto-install-peers=true

.travis.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ language: node_js
22
node_js:
33
- 'lts/*'
44
install:
5-
- yarn install
6-
- yarn run bootstrap
7-
- yarn install -g surge
5+
- pnpm install
6+
- pnpm install -g surge
87
script:
9-
- yarn run build:doc
8+
- pnpm run build:doc
109
- surge ./dist ahooks-$(git rev-parse --short HEAD).surge.sh
1110
- yarn coveralls # generate static files
1211
cache:

CONTRIBUTING.MD

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ Before submitting a pull request, please make sure the following is done:
2222

2323
2. If you've fixed a bug or added code that should be tested, add tests!
2424

25-
3. Ensure the test suite passes `yarn run test`.
25+
3. Ensure the test suite passes `pnpm run test`.
2626

2727
## Development Workflow
2828

29-
After cloning `ahooks`, run `yarn run init` to fetch its dependencies. Then, you can run several commands:
29+
After cloning `ahooks`, run `pnpm run init` to fetch its dependencies. Then, you can run several commands:
3030

31-
1. `yarn start` runs `ahooks` website locally.
31+
1. `pnpm start` runs `ahooks` website locally.
3232

33-
2. `yarn run test` runs the complete test suite.
33+
2. `pnpm run test` runs the complete test suite.
3434

35-
3. `yarn run build` to build.
35+
3. `pnpm run build` to build.

CONTRIBUTING.zh-CN.MD

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222

2323
2. 如果你修复了一个 bug 或者新增了一个功能,请确保写了相应的测试,这很重要。
2424

25-
3. 确认所有的测试是通过的 `yarn run test`
25+
3. 确认所有的测试是通过的 `pnpm run test`
2626

2727
## 开发流程
2828

29-
在你 clone 代码并且使用 `yarn run init` 安装完依赖后,你还可以运行下面几个常用的命令:
29+
在你 clone 代码并且使用 `pnpm run init` 安装完依赖后,你还可以运行下面几个常用的命令:
3030

31-
1. `yarn start` 在本地运行 `ahooks` 网站。
31+
1. `pnpm start` 在本地运行 `ahooks` 网站。
3232

33-
2. `yarn run test` 运行测试。
33+
2. `pnpm run test` 运行测试。
3434

35-
3. `yarn run build` 构建编译。
35+
3. `pnpm run build` 构建编译。

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ English | [简体中文](https://github.com/alibaba/hooks/blob/master/README.zh-
4242
$ npm install --save ahooks
4343
# or
4444
$ yarn add ahooks
45+
# or
46+
$ pnpm add ahooks
4547
```
4648

4749
## 🔨 Usage
@@ -59,8 +61,8 @@ import { useRequest } from 'ahooks';
5961
```bash
6062
$ git clone [email protected]:alibaba/hooks.git
6163
$ cd hooks
62-
$ yarn run init
63-
$ yarn start
64+
$ pnpm run init
65+
$ pnpm start
6466
```
6567

6668
Open your browser and visit http://127.0.0.1:8000

README.zh-CN.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
$ npm install --save ahooks
4343
# or
4444
$ yarn add ahooks
45+
# or
46+
$ pnpm add ahooks
4547
```
4648

4749
## 🔨 使用
@@ -59,8 +61,8 @@ import { useRequest } from 'ahooks';
5961
```bash
6062
$ git clone [email protected]:alibaba/hooks.git
6163
$ cd hooks
62-
$ yarn run init
63-
$ yarn start
64+
$ pnpm run init
65+
$ pnpm start
6466
```
6567

6668
打开浏览器访问 http://127.0.0.1:8000

config/config.ts

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ export default {
3535
dynamicImport: {},
3636
manifest: {},
3737
hash: true,
38+
alias: {
39+
'ahooks': process.cwd() + '/packages/hooks/src/index.ts',
40+
'@ahooksjs/use-url-state': process.cwd() + '/packages/use-url-state/src/index.ts',
41+
},
3842
resolve: {
3943
includes: ['docs', 'packages/hooks/src', 'packages/use-url-state'],
4044
},

docs/guide/index.en-US.md

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ ahooks, pronounced [eɪ hʊks], is a high-quality and reliable React Hooks libra
1717
$ npm install --save ahooks
1818
# or
1919
$ yarn add ahooks
20+
# or
21+
$ pnpm add ahooks
2022
```
2123

2224
## Usage

docs/guide/index.zh-CN.md

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ ahooks,发音 [eɪ hʊks],是一套高质量可靠的 React Hooks 库。在
1717
$ npm install --save ahooks
1818
# or
1919
$ yarn add ahooks
20+
# or
21+
$ pnpm add ahooks
2022
```
2123

2224
## 使用

docs/index.en-US.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ footer: Open-source MIT Licensed | Copyright © 2019-present<br />Powered by [du
3434
$ npm install --save ahooks
3535
# or
3636
$ yarn add ahooks
37+
# or
38+
$ pnpm add ahooks
3739
```
3840

3941
## 🔨 Usage
@@ -51,8 +53,8 @@ import { useRequest } from 'ahooks';
5153
```bash
5254
$ git clone [email protected]:alibaba/hooks.git
5355
$ cd hooks
54-
$ yarn run init
55-
$ yarn start
56+
$ pnpm run init
57+
$ pnpm start
5658
```
5759

5860
Open your browser and visit http://127.0.0.1:8000

docs/index.zh-CN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ import { useRequest } from 'ahooks';
5151
```bash
5252
$ git clone [email protected]:alibaba/hooks.git
5353
$ cd hooks
54-
$ yarn run init
55-
$ yarn start
54+
$ pnpm run init
55+
$ pnpm start
5656
```
5757

5858
打开浏览器访问 http://127.0.0.1:8000

lerna.json

-15
This file was deleted.

package.json

+14-17
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,23 @@
66
"url": "git+https://github.com/alibaba/hooks.git"
77
},
88
"scripts": {
9-
"init": "rm -rf node_modules && yarn install && yarn run clean && yarn run bootstrap && yarn run build",
10-
"start": "yarn run dev",
9+
"init": "pnpm clean && pnpm install && pnpm run build",
10+
"start": "pnpm run dev",
1111
"dev": "dumi dev",
12-
"bootstrap": "lerna bootstrap",
13-
"clean": "lerna clean --yes",
14-
"build": "lerna run build",
12+
"clean": "rm -rf node_modules **/*/node_modules",
13+
"build": "pnpm -r --filter=./packages/* run build",
1514
"test": "jest",
1615
"coveralls": "jest --coverage --coverageReporters=text-lcov | coveralls",
1716
"lint": "eslint --ignore-pattern **/__tests__/* --ignore-pattern **/demo/* \"packages/*/src/**/*.{ts,tsx}\"",
17+
"pretty": "pretty-quick --staged",
1818
"build:doc": "dumi build",
1919
"pub:doc-surge": "surge ./dist --domain ahooks.js.org",
2020
"pub:doc-gitee": "cd ./dist && rm -rf .git && touch .spa && touch .nojekyll && git init && git remote add origin [email protected]:ahooks/ahooks.git && git add -A && git commit -m \"publish docs\" && git push origin master -f && echo https://gitee.com/ahooks/ahooks/pages",
21-
"pub:doc": "yarn run build:doc && yarn run pub:doc-surge && yarn run pub:doc-gitee",
22-
"pub": "yarn run build && lerna publish",
23-
"pub:beta": "yarn run build && lerna publish --dist-tag beta"
24-
},
25-
"husky": {
26-
"hooks": {
27-
"pre-commit": "pretty-quick --staged"
28-
}
21+
"pub:doc": "pnpm run build:doc && pnpm run pub:doc-surge && pnpm run pub:doc-gitee",
22+
"pub": "pnpm run build && pnpm run publish",
23+
"pub:beta": "pnpm run build && pnpm run publish --tag beta",
24+
"preinstall": "npx only-allow pnpm",
25+
"prepare": "husky install"
2926
},
3027
"devDependencies": {
3128
"@ant-design/icons": "^4.6.2",
@@ -55,15 +52,14 @@
5552
"gulp": "^4.0.2",
5653
"gulp-babel": "^8.0.0",
5754
"gulp-typescript": "^6.0.0-alpha.1",
58-
"husky": "^4.2.5",
55+
"husky": "^8.0.0",
5956
"jest": "^26.0.1",
6057
"jest-fetch-mock": "^3.0.3",
6158
"jest-localstorage-mock": "^2.4.18",
62-
"lerna": "4.x",
6359
"mockdate": "^3.0.2",
6460
"mockjs": "^1.1.0",
6561
"prettier": "^2.0.5",
66-
"pretty-quick": "^2.0.1",
62+
"pretty-quick": "^3.1.3",
6763
"react": "^16.8.6",
6864
"react-dom": "^16.8.6",
6965
"react-drag-listview": "^0.1.6",
@@ -75,5 +71,6 @@
7571
"webpack": "^4.43.0",
7672
"webpack-cli": "^3.3.10",
7773
"webpack-merge": "^4.2.2"
78-
}
74+
},
75+
"packageManager": "[email protected]"
7976
}

0 commit comments

Comments
 (0)