Skip to content

Commit

Permalink
chore: 使用 pnpm 作为包管理器 (#2522)
Browse files Browse the repository at this point in the history
* chore: 使用 pnpm 作为包管理器

* fix: lint and test 修复

* test: 单测修复

* style: lint fix

* chore: 将 vue 版本限定在 3.3

* fix: 解决 indirect type reference bug

* fix: 修复 build:size-limit 命令错误

* ci: 统一 node version

* refactor: 根据反馈修改
  • Loading branch information
wjgogogo authored Jan 23, 2024
1 parent d68adcc commit 4580679
Show file tree
Hide file tree
Showing 53 changed files with 23,491 additions and 16,487 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
version: 26,
},
react: {
version: 'detect',
version: '17',
},
},
rules: {
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ jobs:
with:
python-version: '3.10'

- uses: pnpm/action-setup@v2
with:
version: 8

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }} # semantic-release 需要 >= 16 的 Node.js 环境
cache: 'yarn'
cache: 'pnpm'

# 发布开始通知
- name: Release start ding talk dev group notify
Expand All @@ -48,18 +52,19 @@ jobs:
}
- name: Install dependencies
run: yarn
run: pnpm bootstrap:ci

- name: Build
run: yarn build
run: pnpm build

# 自动发布完成后 触发 github.release.published 事件
# 如果是 action 自带的 机器人 token, 出于安全考虑, github 会禁止循环触发, 使用真实用户的 token 可解决这个问题
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.JINKE_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn release
npm_config_legacy_peer_deps: true
run: pnpm release

# 发布失败通知内部开发群
- name: Release failed ding talk dev group notify
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/compressed-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ jobs:
with:
python-version: '3.10'

- uses: pnpm/action-setup@v2
with:
version: 8

- uses: preactjs/compressed-size-action@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
pattern: "./packages/**/dist/**/*.{js,css}"
build-script: "build:umd"
# clean-script: "clean:lock-file"
clean-script: "clean"
6 changes: 3 additions & 3 deletions .github/workflows/issue-labeled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ jobs:
如有任何 `2.0 版本` 问题,请前往[讨论区](https://github.com/antvis/S2/discussions/1933),正式版预计年底发布 (文档施工中 🚧), 抢先试用:
```bash
yarn add @antv/s2@next
yarn add @antv/s2-react@next
yarn add @antv/s2-vue@next
yarn add @antv/s2@next # pnpm add @antv/s2@next
yarn add @antv/s2-react@next # pnpm add @antv/s2-react@next
yarn add @antv/s2-vue@next # pnpm add @antv/s2-vue@next
```
Hello, @${{ github.event.issue.user.login }}, This feature or flaw has been supported or fixed in `2.0 next version`, `next` version is currently in private beta, thank you for your support and understanding.
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
node-version: [18]
node-version: [20]

steps:
- uses: actions/checkout@v4
Expand All @@ -23,23 +23,27 @@ jobs:
with:
python-version: '3.10'

- uses: pnpm/action-setup@v2
with:
version: 8

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache: 'pnpm'

- name: Install dependencies
run: yarn
run: pnpm bootstrap:ci

- name: Lint scripts, type, style and docs
run: yarn lint
run: pnpm lint

- name: Build
run: yarn build
run: pnpm build

- name: Bundle size limit
run: yarn build:size-limit
run: pnpm build:size-limit
env:
CI: true
BUNDLESIZE_GITHUB_TOKEN: ${{ secrets.BUNDLESIZE_GITHUB_TOKEN }}
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/release-success.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ jobs:
runs-on: ubuntu-latest
# 自动发布成功后
if: github.event.workflow_run.conclusion == 'success'
defaults:
run:
working-directory: s2-site
strategy:
matrix:
node-version: [18]
node-version: [20]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -54,7 +57,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.JINKE_GITHUB_TOKEN }}

# 开始部署官网
- name: 🔊 Delpoy start notify
- name: 🔊 Deploy start notify
uses: zcong1993/actions-ding@master
with:
dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN }}
Expand All @@ -72,14 +75,14 @@ jobs:
# 安装官网依赖
- name: Install Dependencies
run: yarn site:bootstrap
run: yarn

# 部署官网
- name: Delpoy Site
run: yarn site:deploy
- name: Deploy Site
run: yarn deploy

# 失败通知
- name: 🔊 Delpoy failed notify
- name: 🔊 Deploy failed notify
if: ${{ failure() }}
uses: zcong1993/actions-ding@master
with:
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
node-version: [18]
node-version: [20]

steps:
- uses: actions/checkout@v4
Expand All @@ -26,18 +26,22 @@ jobs:
with:
python-version: '3.10'

- uses: pnpm/action-setup@v2
with:
version: 8

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache: 'pnpm'

- name: Install dependencies
run: yarn
run: pnpm bootstrap:ci

- name: Test
run: |
yarn test:ci-coverage
pnpm test:ci-coverage
- name: Upload test coverage
uses: codecov/codecov-action@v3
Expand Down Expand Up @@ -68,7 +72,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
labels: '🚨 test failed'

- name: Remove test failed label
if: ${{ success() && github.event.pull_request.number != '' }}
uses: actions-cool/issues-helper@main
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
. "$(dirname -- "$0")/_/husky.sh"
. "$(dirname -- "$0")/common.sh"

yarn validate:deps && yarn lint:type
pnpm lint:type
5 changes: 4 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
registry=https://registry.npmjs.org/
npm_config_legacy_peer_deps=true
side-effects-cache=false
prefer-workspace-packages=true
auto-install-peers=false
1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

26 changes: 13 additions & 13 deletions CONTRIBUTING.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ We are sorry to push bugs. And we would appreciate that if you could report them
## Pull Request

1. Fork the project and clone it (or use GitHub's Codespace function, which is very convenient).
2. Installation dependency: `yarn bootstrap` or `yarn`.
2. Installation dependency: `pnpm bootstrap` or `pnpm`.
3. Commit your changes, and please follow [AngularJS Git Commit Message Conventions] (<https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#heading=h.uyo6cb12dt6w>).
4. If your change is a bug fix, you can add `close #issue number` after the submission information so that after the pr merge, the related issue could be closed automatically. eg: `fix: render bug close #123`.
5. Make sure to add the related unit test.
Expand All @@ -46,19 +46,19 @@ We are sorry to push bugs. And we would appreciate that if you could report them

## Development Process

We use `yarn@v1` as package management.
We use `pnpm@v8` as package management.

```bash
npm i -g yarn
npm i -g pnpm
```

1. `yarn bootstrap`: Installation dependency.
2. `yarn site:bootstrap`: Install site related dependencies.
3. `yarn site:start`: Starts the local `S2` website.
4. `yarn core:start`: Debug and test local `@antv/s2`(Based on jest-electron).
5. `yarn react:start` Debug and test local `@antv/s2-react` (Based on jest-electron).
6. `yarn vue:start` Debug and test local `@antv/s2-vue` (Based on jest-electron).
7. `yarn react:playground` Starts the local `@antv/s2-react` playground (Based on vite).
8. `yarn vue:playground` Starts the local `@antv/s2-vue` playground (Based on vite).
9. `yarn build`: Builds `@antv/s2` and `@antv/s2-react` and `@antv/s2-vue` , outputs are `umd`, `esm` and `lib` directories.
10. `yarn test`: Run unit tests.
1. `pnpm bootstrap`: Installation dependency.
2. `pnpm site:bootstrap`: Install site related dependencies.
3. `pnpm site:start`: Starts the local `S2` website.
4. `pnpm core:start`: Debug and test local `@antv/s2`(Based on jest-electron).
5. `pnpm react:start` Debug and test local `@antv/s2-react` (Based on jest-electron).
6. `pnpm vue:start` Debug and test local `@antv/s2-vue` (Based on jest-electron).
7. `pnpm react:playground` Starts the local `@antv/s2-react` playground (Based on vite).
8. `pnpm vue:playground` Starts the local `@antv/s2-vue` playground (Based on vite).
9. `pnpm build`: Builds `@antv/s2` and `@antv/s2-react` and `@antv/s2-vue` , outputs are `umd`, `esm` and `lib` directories.
10. `pnpm test`: Run unit tests.
28 changes: 14 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,29 @@
## Pull Request

1. fork 项目 并 clone 下来 (或者使用 GitHub 的 Codespace 功能,非常方便)
2. 安装依赖:`yarn bootstrap` 或者 `yarn`
2. 安装依赖:`pnpm bootstrap` 或者 `pnpm install`
3. 提交你的改动,commit 请遵守 [AngularJS Git Commit Message Conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#heading=h.uyo6cb12dt6w)
4. 如果你的改动是修复 bug, 还可以在提交信息后面加上 `close #issue 号`, 这样可以在 pr 合并后,可以自动关闭对应的 issue, 比如 `fix: render bug close #123`
5. 确保加上了对应的单元测试和文档 (如果有 `Snapshot` UI 快照 (.snap 文件)更新, 可以运行 `yarn core:test -- -u``yarn react:test -- -u` 自动更新, 并一起提交上来, 请勿手动编辑)
5. 确保加上了对应的单元测试和文档 (如果有 `Snapshot` UI 快照 (.snap 文件)更新, 可以运行 `pnpm core:test -- -u``pnpm react:test -- -u` 自动更新, 并一起提交上来, 请勿手动编辑)
6. 所有 Lint 和 Test 检查通过后,并且 review 通过,我们会合并你的 pr.

![preview](https://gw.alipayobjects.com/zos/antfincdn/ssOxFrycD/86339514-5f9a-4101-8690-e47c97cd8af5.png)

## 开发流程

我们使用 `yarn@v1` 作为包管理
我们使用 `pnpm@v8` 作为包管理

```bash
npm i -g yarn
npm i -g pnpm
```

1. `yarn bootstrap` 安装依赖
2. `yarn site:bootstrap` 安装网站相关依赖
3. `yarn site:start` 启动本地的 `S2` 网站
4. `yarn core:start` 可视化的方式调试核心层 `@antv/s2` (基于 jest-electron)
5. `yarn react:start` 可视化的方式调试组件层 `@antv/s2-react` (基于 jest-electron)
6. `yarn vue:start` 可视化的方式调试组件层 `@antv/s2-vue` (基于 jest-electron)
7. `yarn react:playground` 启动本地的组件层 `@antv/s2-react` demo (基于 vite)
8. `yarn vue:playground` 启动本地的组件层 `@antv/s2-vue` demo (基于 vite)
9. `yarn build` 构建 `@antv/s2``@antv/s2-react``@antv/s2-vue` 三个包, 分别输出 `umd`, `esm``lib` 目录
10. `yarn test` 运行单元格测试
1. `pnpm bootstrap` 安装依赖
2. `pnpm site:bootstrap` 安装网站相关依赖
3. `pnpm site:start` 启动本地的 `S2` 网站
4. `pnpm core:start` 可视化的方式调试核心层 `@antv/s2` (基于 jest-electron)
5. `pnpm react:start` 可视化的方式调试组件层 `@antv/s2-react` (基于 jest-electron)
6. `pnpm vue:start` 可视化的方式调试组件层 `@antv/s2-vue` (基于 jest-electron)
7. `pnpm react:playground` 启动本地的组件层 `@antv/s2-react` demo (基于 vite)
8. `pnpm vue:playground` 启动本地的组件层 `@antv/s2-vue` demo (基于 vite)
9. `pnpm build` 构建 `@antv/s2``@antv/s2-react``@antv/s2-vue` 三个包, 分别输出 `umd`, `esm``lib` 目录
10. `pnpm test` 运行单元格测试
19 changes: 10 additions & 9 deletions README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,34 +188,35 @@ s2.render();
Contributions, issues and feature requests are welcome.
Feel free to check [issues](https://github.com/antvis/S2/issues) page if you want to contribute.

> S2 use pnpm as package manager
```bash
git clone [email protected]:antvis/S2.git

cd S2

yarn # or yarn bootstrap
pnpm install # or pnpm bootstrap

# build all
yarn build
pnpm build

# debug s2-core
yarn core:start
pnpm core:start

# debug s2-react
yarn react:playground
pnpm react:playground

# debug s2-vue
yarn vue:playground
pnpm vue:playground

# unit test
yarn test
pnpm test

# check the code style and the type definition
yarn lint
pnpm lint

# start the website
yarn site:bootstrap
yarn site:start
pnpm site:start
```

## 👁️ Insight
Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,35 +181,36 @@ s2.render();

## 🤝 参与贡献

> S2 使用 pnpm 作为包管理器
```bash
git clone [email protected]:antvis/S2.git

cd S2

# 安装依赖
yarn # 或者 yarn bootstrap
pnpm install # 或者 pnpm bootstrap

# 打包
yarn build
pnpm build

# 调试 s2-core
yarn core:start
pnpm core:start

# 调试 s2-react
yarn react:playground
pnpm react:playground

# 调试 s2-vue
yarn vue:playground
pnpm vue:playground

# 单元测试
yarn test
pnpm test

# 代码风格和类型检测
yarn lint
pnpm lint

# 本地启动官网
yarn site:bootstrap
yarn site:start
pnpm site:start
```

## 👁️ 洞察
Expand Down
Loading

0 comments on commit 4580679

Please sign in to comment.