Skip to content

Commit

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

* refactor: 更新 validate-deps 路径

* chore: 替换子包中 package.json 脚本

* chore: 更新 g-lite 版本

* chore: 替换根目录中 package.json 配置

* chore: 更新 github action

* chore: 修复 s2-react 层依赖问题

* chore: 将 s2-site 加入 workspace

* chore: 删除 lerna 相关配置

* chore: 修复 lint fix 传参方式

* chore: 处理幽灵依赖

* test: 修复 antd 升级后的单测问题

* chore:  取消 test 脚本并行

* test: 修复单测

* chore: 修复 compressed action 报错

* docs: 更新贡献文档

* revert: revert clean script

* fix: 修复 jest-less-loader 测试时无法找到 node_modules 样式文件问题

* chore: 更新 pnpm-lock

* chore: 简化 bump-version 命令
  • Loading branch information
wjgogogo authored Jan 9, 2023
1 parent 0f3ea3b commit 5db92c8
Show file tree
Hide file tree
Showing 32 changed files with 23,227 additions and 16,861 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ jobs:
with:
python-version: '3.10'

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

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

# 发布开始通知
- name: Release start ding talk dev group notify
Expand All @@ -45,10 +49,10 @@ jobs:
}
- name: Install dependencies
run: yarn
run: pnpm bootstrap

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

# 自动发布完成后 触发 github.release.published 事件
# 如果是 action 自带的 机器人 token, 出于安全考虑, github 会禁止循环触发, 使用真实用户的 token 可解决这个问题
Expand All @@ -57,7 +61,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.JINKE_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
npm_config_legacy_peer_deps: true
run: yarn release
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 @@ -19,9 +19,13 @@ jobs:
with:
python-version: '3.10'

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

- 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"
14 changes: 9 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,27 @@ jobs:
with:
python-version: '3.10'

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

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

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

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

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

- name: Bundle size
run: yarn bundle:size
run: pnpm bundle:size
env:
CI: true
BUNDLESIZE_GITHUB_TOKEN: ${{ secrets.BUNDLESIZE_GITHUB_TOKEN }}
Expand Down
25 changes: 14 additions & 11 deletions .github/workflows/release-success.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ jobs:
runs-on: ubuntu-latest
# 自动发布成功后
if: github.event.workflow_run.conclusion == 'success'
defaults:
run:
working-directory: s2-site
steps:
- uses: actions/checkout@v3

- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'

- name: Git bootstrap
run: |
git config --global user.name 'Jinke Li'
Expand Down Expand Up @@ -50,7 +47,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 @@ -66,16 +63,22 @@ jobs:
}
}
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'

# 安装官网依赖
- 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
12 changes: 8 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,22 @@ jobs:
with:
python-version: '3.10'

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

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

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

- name: Test
run: |
yarn test:ci-coverage
pnpm test:ci-coverage
- name: Upload test coverage
uses: codecov/codecov-action@v2
Expand Down Expand Up @@ -67,7 +71,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
yarn lint:type
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
npm_config_legacy_peer_deps=true
side-effects-cache=false
prefer-workspace-packages=true
7 changes: 0 additions & 7 deletions .yarnrc

This file was deleted.

19 changes: 10 additions & 9 deletions README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,34 +187,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 @@ -180,35 +180,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
38 changes: 0 additions & 38 deletions lerna.json

This file was deleted.

Loading

0 comments on commit 5db92c8

Please sign in to comment.