Skip to content

Commit

Permalink
chore: upgrade yarn to pnpm (alibaba#1656)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
crazylxr authored Jun 12, 2022
1 parent 39fff7f commit 3af7081
Show file tree
Hide file tree
Showing 22 changed files with 19,823 additions and 16,532 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@ jobs:

strategy:
matrix:
node-version: [12.x, 16.x]
node-version: [14.x, 16.x]

steps:
- uses: actions/checkout@v1

- name: Install pnpm
uses: pnpm/[email protected]

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: yarn intall, build, and test

- name: pnpm run intall, build, and test
run: |
yarn run init
yarn run test
pnpm run init
pnpm run test
env:
CI: true
2 changes: 1 addition & 1 deletion .gitleaks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ title = "gitleaks config"
tags = ["key", "twilio"]
[whitelist]
description = "Whitelisted files"
file = '''(^\.?gitleaks.toml$|(.*?)(jpg|gif|doc|pdf|bin)$|^package-lock.json$|yarn.lock|node_modules)'''
file = '''(^\.?gitleaks.toml$|(.*?)(jpg|gif|doc|pdf|bin)$|^package-lock.json$|yarn.lock|pnpm-lock.yaml|node_modules)'''
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run pretty
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
shamefully-hoist=true
auto-install-peers=true
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ language: node_js
node_js:
- 'lts/*'
install:
- yarn install
- yarn run bootstrap
- yarn install -g surge
- pnpm install
- pnpm install -g surge
script:
- yarn run build:doc
- pnpm run build:doc
- surge ./dist ahooks-$(git rev-parse --short HEAD).surge.sh
- yarn coveralls # generate static files
cache:
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.MD
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ Before submitting a pull request, please make sure the following is done:

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

3. Ensure the test suite passes `yarn run test`.
3. Ensure the test suite passes `pnpm run test`.

## Development Workflow

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

1. `yarn start` runs `ahooks` website locally.
1. `pnpm start` runs `ahooks` website locally.

2. `yarn run test` runs the complete test suite.
2. `pnpm run test` runs the complete test suite.

3. `yarn run build` to build.
3. `pnpm run build` to build.
10 changes: 5 additions & 5 deletions CONTRIBUTING.zh-CN.MD
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

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

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

## 开发流程

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

1. `yarn start` 在本地运行 `ahooks` 网站。
1. `pnpm start` 在本地运行 `ahooks` 网站。

2. `yarn run test` 运行测试。
2. `pnpm run test` 运行测试。

3. `yarn run build` 构建编译。
3. `pnpm run build` 构建编译。
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ English | [简体中文](https://github.com/alibaba/hooks/blob/master/README.zh-
$ npm install --save ahooks
# or
$ yarn add ahooks
# or
$ pnpm add ahooks
```

## 🔨 Usage
Expand All @@ -59,8 +61,8 @@ import { useRequest } from 'ahooks';
```bash
$ git clone [email protected]:alibaba/hooks.git
$ cd hooks
$ yarn run init
$ yarn start
$ pnpm run init
$ pnpm start
```

Open your browser and visit http://127.0.0.1:8000
Expand Down
6 changes: 4 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
$ npm install --save ahooks
# or
$ yarn add ahooks
# or
$ pnpm add ahooks
```

## 🔨 使用
Expand All @@ -59,8 +61,8 @@ import { useRequest } from 'ahooks';
```bash
$ git clone [email protected]:alibaba/hooks.git
$ cd hooks
$ yarn run init
$ yarn start
$ pnpm run init
$ pnpm start
```

打开浏览器访问 http://127.0.0.1:8000
Expand Down
4 changes: 4 additions & 0 deletions config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export default {
dynamicImport: {},
manifest: {},
hash: true,
alias: {
'ahooks': process.cwd() + '/packages/hooks/src/index.ts',
'@ahooksjs/use-url-state': process.cwd() + '/packages/use-url-state/src/index.ts',
},
resolve: {
includes: ['docs', 'packages/hooks/src', 'packages/use-url-state'],
},
Expand Down
2 changes: 2 additions & 0 deletions docs/guide/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ ahooks, pronounced [eɪ hʊks], is a high-quality and reliable React Hooks libra
$ npm install --save ahooks
# or
$ yarn add ahooks
# or
$ pnpm add ahooks
```

## Usage
Expand Down
2 changes: 2 additions & 0 deletions docs/guide/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ ahooks,发音 [eɪ hʊks],是一套高质量可靠的 React Hooks 库。在
$ npm install --save ahooks
# or
$ yarn add ahooks
# or
$ pnpm add ahooks
```

## 使用
Expand Down
6 changes: 4 additions & 2 deletions docs/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ footer: Open-source MIT Licensed | Copyright © 2019-present<br />Powered by [du
$ npm install --save ahooks
# or
$ yarn add ahooks
# or
$ pnpm add ahooks
```

## 🔨 Usage
Expand All @@ -51,8 +53,8 @@ import { useRequest } from 'ahooks';
```bash
$ git clone [email protected]:alibaba/hooks.git
$ cd hooks
$ yarn run init
$ yarn start
$ pnpm run init
$ pnpm start
```

Open your browser and visit http://127.0.0.1:8000
Expand Down
4 changes: 2 additions & 2 deletions docs/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ import { useRequest } from 'ahooks';
```bash
$ git clone [email protected]:alibaba/hooks.git
$ cd hooks
$ yarn run init
$ yarn start
$ pnpm run init
$ pnpm start
```

打开浏览器访问 http://127.0.0.1:8000
Expand Down
15 changes: 0 additions & 15 deletions lerna.json

This file was deleted.

31 changes: 14 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,23 @@
"url": "git+https://github.com/alibaba/hooks.git"
},
"scripts": {
"init": "rm -rf node_modules && yarn install && yarn run clean && yarn run bootstrap && yarn run build",
"start": "yarn run dev",
"init": "pnpm clean && pnpm install && pnpm run build",
"start": "pnpm run dev",
"dev": "dumi dev",
"bootstrap": "lerna bootstrap",
"clean": "lerna clean --yes",
"build": "lerna run build",
"clean": "rm -rf node_modules **/*/node_modules",
"build": "pnpm -r --filter=./packages/* run build",
"test": "jest",
"coveralls": "jest --coverage --coverageReporters=text-lcov | coveralls",
"lint": "eslint --ignore-pattern **/__tests__/* --ignore-pattern **/demo/* \"packages/*/src/**/*.{ts,tsx}\"",
"pretty": "pretty-quick --staged",
"build:doc": "dumi build",
"pub:doc-surge": "surge ./dist --domain ahooks.js.org",
"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",
"pub:doc": "yarn run build:doc && yarn run pub:doc-surge && yarn run pub:doc-gitee",
"pub": "yarn run build && lerna publish",
"pub:beta": "yarn run build && lerna publish --dist-tag beta"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
"pub:doc": "pnpm run build:doc && pnpm run pub:doc-surge && pnpm run pub:doc-gitee",
"pub": "pnpm run build && pnpm run publish",
"pub:beta": "pnpm run build && pnpm run publish --tag beta",
"preinstall": "npx only-allow pnpm",
"prepare": "husky install"
},
"devDependencies": {
"@ant-design/icons": "^4.6.2",
Expand Down Expand Up @@ -55,15 +52,14 @@
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-typescript": "^6.0.0-alpha.1",
"husky": "^4.2.5",
"husky": "^8.0.0",
"jest": "^26.0.1",
"jest-fetch-mock": "^3.0.3",
"jest-localstorage-mock": "^2.4.18",
"lerna": "4.x",
"mockdate": "^3.0.2",
"mockjs": "^1.1.0",
"prettier": "^2.0.5",
"pretty-quick": "^2.0.1",
"pretty-quick": "^3.1.3",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-drag-listview": "^0.1.6",
Expand All @@ -75,5 +71,6 @@
"webpack": "^4.43.0",
"webpack-cli": "^3.3.10",
"webpack-merge": "^4.2.2"
}
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit 3af7081

Please sign in to comment.