Skip to content

Commit

Permalink
chore: migrate to pnpm from yarn
Browse files Browse the repository at this point in the history
  • Loading branch information
awmleer committed Jun 29, 2022
1 parent b0f8005 commit 4b8b5bf
Show file tree
Hide file tree
Showing 29 changed files with 13,247 additions and 19,091 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

## 一些开发过程中的注意事项

- 请务必使用 yarn 作为包管理器
- 请务必使用 pnpm 作为包管理器
- 推荐使用英文写 commit message
- 代码中的注释并不是什么要紧的东西,我们更推荐写出自释性更强的代码

Expand Down
51 changes: 36 additions & 15 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,47 @@ jobs:
check:
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup node and yarn
uses: actions/setup-node@v2
- name: Check
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '14'
cache: 'yarn'
- name: Node version
run: node -v
- name: Yarn version
run: yarn -v
- name: Install
run: yarn install
node-version: '16'

- name: Install pnpm
id: pnpm-install
uses: pnpm/action-setup@v2
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Lint
run: yarn lint
run: pnpm lint

- name: Test
run: yarn test-with-coverage
run: pnpm test-with-coverage

- name: Codecov
uses: codecov/[email protected]
with:
directory: ./coverage/

- name: Build
run: yarn build
run: pnpm build
47 changes: 36 additions & 11 deletions .github/workflows/doc-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,65 @@ jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Check
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Node
uses: actions/setup-node@v2

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '14'
cache: 'yarn'
- name: Run Npm Scripts
node-version: '16'

- name: Install pnpm
id: pnpm-install
uses: pnpm/action-setup@v2
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Run scripts
run: |
node -v
yarn -v
yarn install
yarn run build-doc
pnpm run build-doc
- name: Deploy to Surge
uses: dswistowski/surge-sh-action@v1
with:
domain: 'antd-mobile.surge.sh'
project: './dist'
login: ${{ secrets.SURGE_LOGIN }}
token: ${{ secrets.SURGE_TOKEN }}

- name: Deploy to Surge (with SHA)
uses: dswistowski/surge-sh-action@v1
with:
domain: 'antd-mobile-${{ github.sha }}.surge.sh'
project: './dist'
login: ${{ secrets.SURGE_LOGIN }}
token: ${{ secrets.SURGE_TOKEN }}

- name: Create Commit Comment
uses: peter-evans/commit-comment@v1
with:
body: |
Doc site for this release: https://antd-mobile-${{ github.sha }}.surge.sh
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
37 changes: 32 additions & 5 deletions .github/workflows/preview-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,44 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Check
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: build
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install pnpm
id: pnpm-install
uses: pnpm/action-setup@v2
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Build
run: |
yarn
yarn build-doc
pnpm build-doc
- run: |
zip -r dist.zip dist
- name: upload dist artifact
- name: Upload dist artifact
uses: actions/upload-artifact@v2
with:
name: dist
Expand Down
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit $1
pnpm commitlint --edit $1
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

yarn pretty-quick --staged
pnpm pretty-quick --staged
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
strict-peer-dependencies = false
3 changes: 1 addition & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
package.json
/.yarn/
/.yarnrc.yml
/pnpm-lock.yaml
*.min.js
546 changes: 0 additions & 546 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

786 changes: 0 additions & 786 deletions .yarn/releases/yarn-3.2.1.cjs

This file was deleted.

9 changes: 0 additions & 9 deletions .yarnrc.yml

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
$ npm install --save antd-mobile
# or
$ yarn add antd-mobile
# or
$ pnpm add antd-mobile
```

- **Fast**: It is carefully optimized for harsh scenes, without configuration, you can have the best package size and
Expand Down
2 changes: 2 additions & 0 deletions docs/components/icon/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The icons are in a separate npm package. If you want to use the icons, you need
npm install --save antd-mobile-icons
# or
yarn add antd-mobile-icons
# or
pnpm add antd-mobile-icons
```

Then just import the icons you need from this package:
Expand Down
2 changes: 2 additions & 0 deletions docs/components/icon/index.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
npm install --save antd-mobile-icons
# or
yarn add antd-mobile-icons
# or
pnpm add antd-mobile-icons
```

然后从这个包中引入你所需要的图标即可:
Expand Down
3 changes: 1 addition & 2 deletions docs/guide/i18n.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ The following languages are currently supported:
| Kazakh | kk-KZ |
| Indonesian | id-ID |


See more usage at [ConfigProvider](../components/config-provider).

### Add new language
Expand All @@ -39,7 +38,7 @@ Do it step by step:

1. Add a locale file in `src/locales`.
2. Add a test case for the language in [config-provider.test.tsx](https://github.com/ant-design/ant-design-mobile/blob/master/src/components/config-provider/tests/config-provider.test.tsx).
3. Run `yarn test -u` command to update the snapshots.
3. Run `pnpm test -u` command to update the snapshots.
4. (Optional) Add the language to i18n list [i18n.zh.md](https://github.com/ant-design/ant-design-mobile/blob/master/docs/guide/i18n.zh.md)[i18n.en.md](https://github.com/ant-design/ant-design-mobile/blob/master/docs/guide/i18n.en.md).

## FAQ
Expand Down
3 changes: 1 addition & 2 deletions docs/guide/i18n.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ return (
| 哈萨克语 | kk-KZ |
| 印度尼西亚语 | id-ID |


具体的使用方法请参考 [ConfigProvider](../components/config-provider) 文档。

### 增加语言包
Expand All @@ -39,7 +38,7 @@ return (

1.`src/locales` 中增加语言包。
2.[config-provider.test.tsx](https://github.com/ant-design/ant-design-mobile/blob/master/src/components/config-provider/tests/config-provider.test.tsx) 添加改语言的测试用例。
3. 运行 `yarn test -u` 命令,更新 snapshots。
3. 运行 `pnpm test -u` 命令,更新 snapshots。
4. (可选)更新文档 [i18n.zh.md](https://github.com/ant-design/ant-design-mobile/blob/master/docs/guide/i18n.zh.md)[i18n.en.md](https://github.com/ant-design/ant-design-mobile/blob/master/docs/guide/i18n.en.md),增加语言列表。

## FAQ
Expand Down
6 changes: 6 additions & 0 deletions docs/guide/migration.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ First, install `antd-mobile-v2`:
$ npm install --save antd-mobile-v2
# or
$ yarn add antd-mobile-v2
# or
$ pnpm add antd-mobile-v2
```

And then, replace everything that uses `antd-mobile` with `antd-mobile-v2`. For example:
Expand All @@ -38,6 +40,8 @@ Finally, reinstall the `antd-mobile` package as v5:
$ npm install --save antd-mobile
# or
$ yarn add antd-mobile
# or
$ pnpm add antd-mobile
```

Now, the `antd-mobile` in project is v5, and `antd-mobile-v2` is v2.
Expand All @@ -58,6 +62,8 @@ You can use npm alias to install v5:
$ npm install --save antd-mobile-v5@npm:antd-mobile@5
# or
$ yarn add antd-mobile-v5@npm:antd-mobile@5
# or
$ pnpm add antd-mobile-v5@npm:antd-mobile@5
```

And after that, the corresponding `package.json` is:
Expand Down
6 changes: 6 additions & 0 deletions docs/guide/migration.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ v5 是完全重写的一个版本,所以 v2 和 v5 的差异非常之大,其
$ npm install --save antd-mobile-v2
# or
$ yarn add antd-mobile-v2
# or
$ pnpm add antd-mobile-v2
```

然后把项目中所有对 `antd-mobile` 的引入都替换为 `antd-mobile-v2`,例如:
Expand All @@ -38,6 +40,8 @@ import 'antd-mobile-v2/dist/antd-mobile.less'; // or 'antd-mobile-v2/dist/antd-
$ npm install --save antd-mobile
# or
$ yarn add antd-mobile
# or
$ pnpm add antd-mobile
```

现在,你项目中的 `antd-mobile` 是 v5 版本,`antd-mobile-v2` 是 v2 版本。
Expand All @@ -58,6 +62,8 @@ $ yarn add antd-mobile
$ npm install --save antd-mobile-v5@npm:antd-mobile@5
# or
$ yarn add antd-mobile-v5@npm:antd-mobile@5
# or
$ pnpm add antd-mobile-v5@npm:antd-mobile@5
```

对应的 package.json 为:
Expand Down
2 changes: 2 additions & 0 deletions docs/guide/quick-start.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
$ npm install --save antd-mobile
# or
$ yarn add antd-mobile
# or
$ pnpm add antd-mobile
```

## Import
Expand Down
2 changes: 2 additions & 0 deletions docs/guide/quick-start.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
$ npm install --save antd-mobile
# or
$ yarn add antd-mobile
# or
$ pnpm add antd-mobile
```

## 引入
Expand Down
2 changes: 2 additions & 0 deletions docs/guide/ssr.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ First, you need to install `next-transpile-modules`:
$ npm install --save-dev next-transpile-modules
# or
$ yarn add -D next-transpile-modules
# or
$ pnpm add -D next-transpile-modules
```

Then configure it in `next.config.js`:
Expand Down
2 changes: 2 additions & 0 deletions docs/guide/ssr.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
$ npm install --save-dev next-transpile-modules
# or
$ yarn add -D next-transpile-modules
# or
$ pnpm add -D next-transpile-modules
```

然后在 `next.config.js` 中进行配置:
Expand Down
Loading

0 comments on commit 4b8b5bf

Please sign in to comment.