From 4580679b81809d0bbce61f2b3c825e2f495e2032 Mon Sep 17 00:00:00 2001 From: Wenjun Xu <906626481@qq.com> Date: Tue, 23 Jan 2024 18:14:05 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BD=BF=E7=94=A8=20pnpm=20=E4=BD=9C?= =?UTF-8?q?=E4=B8=BA=E5=8C=85=E7=AE=A1=E7=90=86=E5=99=A8=20(#2522)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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: 根据反馈修改 --- .eslintrc.js | 2 +- .github/workflows/auto-release.yml | 13 +- .github/workflows/compressed-size.yml | 6 +- .github/workflows/issue-labeled.yml | 6 +- .github/workflows/lint.yml | 16 +- .github/workflows/release-success.yml | 15 +- .github/workflows/test.yml | 14 +- .husky/pre-push | 2 +- .npmrc | 5 +- .yarnrc | 1 - CONTRIBUTING.en-US.md | 26 +- CONTRIBUTING.md | 28 +- README.en-US.md | 19 +- README.md | 19 +- jest.config.base.js | 12 +- lerna.json | 38 - package.json | 129 +- packages/s2-core/README.en-US.md | 36 +- packages/s2-core/README.md | 35 +- .../__tests__/unit/cell/col-cell-spec.ts | 9 +- .../unit/cell/custom-tree-corner-cell-spec.ts | 10 +- .../__tests__/unit/cell/data-cell-spec.ts | 4 +- .../__tests__/unit/cell/row-cell-spec.ts | 2 +- .../icons/__snapshots__/gui-icon-spec.ts.snap | 12 +- packages/s2-core/package.json | 21 +- packages/s2-core/rollup.config.js | 2 +- packages/s2-core/src/facet/base-facet.ts | 3 +- packages/s2-core/src/ui/scrollbar/index.ts | 2 +- packages/s2-react/README.md | 1 + .../__snapshots__/pagination-spec.tsx.snap | 7 +- .../__snapshots__/index-spec.tsx.snap | 5 +- .../__snapshots__/index-spec.tsx.snap | 3 +- .../sheets/__snapshots__/index-spec.tsx.snap | 15 +- packages/s2-react/package.json | 31 +- .../src/components/advanced-sort/index.tsx | 1 + .../drag-copy/drag-copy-mask.tsx | 2 +- .../src/components/switcher/content/index.tsx | 2 +- packages/s2-react/src/hooks/useLoading.ts | 4 +- packages/s2-shared/package.json | 6 +- packages/s2-vue/README.md | 1 + packages/s2-vue/package.json | 35 +- .../s2-vue/src/components/sheets/index.vue | 5 + pnpm-lock.yaml | 23119 ++++++++++++++++ pnpm-workspace.yaml | 3 + s2-site/docs/common/development.en.md | 34 +- s2-site/docs/common/development.zh.md | 23 +- s2-site/docs/manual/contribution.en.md | 25 +- s2-site/docs/manual/contribution.zh.md | 25 +- s2-site/package.json | 5 +- scripts/add-version.js | 8 +- ...latest-bump-version.js => bump-version.js} | 6 +- scripts/validate-deps.js | 54 - yarn.lock | 16071 ----------- 53 files changed, 23491 insertions(+), 16487 deletions(-) delete mode 100644 .yarnrc delete mode 100644 lerna.json create mode 100644 pnpm-lock.yaml create mode 100644 pnpm-workspace.yaml rename scripts/{latest-bump-version.js => bump-version.js} (65%) delete mode 100644 scripts/validate-deps.js delete mode 100644 yarn.lock diff --git a/.eslintrc.js b/.eslintrc.js index fe4aa12b9a..83935d7f54 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -29,7 +29,7 @@ module.exports = { version: 26, }, react: { - version: 'detect', + version: '17', }, }, rules: { diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index d9bdec78bf..58c3e2f5bc 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -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 @@ -48,10 +52,10 @@ 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 可解决这个问题 @@ -59,7 +63,8 @@ jobs: 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 diff --git a/.github/workflows/compressed-size.yml b/.github/workflows/compressed-size.yml index d3460ded54..50a6604dde 100644 --- a/.github/workflows/compressed-size.yml +++ b/.github/workflows/compressed-size.yml @@ -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" diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml index 31f9629bdf..47c47fc607 100644 --- a/.github/workflows/issue-labeled.yml +++ b/.github/workflows/issue-labeled.yml @@ -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. diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 25f2b16213..c43309deac 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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 @@ -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 }} diff --git a/.github/workflows/release-success.yml b/.github/workflows/release-success.yml index 2ab0beb762..fd7b95539d 100644 --- a/.github/workflows/release-success.yml +++ b/.github/workflows/release-success.yml @@ -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 @@ -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 }} @@ -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: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 939ef5b097..26a7838f3c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -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 @@ -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 diff --git a/.husky/pre-push b/.husky/pre-push index 04c19268ba..88ee19f009 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -2,4 +2,4 @@ . "$(dirname -- "$0")/_/husky.sh" . "$(dirname -- "$0")/common.sh" -yarn validate:deps && yarn lint:type +pnpm lint:type diff --git a/.npmrc b/.npmrc index 214c29d139..8b589de02c 100644 --- a/.npmrc +++ b/.npmrc @@ -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 diff --git a/.yarnrc b/.yarnrc deleted file mode 100644 index 0ada07b033..0000000000 --- a/.yarnrc +++ /dev/null @@ -1 +0,0 @@ -registry "https://registry.npmmirror.com/" diff --git a/CONTRIBUTING.en-US.md b/CONTRIBUTING.en-US.md index d6d2e6da13..6fe3e7b718 100644 --- a/CONTRIBUTING.en-US.md +++ b/CONTRIBUTING.en-US.md @@ -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] (). 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. @@ -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. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 730543c82d..b5825a0c53 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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` 运行单元格测试 diff --git a/README.en-US.md b/README.en-US.md index 9f4e2fdd37..e2902b21bc 100644 --- a/README.en-US.md +++ b/README.en-US.md @@ -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 git@github.com: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 diff --git a/README.md b/README.md index 341116452c..1210bbc8bf 100644 --- a/README.md +++ b/README.md @@ -181,35 +181,36 @@ s2.render(); ## 🤝 参与贡献 +> S2 使用 pnpm 作为包管理器 + ```bash git clone git@github.com: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 ``` ## 👁️ 洞察 diff --git a/jest.config.base.js b/jest.config.base.js index 5ef1f0513a..c6eab24e76 100644 --- a/jest.config.base.js +++ b/jest.config.base.js @@ -15,7 +15,17 @@ module.exports = { transformIgnorePatterns: [], testRegex: '/__tests__/*.*(-|\\.)spec\\.(tsx|ts|js|vue)?$', transform: { - '\\.(t|j)sx?$': '@swc/jest', + '\\.(t|j)sx?$': [ + '@swc/jest', + { + jsc: { + transform: { + // https://swc.rs/docs/configuration/compilation#jsctransformusedefineforclassfields + useDefineForClassFields: false, + }, + }, + }, + ], '\\.vue$': 'vue-jest', '\\.(less|css)$': 'jest-less-loader', '\\.svg$': 'jest-raw-loader', diff --git a/lerna.json b/lerna.json deleted file mode 100644 index 3bc34f0003..0000000000 --- a/lerna.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "version": "independent", - "npmClient": "yarn", - "useWorkspaces": true, - "command": { - "publish": { - "ignoreChanges": [ - "*.md", - "**/_tests_/**" - ], - "message": "chore(release): :bookmark: publish the new version [skip ci]" - }, - "bootstrap": { - "npmClientArgs": [ - "--no-ci" - ] - } - }, - "changelog": { - "repo": "antvis/S2", - "labels": { - "pr(fix)": ":bug: Bug Fix", - "pr(chore)": ":turtle: Chore", - "pr(feature)": ":tada: New feature", - "pr(breaking)": ":boom: Breaking Change", - "pr(internal)": ":house: Internal", - "pr(dependency)": ":shamrock: Dependency", - "pr(documentation)": ":book: Documentation", - "pr(enhancement)": ":rocket: Enhancement", - "pr(refactor)": ":100: Refactoring", - "pr(test)": ":white_check_mark: Test Case" - }, - "cacheDir": ".changelog" - }, - "packages": [ - "packages/*" - ] -} diff --git a/package.json b/package.json index 1dcb151fa9..73d42cbd2c 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@antv/s2", + "name": "@antv/s2-monorepo", "private": true, "license": "MIT", "homepage": "https://s2.antv.antgroup.com", @@ -11,9 +11,6 @@ "bugs": { "url": "https://github.com/antvis/S2/issues" }, - "workspaces": [ - "packages/*" - ], "keywords": [ "antv", "S2", @@ -27,62 +24,55 @@ "spreadsheet" ], "scripts": { - "bootstrap": "yarn", - "clean": "lerna clean -y && rimraf node_modules", - "clean:lock-file": "rm -rf yarn.lock", - "core:start": "yarn workspace @antv/s2 start", - "core:watch": " yarn workspace @antv/s2 watch", - "core:build": "yarn workspace @antv/s2 build", - "core:test": "yarn workspace @antv/s2 test", - "core:sync-event": "yarn workspace @antv/s2 sync-event", - "react:start": "yarn workspace @antv/s2-react test:live", - "react:playground": "yarn workspace @antv/s2-react start", - "react:build": "yarn workspace @antv/s2-react build", - "react:test": "yarn workspace @antv/s2-react test", - "react:watch": " yarn workspace @antv/s2-react watch", - "vue:playground": "yarn workspace @antv/s2-vue start", - "vue:build": "yarn workspace @antv/s2-vue build", - "vue:test": "yarn workspace @antv/s2-vue test", - "vue:watch": " yarn workspace @antv/s2-vue watch", - "build": "lerna run build --include-dependencies --stream", - "build:cjs": "lerna run build:cjs --include-dependencies --stream", - "build:esm": "lerna run build:esm --include-dependencies --stream", - "build:umd": "lerna run build:umd --include-dependencies --stream", - "build:size-limit": "lerna run build:size-limit --stream", - "build:size-limit-json": "lerna run build:size-limit --stream -- --json", - "release": "lerna exec --ignore @antv/s2-shared --concurrency 1 -- npx --no-install semantic-release", - "release:bump-latest": "node ./scripts/latest-bump-version.js", - "release:preview": "yarn release --dry-run --no-ci", - "prepublish:manual": "yarn build", - "publish:manual": "lerna publish", - "test": "lerna run test --stream", - "test:coverage": "lerna run test:coverage --stream", - "test:ci": "lerna run test:ci --stream", - "test:ci-coverage": "lerna run test:ci-coverage --stream", - "test:watch": "lerna run test:watch --stream", - "site:bootstrap": "cd ./s2-site && yarn", - "site:start": "cd ./s2-site && yarn start", - "site:build": "cd ./s2-site && NODE_OPTIONS='--max-old-space-size=4096' yarn build", - "site:clean": "cd ./s2-site && yarn clean", - "site:deploy": "cd ./s2-site && yarn deploy", - "site:preview": "cd ./s2-site && yarn preview", - "site:clear": "cd ./s2-site && yarn rimraf node_modules", - "site:sync-s2-lock": "cd ./s2-site && yarn sync:s2-lock", - "lint": "yarn lint:type && yarn lint:script && yarn lint:style && yarn lint:docs && yarn lint:word", - "lint:type": "lerna run tsc --stream", + "preinstall": "npx only-allow pnpm", + "bootstrap": "pnpm install", + "bootstrap:ci": "pnpm bootstrap --frozen-lockfile", + "prepare": "husky install", + "clean": "pnpm -r --parallel exec rm -rf node_modules && rm -rf node_modules", + "clean:lock-file": "rm -rf pnpm-lock.yaml", + "update:deps": "pnpm update -i", + "core:start": "pnpm --filter @antv/s2 start", + "core:watch": " pnpm --filter @antv/s2 watch", + "core:build": "pnpm --filter @antv/s2 build", + "core:test": "pnpm --filter @antv/s2 test", + "core:sync-event": "pnpm --filter @antv/s2 sync-event", + "react:start": "pnpm --filter @antv/s2-react test:live", + "react:playground": "pnpm --filter @antv/s2-react start", + "react:build": "pnpm --filter @antv/s2-react build", + "react:test": "pnpm --filter @antv/s2-react test", + "react:watch": " pnpm --filter @antv/s2-react watch", + "vue:playground": "pnpm --filter @antv/s2-vue start", + "vue:build": "pnpm --filter @antv/s2-vue build", + "vue:test": "pnpm --filter @antv/s2-vue test", + "vue:watch": " pnpm --filter @antv/s2-vue watch", + "build": "pnpm -r --filter './packages/*' --stream build", + "build:cjs": "pnpm -r --filter './packages/*' --stream build:cjs", + "build:esm": "pnpm -r --filter './packages/*' --stream build:esm", + "build:umd": "pnpm -r --filter './packages/*' --stream build:umd", + "build:size-limit": "pnpm -r --filter './packages/*' --stream build:size-limit", + "build:size-limit-json": "pnpm -r --filter './packages/*' --stream build:size-limit-json", + "release": "pnpm -r --filter !@antv/s2-shared --filter !@antv/s2-site --workspace-concurrency=1 exec npx --no-install semantic-release", + "release:preview": "pnpm release --dry-run --no-ci", + "release:bump-version": "node ./scripts/bump-version.js", + "test": "pnpm -r --filter './packages/*' --stream test", + "test:coverage": "pnpm -r --filter './packages/*' --stream test:coverage", + "test:ci": "pnpm -r --filter './packages/*' --stream test:ci", + "test:ci-coverage": "pnpm -r --filter './packages/*' --stream test:ci-coverage", + "lint": "run-s lint:type lint:script lint:style lint:docs lint:word", + "lint:type": "pnpm -r --filter './packages/*' --stream tsc", "lint:script": "eslint . --ext '.js,.jsx,.ts,.tsx,.vue'", - "lint:style": "stylelint packages/**/*.less --syntax less", + "lint:style": "stylelint packages/**/*.less", "lint:docs": "markdownlint '**/*.md'", "lint:word": "case-police '**/*.md'", - "lint:fix-word": "yarn lint:word --fix", - "lint:fix": "yarn lint:fix-script && yarn lint:fix-style && yarn lint:fix-docs && yarn lint:fix-word", - "lint:fix-script": "yarn lint:script --fix", - "lint:fix-style": "yarn lint:style --fix", - "lint:fix-docs": "yarn lint:docs --fix && yarn lint:fix-word", - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s && lerna run changelog --stream", - "update:deps": "yarn upgrade-interactive", - "prepare": "husky install", - "validate:deps": "node ./scripts/validate-deps.js" + "lint:fix": "run-s lint:fix-script lint:fix-style lint:fix-docs lint:fix-word", + "lint:fix-word": "pnpm lint:word --fix", + "lint:fix-script": "pnpm lint:script --fix", + "lint:fix-style": "pnpm lint:style --fix", + "lint:fix-docs": "pnpm lint:docs --fix", + "site:start": "pnpm --filter @antv/s2-site start", + "site:build": "NODE_OPTIONS='--max-old-space-size=4096' pnpm --filter @antv/s2-site build", + "site:preview": "pnpm --filter @antv/s2-site preview", + "site:deploy": "pnpm --filter @antv/s2-site deploy" }, "commitlint": { "extends": [ @@ -115,6 +105,7 @@ "@rollup/plugin-commonjs": "^21.1.0", "@rollup/plugin-node-resolve": "^13.2.1", "@rollup/plugin-replace": "^3.0.0", + "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^8.2.5", "@rushstack/eslint-patch": "^1.1.3", "@semantic-release/changelog": "^6.0.1", @@ -123,8 +114,8 @@ "@size-limit/esbuild": "^11.0.0", "@size-limit/esbuild-why": "^11.0.0", "@size-limit/file": "^11.0.0", - "@swc/core": "^1.2.171", - "@swc/jest": "^0.2.20", + "@swc/core": "^1.3.95", + "@swc/jest": "^0.2.29", "@types/jest": "^27.4.1", "@types/lodash": "^4.14.182", "@types/node": "^17.0.26", @@ -139,9 +130,8 @@ "@vue/vue3-jest": "^27.0.0-alpha.4", "babel-core": "^7.0.0-bridge.0", "babel-jest": "^26.6.3", - "case-police": "^0.5.3", - "concurrently": "^7.1.0", - "conventional-changelog-cli": "^2.2.2", + "case-police": "^0.5.10", + "concurrently": "^7.5.0", "cpx": "^1.5.0", "cross-env": "^7.0.3", "eslint": "^7.32.0", @@ -155,16 +145,18 @@ "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-vue": "^8.5.0", "gh-pages": "^3.2.3", - "husky": "^7.0.4", + "glob": "^8.0.3", + "husky": "^8.0.2", + "inquirer": "^8.2.0", + "inquirer-autocomplete-prompt": "^2.0.0", "jest": "^26.6.3", "jest-electron": "^0.1.12", "jest-extended": "^0.11.5", - "jest-less-loader": "^0.1.2", + "jest-less-loader": "^0.2.0", "jest-raw-loader": "^1.0.1", "jest-url-loader": "^0.1.0", - "lerna": "^4.0.0", - "less": "^4.1.2", - "lint-staged": "^12.4.0", + "less": "^4.1.3", + "lint-staged": "^13.0.3", "lodash-es": "^4.17.21", "markdownlint-cli": "^0.31.1", "npm-run-all": "^4.1.5", @@ -175,8 +167,7 @@ "rollup": "^2.70.2", "rollup-plugin-peer-deps-external": "^2.2.4", "rollup-plugin-postcss": "^4.0.2", - "rollup-plugin-terser": "^7.0.2", - "rollup-plugin-typescript2": "^0.31.2", + "rollup-plugin-typescript2": "^0.34.1", "rollup-plugin-visualizer": "^5.6.0", "semantic-release": "^18.0.1", "semantic-release-monorepo": "^7.0.5", diff --git a/packages/s2-core/README.en-US.md b/packages/s2-core/README.en-US.md index 7c13467759..4a28c9320b 100644 --- a/packages/s2-core/README.en-US.md +++ b/packages/s2-core/README.en-US.md @@ -70,6 +70,7 @@ demo components and expansion capabilities, it allows developers to use it quick ```bash $ npm install @antv/s2 # yarn add @antv/s2 +# pnpm add @antv/s2 ``` ## 🔨 Getting Started @@ -172,11 +173,11 @@ s2.render() ### 📦 Packages -| Package | Latest | Beta | Alpha | Next | Size | Download | -| - | - | - | - | - | - | - | -| [@antv/s2](https://github.com/antvis/S2/tree/master/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg) | -| [@antv/s2-react](https://github.com/antvis/S2/tree/master/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-react/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-react/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg) | -| [@antv/s2-vue](https://github.com/antvis/S2/tree/master/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-vue/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-vue/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg) | +| Package | Latest | Beta | Alpha | Next | Size | Download | +| ---------------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | +| [@antv/s2](https://github.com/antvis/S2/tree/master/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg) | +| [@antv/s2-react](https://github.com/antvis/S2/tree/master/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-react/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-react/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg) | +| [@antv/s2-vue](https://github.com/antvis/S2/tree/master/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-vue/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-vue/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg) | ## 👤 Author @@ -187,20 +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 git@github.com:antvis/S2.git cd S2 -yarn +pnpm install # or pnpm bootstrap -yarn core:start +# build all +pnpm build -# start the website +# debug s2-core +pnpm core:start + +# debug s2-react +pnpm react:playground -yarn site:bootstrap +# debug s2-vue +pnpm vue:playground -yarn site:start +# unit test +pnpm test + +# check the code style and the type definition +pnpm lint + +# start the website +pnpm site:start ``` ## 📧 Contact Us diff --git a/packages/s2-core/README.md b/packages/s2-core/README.md index aae2db40f2..c04f9fec8c 100644 --- a/packages/s2-core/README.md +++ b/packages/s2-core/README.md @@ -66,6 +66,7 @@ S2 是 AntV 在多维交叉分析表格领域的解决方案,完全基于数 ```bash $ npm install @antv/s2 # yarn add @antv/s2 +# pnpm add @antv/s2 ``` ## 🔨 使用 @@ -168,11 +169,11 @@ s2.render(); ### 📦 Packages -| Package | Latest | Beta | Alpha | Next | Size | Download | -| - | - | - | - | - | - | - | -| [@antv/s2](https://github.com/antvis/S2/tree/master/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg) | -| [@antv/s2-react](https://github.com/antvis/S2/tree/master/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-react/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-react/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg) | -| [@antv/s2-vue](https://github.com/antvis/S2/tree/master/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-vue/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-vue/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg) | +| Package | Latest | Beta | Alpha | Next | Size | Download | +| ---------------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | +| [@antv/s2](https://github.com/antvis/S2/tree/master/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg) | +| [@antv/s2-react](https://github.com/antvis/S2/tree/master/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-react/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-react/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg) | +| [@antv/s2-vue](https://github.com/antvis/S2/tree/master/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-vue/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-vue/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg) | ## 👤 Author @@ -180,32 +181,36 @@ s2.render(); ## 🤝 参与贡献 +> S2 使用 pnpm 作为包管理器 + ```bash git clone git@github.com:antvis/S2.git cd S2 # 安装依赖 -yarn # 或者 yarn bootstrap +pnpm install # 或者 pnpm bootstrap + +# 打包 +pnpm build # 调试 s2-core -yarn core:start +pnpm core:start # 调试 s2-react -yarn react:playground +pnpm react:playground -# 单元测试 -yarn test +# 调试 s2-vue +pnpm vue:playground -# 打包 -yarn build +# 单元测试 +pnpm test # 代码风格和类型检测 -yarn lint +pnpm lint # 本地启动官网 -yarn site:bootstrap -yarn site:start +pnpm site:start ``` ## 📧 联系我们 diff --git a/packages/s2-core/__tests__/unit/cell/col-cell-spec.ts b/packages/s2-core/__tests__/unit/cell/col-cell-spec.ts index 978403bb35..3fff88b3ac 100644 --- a/packages/s2-core/__tests__/unit/cell/col-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/cell/col-cell-spec.ts @@ -58,9 +58,8 @@ describe('Col Cell Tests', () => { const colCell = new ColCell(node, s2, { ...headerConfig }); set(colCell, 'actualTextWidth', actualTextWidth); // 文字总长度 - - const getTextPosition = get(colCell, 'getTextPosition').bind(colCell); - expect(getTextPosition()).toEqual({ + // @ts-ignore + expect(colCell.getTextPosition()).toEqual({ x: textX, y: 15, }); @@ -99,8 +98,8 @@ describe('Col Cell Tests', () => { const colCell = new ColCell(node, s2, { ...headerConfig }); set(colCell, 'actualTextWidth', actualTextWidth); // 文字总长度 - const getIconPosition = get(colCell, 'getIconPosition').bind(colCell); - expect(getIconPosition()).toEqual({ + // @ts-ignore + expect(colCell.getIconPosition()).toEqual({ x: iconX, y: 10, }); diff --git a/packages/s2-core/__tests__/unit/cell/custom-tree-corner-cell-spec.ts b/packages/s2-core/__tests__/unit/cell/custom-tree-corner-cell-spec.ts index 9d5d934dad..f178ba8df9 100644 --- a/packages/s2-core/__tests__/unit/cell/custom-tree-corner-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/cell/custom-tree-corner-cell-spec.ts @@ -41,9 +41,8 @@ describe('test for corner text', () => { mockSheet.render(); test('get correct default corner text when the corner label is empty.', () => { - const cornerCells = get( - mockSheet, - 'facet.cornerBBox.facet.cornerHeader.cfg.children', + const cornerCells = ( + get(mockSheet, 'facet.cornerBBox.facet.cornerHeader.cfg.children') as any ).filter((v) => v instanceof CornerCell); expect(cornerCells[0].actualText).toEqual('指标'); expect(cornerCells[1].actualText).toEqual('type'); @@ -52,9 +51,8 @@ describe('test for corner text', () => { test('get correct default corner text when set the cornerText.', () => { mockSheet.setOptions({ ...options, cornerText: 'test' }); mockSheet.render(); - const cornerCells = get( - mockSheet, - 'facet.cornerBBox.facet.cornerHeader.cfg.children', + const cornerCells = ( + get(mockSheet, 'facet.cornerBBox.facet.cornerHeader.cfg.children') as any ).filter((v) => v instanceof CornerCell); expect(cornerCells[0].actualText).toEqual('test'); expect(cornerCells[1].actualText).toEqual('type'); diff --git a/packages/s2-core/__tests__/unit/cell/data-cell-spec.ts b/packages/s2-core/__tests__/unit/cell/data-cell-spec.ts index 6c12a66b3b..9c0e44ab2c 100644 --- a/packages/s2-core/__tests__/unit/cell/data-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/cell/data-cell-spec.ts @@ -78,7 +78,7 @@ describe('Data Cell Tests', () => { // 宽度相当 const linkLength = maxX - minX; expect( - Math.abs(linkLength - get(dataCell, 'actualTextWidth')), + Math.abs(linkLength - get(dataCell, 'actualTextWidth', 0)), ).toBeLessThanOrEqual(2); // link shape 的中点坐标与 text 中点对齐 @@ -114,7 +114,7 @@ describe('Data Cell Tests', () => { }); test('should return correct formatted value', () => { - const formatter: Formatter = (_, data) => `${get(data, 'value') * 10}`; + const formatter: Formatter = (_, data) => `${get(data, 'value', 0) * 10}`; jest.spyOn(s2.dataSet, 'getFieldFormatter').mockReturnValue(formatter); const dataCell = new DataCell(meta, s2); diff --git a/packages/s2-core/__tests__/unit/cell/row-cell-spec.ts b/packages/s2-core/__tests__/unit/cell/row-cell-spec.ts index 9b4c9f3822..aa92f9db9c 100644 --- a/packages/s2-core/__tests__/unit/cell/row-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/cell/row-cell-spec.ts @@ -43,7 +43,7 @@ describe('Row Cell Tests', () => { // 宽度相当 const linkLength = maxX - minX; expect( - Math.abs(linkLength - get(provinceCell, 'actualTextWidth')), + Math.abs(linkLength - get(provinceCell, 'actualTextWidth', 0)), ).toBeLessThanOrEqual(2); // link shape 的中点坐标与 text 中点对齐 diff --git a/packages/s2-core/__tests__/unit/common/icons/__snapshots__/gui-icon-spec.ts.snap b/packages/s2-core/__tests__/unit/common/icons/__snapshots__/gui-icon-spec.ts.snap index 4cb679838b..3fc2da5996 100644 --- a/packages/s2-core/__tests__/unit/common/icons/__snapshots__/gui-icon-spec.ts.snap +++ b/packages/s2-core/__tests__/unit/common/icons/__snapshots__/gui-icon-spec.ts.snap @@ -28,7 +28,7 @@ GuiIcon { "zIndex": 0, }, "destroyed": false, - "iconImageShape": ImageShape1 { + "iconImageShape": ImageShape { "_events": Object {}, "attrs": Object { "animable": true, @@ -98,7 +98,7 @@ GuiIcon { "zIndex": 0, }, "destroyed": false, - "iconImageShape": ImageShape1 { + "iconImageShape": ImageShape { "_events": Object {}, "attrs": Object { "animable": true, @@ -168,7 +168,7 @@ GuiIcon { "zIndex": 0, }, "destroyed": false, - "iconImageShape": ImageShape1 { + "iconImageShape": ImageShape { "_events": Object {}, "attrs": Object { "animable": true, @@ -238,7 +238,7 @@ GuiIcon { "zIndex": 0, }, "destroyed": false, - "iconImageShape": ImageShape1 { + "iconImageShape": ImageShape { "_events": Object {}, "attrs": Object { "animable": true, @@ -308,7 +308,7 @@ GuiIcon { "zIndex": 0, }, "destroyed": false, - "iconImageShape": ImageShape1 { + "iconImageShape": ImageShape { "_events": Object {}, "attrs": Object { "animable": true, @@ -378,7 +378,7 @@ GuiIcon { "zIndex": 0, }, "destroyed": false, - "iconImageShape": ImageShape1 { + "iconImageShape": ImageShape { "_events": Object {}, "attrs": Object { "animable": true, diff --git a/packages/s2-core/package.json b/packages/s2-core/package.json index 3fd0c6d5e7..b57672de81 100644 --- a/packages/s2-core/package.json +++ b/packages/s2-core/package.json @@ -40,7 +40,7 @@ "table" ], "scripts": { - "start": "yarn test:live", + "start": "pnpm test:live", "clean": "rimraf lib esm dist temp", "build": "npm-run-all clean --parallel build:umd build:cjs build:esm build:dts", "build:esm": "cross-env FORMAT=es rollup -c rollup.config.js", @@ -48,20 +48,19 @@ "build:umd": "cross-env FORMAT=umd rollup -c rollup.config.js", "build:analysis": "cross-env FORMAT=esm ANALYSIS=true rollup -c rollup.config.js", "build:dts": "run-s dts:*", - "build:size-limit": "size-limit", - "build:size-limit-json": "yarn build:size-limit --json", "dts:build": "tsc -p tsconfig.declaration.json", "dts:extract": "cross-env LIB=s2-core node ../../scripts/dts.js", - "watch": "rimraf esm && yarn build:esm -w", + "build:size-limit": "size-limit", + "build:size-limit-json": "pnpm build:size-limit -- --json", + "watch": "rimraf esm && pnpm build:esm -w", "test:live": "node ./scripts/test-live.mjs", "sync-event": "node ./scripts/sync-event.mjs", "test": "jest --passWithNoTests", - "test:coverage": "yarn test --coverage", - "test:ci": "yarn test --maxWorkers=3", - "test:ci-coverage": "yarn test:coverage --maxWorkers=3", - "test:watch": "yarn test --watch", - "tsc": "tsc --noEmit", - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s" + "test:coverage": "pnpm test -- --coverage", + "test:ci": "pnpm test -- --maxWorkers=3", + "test:ci-coverage": "pnpm test:coverage --maxWorkers=3", + "test:watch": "pnpm test -- --watch", + "tsc": "tsc --noEmit" }, "dependencies": { "@antv/event-emitter": "^0.1.3", @@ -78,8 +77,6 @@ "@types/d3-timer": "^3.0.0", "csstype": "^3.0.11", "d3-dsv": "^1.1.1", - "inquirer": "^8.2.0", - "inquirer-autocomplete-prompt": "^2.0.0", "tinycolor2": "^1.4.2" }, "sideEffects": [ diff --git a/packages/s2-core/rollup.config.js b/packages/s2-core/rollup.config.js index cc6c536c39..4326fdb1a6 100644 --- a/packages/s2-core/rollup.config.js +++ b/packages/s2-core/rollup.config.js @@ -4,7 +4,7 @@ import commonjs from '@rollup/plugin-commonjs'; import resolve from '@rollup/plugin-node-resolve'; import replace from '@rollup/plugin-replace'; import postcss from 'rollup-plugin-postcss'; -import { terser } from 'rollup-plugin-terser'; +import terser from '@rollup/plugin-terser'; import typescript from 'rollup-plugin-typescript2'; import { visualizer } from 'rollup-plugin-visualizer'; import peerDepsExternal from 'rollup-plugin-peer-deps-external'; diff --git a/packages/s2-core/src/facet/base-facet.ts b/packages/s2-core/src/facet/base-facet.ts index 63d8e9da61..ccbda879de 100644 --- a/packages/s2-core/src/facet/base-facet.ts +++ b/packages/s2-core/src/facet/base-facet.ts @@ -1,5 +1,4 @@ -import type { Event as GraphEvent } from '@antv/g-base'; -import type { IElement, IGroup } from '@antv/g-canvas'; +import type { IElement, IGroup, Event as GraphEvent } from '@antv/g-canvas'; import { Group } from '@antv/g-canvas'; import { Wheel, type GestureEvent } from '@antv/g-gesture'; import { interpolateArray } from 'd3-interpolate'; diff --git a/packages/s2-core/src/ui/scrollbar/index.ts b/packages/s2-core/src/ui/scrollbar/index.ts index 169016225c..1e4aea806e 100644 --- a/packages/s2-core/src/ui/scrollbar/index.ts +++ b/packages/s2-core/src/ui/scrollbar/index.ts @@ -317,7 +317,7 @@ export class ScrollBar extends Group { this.isMobile = isMobile; - const event: MouseEvent = this.isMobile ? get(e, 'touches.0', e) : e; + const event = (this.isMobile ? get(e, 'touches.0', e) : e) as MouseEvent; const { clientX, clientY } = event; // 将开始的点记录下来 diff --git a/packages/s2-react/README.md b/packages/s2-react/README.md index 0a2719872f..8881ab1bc7 100644 --- a/packages/s2-react/README.md +++ b/packages/s2-react/README.md @@ -26,6 +26,7 @@ ```bash $ npm install @antv/s2-react # yarn add @antv/s2-react +# pnpm add @antv/s2-react ``` ## 🔨 使用 diff --git a/packages/s2-react/__tests__/spreadsheet/__snapshots__/pagination-spec.tsx.snap b/packages/s2-react/__tests__/spreadsheet/__snapshots__/pagination-spec.tsx.snap index 2c0a0a8ff5..f1590b3e7e 100644 --- a/packages/s2-react/__tests__/spreadsheet/__snapshots__/pagination-spec.tsx.snap +++ b/packages/s2-react/__tests__/spreadsheet/__snapshots__/pagination-spec.tsx.snap @@ -6,7 +6,6 @@ exports[`Pagination Tests should receive antd component extra prop >