mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 12:39:49 +08:00
Merge branch master into master-merge-feature
This commit is contained in:
commit
cc5724481c
@ -255,7 +255,7 @@ const CodePreviewer: React.FC<AntdPreviewerProps> = (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',
|
||||
|
15
.github/PULL_REQUEST_TEMPLATE.md
vendored
15
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -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
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
Below are template for copilot to generate CR message.
|
||||
Please DO NOT modify it.
|
||||
-->
|
||||
|
||||
### 🚀 Summary
|
||||
|
||||
copilot:summary
|
||||
|
||||
### 🔍 Walkthrough
|
||||
|
||||
copilot:walkthrough
|
||||
|
14
.github/PULL_REQUEST_TEMPLATE/pr_cn.md
vendored
14
.github/PULL_REQUEST_TEMPLATE/pr_cn.md
vendored
@ -61,17 +61,3 @@
|
||||
- [ ] 代码演示已提供或无须提供
|
||||
- [ ] TypeScript 定义已补充或无须补充
|
||||
- [ ] Changelog 已提供或无须提供
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
以下为 copilot 自动生成的 CR 结果,请勿修改
|
||||
-->
|
||||
|
||||
### 🚀 概述
|
||||
|
||||
copilot:summary
|
||||
|
||||
### 🔍 实现细节
|
||||
|
||||
copilot:walkthrough
|
||||
|
11
.github/workflows/test.yml
vendored
11
.github/workflows/test.yml
vendored
@ -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 ###########################
|
||||
|
107
.github/workflows/visual-regression-persist-finish.yml
vendored
Normal file
107
.github/workflows/visual-regression-persist-finish.yml
vendored
Normal file
@ -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=$(<visual-regression-ref.txt)" >> $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/*
|
95
.github/workflows/visual-regression-persist-start.yml
vendored
Normal file
95
.github/workflows/visual-regression-persist-start.yml
vendored
Normal file
@ -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
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -61,7 +61,7 @@ components/version/token-meta.json
|
||||
__diff_output__/
|
||||
__image_snapshots__/
|
||||
/jest-stare
|
||||
/imageSnapshots
|
||||
/imageSnapshots*
|
||||
/imageDiffSnapshots
|
||||
|
||||
.devcontainer*
|
||||
|
2
.jest.js
2
.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?$';
|
||||
|
@ -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`
|
||||
|
@ -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`
|
||||
|
@ -122,7 +122,7 @@ export const genDisabledStyle = (token: InputToken): CSSObject => ({
|
||||
cursor: 'not-allowed',
|
||||
opacity: 1,
|
||||
|
||||
'&:hover': {
|
||||
'&:hover:not([disabled])': {
|
||||
...genHoverStyle(
|
||||
mergeToken<InputToken>(token, {
|
||||
hoverBorderColor: token.colorBorder,
|
||||
|
12
package.json
12
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",
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
});
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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 <style /> element
|
||||
Demo = <StyleProvider cache={createCache()}>{Demo}</StyleProvider>;
|
||||
Demo = (
|
||||
<ConfigProvider theme={{ hashed: false }}>
|
||||
<StyleProvider cache={createCache()}>{Demo}</StyleProvider>
|
||||
</ConfigProvider>
|
||||
);
|
||||
|
||||
// Demo Test also include `dist` test which is already uglified.
|
||||
// We need test this as SSR instead.
|
||||
|
Loading…
Reference in New Issue
Block a user