diff --git a/.dumi/theme/builtins/Previewer/CodePreviewer.tsx b/.dumi/theme/builtins/Previewer/CodePreviewer.tsx index e5516170cf93..b9c0ec0896f5 100644 --- a/.dumi/theme/builtins/Previewer/CodePreviewer.tsx +++ b/.dumi/theme/builtins/Previewer/CodePreviewer.tsx @@ -255,7 +255,7 @@ const CodePreviewer: React.FC = (props) => { 'react@18/umd/react.development.js', 'react-dom@18/umd/react-dom.development.js', 'dayjs@1/dayjs.min.js', - `antd@${pkg.version}/dist/antd-with-locales.js`, + `antd@${pkg.version}/dist/antd-with-locales.min.js`, `@ant-design/icons/dist/index.umd.js`, 'react-router-dom/dist/umd/react-router-dom.production.min.js', 'react-router/dist/umd/react-router.production.min.js', diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f2b6233dbf18..c5bf95428fdc 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -61,18 +61,3 @@ Describe changes from the user side, and list all potential break changes or oth - [ ] Demo is updated/provided or not needed - [ ] TypeScript definition is updated/provided or not needed - [ ] Changelog is provided or not needed - ---- - - - -### 🚀 Summary - -copilot:summary - -### 🔍 Walkthrough - -copilot:walkthrough diff --git a/.github/PULL_REQUEST_TEMPLATE/pr_cn.md b/.github/PULL_REQUEST_TEMPLATE/pr_cn.md index a72aa0c3ea49..046c0c2f54a7 100644 --- a/.github/PULL_REQUEST_TEMPLATE/pr_cn.md +++ b/.github/PULL_REQUEST_TEMPLATE/pr_cn.md @@ -61,17 +61,3 @@ - [ ] 代码演示已提供或无须提供 - [ ] TypeScript 定义已补充或无须补充 - [ ] Changelog 已提供或无须提供 - ---- - - - -### 🚀 概述 - -copilot:summary - -### 🔍 实现细节 - -copilot:walkthrough diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2e295185ab04..48d80d6a9bb3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -141,7 +141,7 @@ jobs: strategy: matrix: react: ['16', '17', '18'] - module: ['dom', 'node', 'dist'] + module: ['dom', 'node', 'dist', 'dist-min'] shard: ['1/2', '2/2'] env: REACT: ${{ matrix.react }} @@ -179,7 +179,7 @@ jobs: run: npm run install-react-18 - name: restore cache from dist - if: ${{ matrix.module == 'dist' }} + if: ${{ matrix.module == 'dist' || matrix.module == 'dist-min' }} uses: actions/cache@v3 with: path: dist @@ -224,6 +224,13 @@ jobs: run: npm test env: LIB_DIR: dist + + # dist min test + - name: dist-min test + if: ${{ matrix.module == 'dist-min' }} + run: npm test + env: + LIB_DIR: dist-min needs: [setup, dist] ############################ Test Coverage ########################### diff --git a/.github/workflows/visual-regression-persist-finish.yml b/.github/workflows/visual-regression-persist-finish.yml new file mode 100644 index 000000000000..af7a76ecffb7 --- /dev/null +++ b/.github/workflows/visual-regression-persist-finish.yml @@ -0,0 +1,107 @@ +# Each `push on master` will persist image-snapshots that used as compare target in visual regression. + +name: Visual Regression Persist Finish + +on: + workflow_run: + workflows: ["name: Visual Regression Persist Start"] + types: + - completed + +permissions: + contents: read + +jobs: + upstream-workflow-summary: + name: upstream workflow summary + runs-on: ubuntu-latest + outputs: + jobs: ${{ steps.persist_start_job_status.outputs.result }} + build-success: ${{ steps.persist_start_job_status.outputs.build-success }} + build-failure: ${{ steps.persist_start_job_status.outputs.build-failure }} + steps: + - name: summary jobs status + uses: actions/github-script@v6 + id: persist_start_job_status + with: + # todo: split it out as github actions + script: | + const response = await github.rest.actions.listJobsForWorkflowRun({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{ github.event.workflow_run.id }}, + }); + + // { [name]: [conclusion] }, e.g. { 'test image': 'success' } + const jobs = (response.data?.jobs ?? []).reduce((acc, job) => { + if(job?.status === 'completed' && 'name' in job && 'conclusion' in job) { + acc[job.name] = job.conclusion; + } + return acc; + }, {}); + + const total = Object.keys(jobs).length; + if(total === 0) core.setFailed('no jobs found'); + + // the name here must be the same as `jobs.xxx.{name}` in preview-build.yml + // set output + core.setOutput('build-success', jobs['test image'] === 'success'); + core.setOutput('build-failure', jobs['test image'] === 'failure'); + return jobs; + + persist-image-snapshots: + name: persist image-snapshots + permissions: + actions: read # for dawidd6/action-download-artifact to query and download artifacts + runs-on: ubuntu-latest + needs: upstream-workflow-summary + steps: + # We need get persist key first + - name: Download Visual Regression Ref + uses: dawidd6/action-download-artifact@v2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + run_id: ${{ github.event.workflow_run.id }} + name: visual-regression-persist-ref + + # Save visual-regression ref to output + - name: Extra Visual Regression Ref + id: visuall-regression + run: echo "id=$(> $GITHUB_OUTPUT + + - name: Download Visual-Regression Artifact + if: ${{ fromJSON(needs.upstream-workflow-summary.outputs.build-success) }} + uses: dawidd6/action-download-artifact@v2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + run_id: ${{ github.event.workflow_run.id }} + name: image-snapshots + path: imageSnapshots + + - name: Persist to Snapshot Repo + if: github.event.pull_request.head.ref == 'master' + id: persist + continue-on-error: true + env: + GITHUB_TOKEN: ${{ secrets.ANTD_IMAGE_SNAP_REPO_TOKEN }} + # should push to snapshot repo firstly + # push the single folder to the repo + run: | + git config user.name "Antd Visual-Regression Bot" + git config user.email "<>" + + git clone git@github.com:ant-design/antd-image-snapshots.git + rm antd-image-snapshots/*.txt + rm -rf antd-image-snapshots/imageSnapshots + + mv visual-regression-ref.txt antd-image-snapshots/ + mv ./imageSnapshots antd-image-snapshots/ + + cd antd-image-snapshots + git add . + git cm -m 'feat: update snapshot from ${{steps.visuall-regression.outputs.id}}' + + git config -l | grep 'http\..*\.extraheader' | cut -d= -f1 | \ + xargs -L1 git config --unset-all + + git push --prune https://token:$GITHUB_TOKEN@github.com/ant-design/antd-image-snapshots.git +refs/remotes/origin/*:refs/heads/* +refs/tags/*:refs/tags/* diff --git a/.github/workflows/visual-regression-persist-start.yml b/.github/workflows/visual-regression-persist-start.yml new file mode 100644 index 000000000000..946c3213e3c7 --- /dev/null +++ b/.github/workflows/visual-regression-persist-start.yml @@ -0,0 +1,95 @@ +# Each `push on master` will persist image-snapshots that used as compare target in visual regression. + +name: Visual Regression Persist Start + +on: + push: + branches: + - master + +permissions: + contents: read + +jobs: + # Prepare node modules. Reuse cache if available + setup: + name: prepare node_modules + runs-on: ubuntu-latest + container: ghcr.io/puppeteer/puppeteer:21.5.2 + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: cache package-lock.json + uses: actions/cache@v3 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: create package-lock.json + run: npm i --package-lock-only --ignore-scripts + + - name: hack for single file + run: | + if [ ! -d "package-temp-dir" ]; then + mkdir package-temp-dir + fi + cp package-lock.json package-temp-dir + - name: cache node_modules + id: node_modules_cache_id + uses: actions/cache@v3 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: install + if: steps.node_modules_cache_id.outputs.cache-hit != 'true' + run: npm ci + + test-image: + name: test image + runs-on: ubuntu-latest + needs: setup + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: restore cache from package-lock.json + uses: actions/cache@v3 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v3 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: generate image snapshots + id: site + run: | + npm run version + npm run test-image + env: + SITE_ENV: development + NODE_OPTIONS: "--max_old_space_size=4096" + + # Upload `imageSnapshots` on master + - name: upload report artifact + uses: actions/upload-artifact@v3 + with: + name: image-snapshots + path: imageSnapshots/ + + # Upload git ref for next workflow `visual-regression-persist-finish` use + - name: Save persist key + if: ${{ always() }} + run: echo ${{ github.sha }} > ./visual-regression-ref.txt + + - name: Upload persist key + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: visual-regression-persist-ref + path: ./visual-regression-ref.txt diff --git a/.gitignore b/.gitignore index fc7b9febbb8f..a5fc77cb9e0f 100644 --- a/.gitignore +++ b/.gitignore @@ -61,7 +61,7 @@ components/version/token-meta.json __diff_output__/ __image_snapshots__/ /jest-stare -/imageSnapshots +/imageSnapshots* /imageDiffSnapshots .devcontainer* diff --git a/.jest.js b/.jest.js index 6db689d21712..d71c4e849715 100644 --- a/.jest.js +++ b/.jest.js @@ -23,7 +23,7 @@ const transformIgnorePatterns = [ ]; function getTestRegex(libDir) { - if (['dist', 'lib', 'es'].includes(libDir)) { + if (['dist', 'lib', 'es', 'dist-min'].includes(libDir)) { return 'demo\\.test\\.(j|t)sx?$'; } return '.*\\.test\\.(j|t)sx?$'; diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 0bccd8420e33..0d3a5a5acfa8 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -16,6 +16,13 @@ tag: vVERSION --- +## 5.11.5 + +`2023-11-27` + +- 🐞 MISC: Fix error in `dist` artifact. [#46103](https://github.com/ant-design/ant-design/pull/46103) [@MadCcc](https://github.com/MadCcc) +- 💄 Fix DatePicker style when disabled and hovered. [#45940](https://github.com/ant-design/ant-design/pull/45940) [@crazyair](https://github.com/crazyair) + ## 5.11.4 `2023-11-24` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 8d3756a2c546..2bcd53f59295 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -16,6 +16,13 @@ tag: vVERSION --- +## 5.11.5 + +`2023-11-27` + +- 🐞 MISC: 修复打包 `dist` 产物错误。[#46103](https://github.com/ant-design/ant-design/pull/46103) [@MadCcc](https://github.com/MadCcc) +- 💄 修复 DatePicker 禁用状态下悬浮样式。[#45940](https://github.com/ant-design/ant-design/pull/45940) [@crazyair](https://github.com/crazyair) + ## 5.11.4 `2023-11-24` diff --git a/components/input/style/index.ts b/components/input/style/index.ts index f1a8b1e5e9b1..f488d314785a 100644 --- a/components/input/style/index.ts +++ b/components/input/style/index.ts @@ -122,7 +122,7 @@ export const genDisabledStyle = (token: InputToken): CSSObject => ({ cursor: 'not-allowed', opacity: 1, - '&:hover': { + '&:hover:not([disabled])': { ...genHoverStyle( mergeToken(token, { hoverBorderColor: token.colorBorder, diff --git a/package.json b/package.json index c2619724b10d..f7e84caf0d4f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "5.11.4", + "version": "5.11.5", "description": "An enterprise-class UI design language and React components implementation", "keywords": [ "ant", @@ -164,7 +164,7 @@ "devDependencies": { "@ant-design/compatible": "^5.1.2", "@ant-design/happy-work-theme": "^1.0.0", - "@ant-design/tools": "^18.0.0", + "@ant-design/tools": "^18.0.2", "@antv/g6": "^4.8.23", "@argos-ci/core": "^1.3.0", "@babel/eslint-plugin": "^7.22.10", @@ -258,7 +258,7 @@ "jest-image-snapshot": "^6.2.0", "jest-puppeteer": "^9.0.1", "jquery": "^3.7.1", - "jsdom": "^22.1.0", + "jsdom": "^23.0.0", "jsonml-to-react-element": "^1.1.11", "jsonml.js": "^0.1.0", "lint-staged": "^15.1.0", @@ -306,9 +306,9 @@ "stylelint-prettier": "^4.1.0", "sylvanas": "^0.6.1", "terser": "^5.24.0", - "tsx": "^4.4.0", - "typedoc": "^0.25.3", - "typescript": "~5.2.2", + "tsx": "^4.6.0", + "typedoc": "^0.25.4", + "typescript": "~5.3.0", "vanilla-jsoneditor": "^0.19.0", "vanilla-tilt": "^1.8.1", "webpack": "^5.89.0", diff --git a/scripts/post-script.ts b/scripts/post-script.ts index d58f608ab0d4..082faa404fe7 100644 --- a/scripts/post-script.ts +++ b/scripts/post-script.ts @@ -51,6 +51,7 @@ const DEPRECIATED_VERSION = { '5.11.0': ['https://github.com/ant-design/ant-design/issues/45742'], '5.11.1': ['https://github.com/ant-design/ant-design/issues/45883'], '5.11.2': ['https://github.com/ant-design/ant-design/issues/46005'], + '5.11.4': ['https://github.com/ant-design/ant-design/pull/46103'], } as const; function matchDeprecated(v: string) { diff --git a/scripts/test-all.sh b/scripts/test-all.sh index c62564827cc1..d82a864a8baa 100755 --- a/scripts/test-all.sh +++ b/scripts/test-all.sh @@ -75,6 +75,14 @@ else echo "[TEST ALL] dist test...skip" fi +if ! has_arg '--skip-dist' "$@"; then + echo "[TEST ALL] dist-min test" + echo "[TEST ALL] dist-min test" > ~test-all.txt + LIB_DIR=dist-min npm test -- --bail +else + echo "[TEST ALL] dist test...skip" +fi + if ! has_arg '--skip-es' "$@"; then echo "[TEST ALL] test es" echo "[TEST ALL] test es" > ~test-all.txt diff --git a/tests/index.test.ts b/tests/index.test.ts index 5261565775bc..bbc286a7e86c 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -1,13 +1,23 @@ +/* eslint-disable global-require */ import pkg from '../package.json'; const testDist = process.env.LIB_DIR === 'dist'; +const testDistMin = process.env.LIB_DIR === 'dist-min'; describe('antd dist files', () => { // https://github.com/ant-design/ant-design/issues/1638 // https://github.com/ant-design/ant-design/issues/1968 it('exports modules correctly', () => { - // eslint-disable-next-line global-require,import/no-unresolved - const antd = testDist ? require('../dist/antd') : require('../components'); + let antd; + if (testDist) { + // eslint-disable-next-line import/no-unresolved + antd = require('../dist/antd'); + } else if (testDistMin) { + // eslint-disable-next-line import/no-unresolved + antd = require('../dist/antd.min'); + } else { + antd = require('../components'); + } expect(Object.keys(antd)).toMatchSnapshot(); }); diff --git a/tests/setupAfterEnv.ts b/tests/setupAfterEnv.ts index 974bb9b650f2..0d71e44999bd 100644 --- a/tests/setupAfterEnv.ts +++ b/tests/setupAfterEnv.ts @@ -8,13 +8,11 @@ import { defaultConfig } from '../components/theme/internal'; defaultConfig.hashed = false; if (process.env.LIB_DIR === 'dist') { - jest.mock('../dist/antd', () => { - const antd = jest.requireActual('../dist/antd'); - antd.theme.defaultConfig.hashed = false; - - return antd; - }); + jest.mock('antd', () => jest.requireActual('../dist/antd')); +} else if (process.env.LIB_DIR === 'dist-min') { + jest.mock('antd', () => jest.requireActual('../dist/antd.min')); } else if (process.env.LIB_DIR === 'es') { + jest.mock('antd', () => jest.requireActual('../es')); jest.mock('../es/theme/internal', () => { const esTheme = jest.requireActual('../es/theme/internal'); if (esTheme.defaultConfig) { diff --git a/tests/shared/demoTest.tsx b/tests/shared/demoTest.tsx index 538a4a3c7e73..63bac11c88b9 100644 --- a/tests/shared/demoTest.tsx +++ b/tests/shared/demoTest.tsx @@ -11,6 +11,7 @@ import { render } from '../utils'; import { TriggerMockContext } from './demoTestContext'; import { excludeWarning, isSafeWarning } from './excludeWarning'; import rootPropsTest from './rootPropsTest'; +import { ConfigProvider } from 'antd'; export { rootPropsTest }; @@ -60,7 +61,11 @@ function baseText(doInject: boolean, component: string, options: Options = {}) { } // Inject cssinjs cache to avoid create