From b4a4c9380053892d70399dd563994918321b4bd9 Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 20 Mar 2023 14:12:23 +0800 Subject: [PATCH 1/9] Create (#41347) --- .github/workflows/chatgpt-cr.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/chatgpt-cr.yml diff --git a/.github/workflows/chatgpt-cr.yml b/.github/workflows/chatgpt-cr.yml new file mode 100644 index 0000000000..0b605d08f8 --- /dev/null +++ b/.github/workflows/chatgpt-cr.yml @@ -0,0 +1,23 @@ +name: 🤖 ChatGPT Code Review + +permissions: + contents: read + pull-requests: write + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: anc95/ChatGPT-CodeReview@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + # Optional + LANGUAGE: Chinese + MODEL: + top_p: 1 + temperature: 1 From fb5ed958531f4597bd3e8c348c3ed9dc223eadb3 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Mon, 20 Mar 2023 14:52:35 +0800 Subject: [PATCH 2/9] chore(deps): bump typescript to v5 (#41301) * chore(deps): bump typescript to v5 * fix * fix * type fix * Update components/statistic/demo/countdown.tsx Co-authored-by: MadCcc <1075746765@qq.com> * Update components/statistic/demo/countdown.tsx Co-authored-by: MadCcc <1075746765@qq.com> * fix * fix type * update demo --------- Co-authored-by: MadCcc <1075746765@qq.com> --- components/statistic/demo/countdown.tsx | 55 ++++++++++++------------- components/table/demo/virtual-list.tsx | 6 +-- package.json | 2 +- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/components/statistic/demo/countdown.tsx b/components/statistic/demo/countdown.tsx index 0615f07148..e0408c6ed7 100644 --- a/components/statistic/demo/countdown.tsx +++ b/components/statistic/demo/countdown.tsx @@ -1,37 +1,36 @@ -import React from 'react'; +import type { CountdownProps } from 'antd'; import { Col, Row, Statistic } from 'antd'; -import type { StatisticProps } from 'antd'; +import React from 'react'; const { Countdown } = Statistic; -const deadline = Date.now() + 1000 * 60 * 60 * 24 * 2 + 1000 * 30; // Dayjs is also OK -const App: React.FC = () => { - const onFinish = () => { - console.log('finished!'); - }; +const deadline = Date.now() + 1000 * 60 * 60 * 24 * 2 + 1000 * 30; // Dayjs is also OK - const onChange = (val: StatisticProps['value']) => { - if (val && 4.95 * 1000 < val && val < 5 * 1000) { - console.log('changed!'); - } - }; +const onFinish: CountdownProps['onFinish'] = () => { + console.log('finished!'); +}; - return ( - - - - - - - - - - - - - - - ); +const onChange: CountdownProps['onChange'] = (val) => { + if (typeof val === 'number' && 4.95 * 1000 < val && val < 5 * 1000) { + console.log('changed!'); + } }; +const App: React.FC = () => ( + + + + + + + + + + + + + + +); + export default App; diff --git a/components/table/demo/virtual-list.tsx b/components/table/demo/virtual-list.tsx index 61aa8485d8..fc125703c3 100644 --- a/components/table/demo/virtual-list.tsx +++ b/components/table/demo/virtual-list.tsx @@ -1,8 +1,8 @@ -import React, { useEffect, useRef, useState } from 'react'; -import { Table, theme } from 'antd'; import type { TableProps } from 'antd'; +import { Table, theme } from 'antd'; import classNames from 'classnames'; import ResizeObserver from 'rc-resize-observer'; +import React, { useEffect, useRef, useState } from 'react'; import { VariableSizeGrid as Grid } from 'react-window'; const VirtualTable = (props: TableProps) => { @@ -62,7 +62,7 @@ const VirtualTable = (props: TableProps) columnCount={mergedColumns.length} columnWidth={(index: number) => { const { width } = mergedColumns[index]; - return totalHeight > scroll!.y! && index === mergedColumns.length - 1 + return totalHeight > (scroll?.y as number) && index === mergedColumns.length - 1 ? (width as number) - scrollbarSize - 1 : (width as number); }} diff --git a/package.json b/package.json index 1edf183e12..9154abbe76 100644 --- a/package.json +++ b/package.json @@ -284,7 +284,7 @@ "terser": "^5.16.1", "ts-node": "^10.8.2", "typedoc": "^0.23.21", - "typescript": "~4.9.3", + "typescript": "~5.0.2", "vanilla-jsoneditor": "^0.16.0", "webpack-bundle-analyzer": "^4.1.0", "xhr-mock": "^2.4.1", From 822dec20a44d099e599747899d113ba6c0680c4b Mon Sep 17 00:00:00 2001 From: Peach Date: Mon, 20 Mar 2023 17:21:59 +0800 Subject: [PATCH 3/9] docs: changelog for 5.3.2 (#41350) * docs: changelog for 5.3.2 * chore: bump version to 5.3.2 * docs: update changelog * docs: update changelog --- CHANGELOG.en-US.md | 22 ++++++++++++++++++++++ CHANGELOG.zh-CN.md | 22 ++++++++++++++++++++++ package.json | 2 +- 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 6013c50f32..420a5ab00b 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -15,6 +15,28 @@ timeline: true --- +## 5.3.2 + +`2023-03-20` + +- Anchor + - 💄 Fix Anchor redundant border style when it is set to horizontal direction. [#41336](https://github.com/ant-design/ant-design/pull/41336) [@gooyoung](https://github.com/gooyoung) + - 💄 Fix Anchor ink square style in `vertical` mode. [#41317](https://github.com/ant-design/ant-design/pull/41317) [@acyza](https://github.com/acyza) +- 🐞 Fix Grid `offset` can not be overwritten problem under different device screen sizes. [#41309](https://github.com/ant-design/ant-design/pull/41309) [@Yuiai01](https://github.com/Yuiai01) +- 🐞 Fix Breadcrumb `onClick` not working bug. [#41283](https://github.com/ant-design/ant-design/pull/41283) [@acyza](https://github.com/acyza) +- 🐞 Fix Upload trigger Progress warning after upload. [#41234](https://github.com/ant-design/ant-design/pull/41234) [@kiner-tang](https://github.com/kiner-tang) +- 🐞 Fix Table unexpected layout problem when dragging element to the right. [#41139](https://github.com/ant-design/ant-design/pull/41139) [@hoho2017](https://github.com/hoho2017) +- 💄 Fix Tabs more icon color in dark mode. [#41313](https://github.com/ant-design/ant-design/pull/41313) [@PhosphorusP](https://github.com/PhosphorusP) +- 💄 Fix Button focus outline style be covered by Dropdown.Button. [#41282](https://github.com/ant-design/ant-design/pull/41282) [@Yuiai01](https://github.com/Yuiai01) +- 💄 Fix Input.TextArea style problem when focusing. [#41228](https://github.com/ant-design/ant-design/pull/41228) [@MuxinFeng](https://github.com/MuxinFeng) + +- RTL + - 💄 Fix Input.TextArea RTL style when enable `showCount`. [#41319](https://github.com/ant-design/ant-design/pull/41319) [@ds1371dani](https://github.com/ds1371dani) +- TypeScript + - 🤖 Export `CountdownProps` for Statistic. [#41341](https://github.com/ant-design/ant-design/pull/41341) [@li-jia-nan](https://github.com/li-jia-nan) + - 🤖 Improve most alias token meta info. [#41297](https://github.com/ant-design/ant-design/pull/41297) [@arvinxx](https://github.com/arvinxx) + - 🤖 Improve Badge `React.forwardRef` type definition. [#41189](https://github.com/ant-design/ant-design/pull/41189) [@li-jia-nan](https://github.com/li-jia-nan) + ## 5.3.1 `2023-03-13` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 0071ed4919..ccb6ae5523 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -15,6 +15,28 @@ timeline: true --- +## 5.3.2 + +`2023-03-20` + +- Anchor + - 💄 修复 Anchor 组件设置为水平方向时多余的 border 样式。[#41336](https://github.com/ant-design/ant-design/pull/41336) [@gooyoung](https://github.com/gooyoung) + - 💄 修复 Anchor 处于 `vertical` 方向时 ink 小方块的样式。[#41317](https://github.com/ant-design/ant-design/pull/41317) [@acyza](https://github.com/acyza) +- 🐞 修复 Grid 在不同设备屏幕下的 `offset` 设置不会被覆盖的问题。[#41309](https://github.com/ant-design/ant-design/pull/41309) [@Yuiai01](https://github.com/Yuiai01) +- 🐞 修复 Breadcrumb `onClick` 不工作的问题。[#41283](https://github.com/ant-design/ant-design/pull/41283) [@acyza](https://github.com/acyza) +- 🐞 修复 Upload 在上传完毕后 Progress 组件抛出警告的问题。[#41234](https://github.com/ant-design/ant-design/pull/41234) [@kiner-tang](https://github.com/kiner-tang) +- 🐞 修复 Table 在拖动元素一直右移时布局错误的问题。[#41139](https://github.com/ant-design/ant-design/pull/41139) [@hoho2017](https://github.com/hoho2017) +- 💄 修复 Tabs 在深色模式下更多图标的色值。[#41313](https://github.com/ant-design/ant-design/pull/41313) [@PhosphorusP](https://github.com/PhosphorusP) +- 💄 修复 Button 下拉时聚焦轮廓被其他元素遮挡的问题。[#41282](https://github.com/ant-design/ant-design/pull/41282) [@Yuiai01](https://github.com/Yuiai01) +- 💄 修复 Input.TextArea 在 focus 状态下的样式问题。[#41228](https://github.com/ant-design/ant-design/pull/41228) [@MuxinFeng](https://github.com/MuxinFeng) + +- RTL + - 💄 修复 Input.TextArea 在启用 `showCount` 时 RTL 模式下位置不正确的问题。[#41319](https://github.com/ant-design/ant-design/pull/41319) [@ds1371dani](https://github.com/ds1371dani) +- TypeScript + - 🤖 导出 Statistic 的 `CountdownProps` 类型。[#41341](https://github.com/ant-design/ant-design/pull/41341) [@li-jia-nan](https://github.com/li-jia-nan) + - 🤖 优化 token 的类型提示和说明。[#41297](https://github.com/ant-design/ant-design/pull/41297) [@arvinxx](https://github.com/arvinxx) + - 🤖 优化 Badge `React.forwardRef` 类型定义。[#41189](https://github.com/ant-design/ant-design/pull/41189) [@li-jia-nan](https://github.com/li-jia-nan) + ## 5.3.1 `2023-03-13` diff --git a/package.json b/package.json index 9154abbe76..68b4ef68b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "5.3.1", + "version": "5.3.2", "description": "An enterprise-class UI design language and React components implementation", "title": "Ant Design", "keywords": [ From 18266ae3360535a44a2547bd4ef74a5036aabca4 Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Mon, 20 Mar 2023 20:42:10 +0800 Subject: [PATCH 4/9] docs: fix colorPicker could not open (#41356) --- .dumi/pages/index/components/Theme/ColorPicker.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.dumi/pages/index/components/Theme/ColorPicker.tsx b/.dumi/pages/index/components/Theme/ColorPicker.tsx index 3a817f5d89..b969d2b160 100644 --- a/.dumi/pages/index/components/Theme/ColorPicker.tsx +++ b/.dumi/pages/index/components/Theme/ColorPicker.tsx @@ -115,7 +115,12 @@ export default function ColorPicker({ value, onChange }: RadiusPickerProps) { } }} > - + e.stopPropagation()} + /> ); @@ -128,7 +133,7 @@ export default function ColorPicker({ value, onChange }: RadiusPickerProps) { onChange?.(c)} /> } trigger="click" - showArrow={false} + arrow={false} > {colorNode} From fd933437acf3cc9b0b9ce20972e1d91a98f66fd4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Mar 2023 21:27:08 +0800 Subject: [PATCH 5/9] chore(deps-dev): bump open from 8.4.2 to 9.0.0 (#41358) Bumps [open](https://github.com/sindresorhus/open) from 8.4.2 to 9.0.0. - [Release notes](https://github.com/sindresorhus/open/releases) - [Commits](https://github.com/sindresorhus/open/compare/v8.4.2...v9.0.0) --- updated-dependencies: - dependency-name: open dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 68b4ef68b6..6d49c88972 100644 --- a/package.json +++ b/package.json @@ -245,7 +245,7 @@ "lodash": "^4.17.21", "lz-string": "^1.4.4", "mockdate": "^3.0.0", - "open": "^8.0.1", + "open": "^9.0.0", "prettier": "^2.3.2", "prettier-plugin-jsdoc": "^0.4.2", "pretty-format": "^29.0.0", From bb8b52936c7075374f901c3190f3a62842f280db Mon Sep 17 00:00:00 2001 From: Amumu Date: Tue, 21 Mar 2023 10:45:50 +0800 Subject: [PATCH 6/9] chore: docs update (#41368) * chore: docs update * chore: docs update --- docs/react/i18n.en-US.md | 4 ++-- docs/react/i18n.zh-CN.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/react/i18n.en-US.md b/docs/react/i18n.en-US.md index 46c1e340a2..072f2185b7 100644 --- a/docs/react/i18n.en-US.md +++ b/docs/react/i18n.en-US.md @@ -111,8 +111,8 @@ Do it step by step: ```bash git clone git@github.com:/ant-design.git cd ant-design/ - git remote add upstream origin git@github.com:ant-design/ant-design.git - git checkout -b + git remote add upstream git@github.com:ant-design/ant-design.git + git checkout -b upstream/feature ``` 2. Add the language support for [rc-picker](https://github.com/react-component/picker), for example [this](https://github.com/react-component/picker/blob/master/src/locale/en_US.ts). diff --git a/docs/react/i18n.zh-CN.md b/docs/react/i18n.zh-CN.md index eb4478ff3a..206903f83d 100644 --- a/docs/react/i18n.zh-CN.md +++ b/docs/react/i18n.zh-CN.md @@ -108,8 +108,8 @@ return ( ```bash git clone git@github.com:/ant-design.git cd ant-design/ - git remote add upstream origin git@github.com:ant-design/ant-design.git - git checkout -b + git remote add upstream git@github.com:ant-design/ant-design.git + git checkout -b upstream/feature ``` 2. 为 [rc-picker](https://github.com/react-component/picker) 添加对应语言,参考 [这个](https://github.com/react-component/picker/blob/master/src/locale/en_US.ts)。 From 772ab49bafb84c02d61d45acb1f4961190c60e9c Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Tue, 21 Mar 2023 13:00:16 +0800 Subject: [PATCH 7/9] docs: fix hydration error when resizing (#41370) * docs: fix hydration error when resizing * docs: useLayoutState --- .dumi/hooks/useLayoutState.ts | 17 +++++++++++++++++ .dumi/theme/layouts/GlobalLayout.tsx | 15 +++++++-------- package.json | 2 +- 3 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 .dumi/hooks/useLayoutState.ts diff --git a/.dumi/hooks/useLayoutState.ts b/.dumi/hooks/useLayoutState.ts new file mode 100644 index 0000000000..e69486fcc6 --- /dev/null +++ b/.dumi/hooks/useLayoutState.ts @@ -0,0 +1,17 @@ +import { startTransition, useState } from 'react'; + +const useLayoutState = ( + ...args: Parameters> +): ReturnType> => { + const [state, setState] = useState(...args); + + const setLayoutState: typeof setState = (...setStateArgs) => { + startTransition(() => { + setState(...setStateArgs); + }); + }; + + return [state, setLayoutState]; +}; + +export default useLayoutState; diff --git a/.dumi/theme/layouts/GlobalLayout.tsx b/.dumi/theme/layouts/GlobalLayout.tsx index 3f0950daaf..23c96a4fb3 100644 --- a/.dumi/theme/layouts/GlobalLayout.tsx +++ b/.dumi/theme/layouts/GlobalLayout.tsx @@ -5,15 +5,16 @@ import { parentSelectorLinter, StyleProvider, } from '@ant-design/cssinjs'; -import { ConfigProvider, theme as antdTheme, App } from 'antd'; +import { App, ConfigProvider, theme as antdTheme } from 'antd'; import type { DirectionType } from 'antd/es/config-provider'; import { createSearchParams, useOutlet, useSearchParams } from 'dumi'; -import React, { startTransition, useCallback, useEffect, useMemo } from 'react'; +import React, { useCallback, useEffect, useMemo } from 'react'; import useLocation from '../../hooks/useLocation'; import type { ThemeName } from '../common/ThemeSwitch'; import ThemeSwitch from '../common/ThemeSwitch'; import type { SiteContextProps } from '../slots/SiteContext'; import SiteContext from '../slots/SiteContext'; +import useLayoutState from '../../hooks/useLayoutState'; type Entries = { [K in keyof T]: [K, T[K]] }[keyof T][]; type SiteState = Partial>; @@ -40,7 +41,7 @@ const GlobalLayout: React.FC = () => { const outlet = useOutlet(); const { pathname } = useLocation(); const [searchParams, setSearchParams] = useSearchParams(); - const [{ theme, direction, isMobile }, setSiteState] = React.useState({ + const [{ theme, direction, isMobile }, setSiteState] = useLayoutState({ isMobile: false, direction: 'ltr', theme: ['light'], @@ -85,11 +86,9 @@ const GlobalLayout: React.FC = () => { const _theme = searchParams.getAll('theme') as ThemeName[]; const _direction = searchParams.get('direction') as DirectionType; - startTransition(() => { - setSiteState({ theme: _theme, direction: _direction === 'rtl' ? 'rtl' : 'ltr' }); - // Handle isMobile - updateMobileMode(); - }); + setSiteState({ theme: _theme, direction: _direction === 'rtl' ? 'rtl' : 'ltr' }); + // Handle isMobile + updateMobileMode(); window.addEventListener('resize', updateMobileMode); return () => { diff --git a/package.json b/package.json index 6d49c88972..1b0f61f81c 100644 --- a/package.json +++ b/package.json @@ -203,7 +203,7 @@ "cheerio": "1.0.0-rc.12", "cross-env": "^7.0.0", "dekko": "^0.2.1", - "dumi": "^2.1.13", + "dumi": "^2.1.17", "duplicate-package-checker-webpack-plugin": "^3.0.0", "esbuild-loader": "^3.0.0", "eslint": "^8.0.0", From a5c0dbba0717899522f1625312dae13ef6f0b0b6 Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Tue, 21 Mar 2023 13:00:34 +0800 Subject: [PATCH 8/9] docs: make Calendar demo client-only (#41359) --- .dumi/theme/builtins/Previewer/CodePreviewer.tsx | 5 ++++- .dumi/theme/common/ClientOnly.tsx | 4 ++-- components/calendar/index.en-US.md | 10 +++++----- components/calendar/index.zh-CN.md | 10 +++++----- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.dumi/theme/builtins/Previewer/CodePreviewer.tsx b/.dumi/theme/builtins/Previewer/CodePreviewer.tsx index db069bac0c..f37f8ed871 100644 --- a/.dumi/theme/builtins/Previewer/CodePreviewer.tsx +++ b/.dumi/theme/builtins/Previewer/CodePreviewer.tsx @@ -104,6 +104,7 @@ const CodePreviewer: React.FC = (props) => { background, filePath, version, + clientOnly, } = props; const { pkg } = useSiteData(); @@ -169,6 +170,8 @@ const CodePreviewer: React.FC = (props) => { setCodeExpand(expand); }, [expand]); + const mergedChildren = !iframe && clientOnly ? {children} : children; + if (!liveDemo.current) { liveDemo.current = iframe ? ( @@ -180,7 +183,7 @@ const CodePreviewer: React.FC = (props) => { /> ) : ( - children + mergedChildren ); } diff --git a/.dumi/theme/common/ClientOnly.tsx b/.dumi/theme/common/ClientOnly.tsx index 1371d3eeb3..415d0d0888 100644 --- a/.dumi/theme/common/ClientOnly.tsx +++ b/.dumi/theme/common/ClientOnly.tsx @@ -1,5 +1,5 @@ import type { FC, ReactElement, ReactNode } from 'react'; -import { useEffect, useState } from 'react'; +import { useLayoutEffect, useState } from 'react'; export type ClientOnlyProps = { children: ReactNode; @@ -8,7 +8,7 @@ export type ClientOnlyProps = { const ClientOnly: FC = ({ children }) => { const [clientReady, setClientReady] = useState(false); - useEffect(() => { + useLayoutEffect(() => { setClientReady(true); }, []); diff --git a/components/calendar/index.en-US.md b/components/calendar/index.en-US.md index 153843a20e..5eed518af9 100644 --- a/components/calendar/index.en-US.md +++ b/components/calendar/index.en-US.md @@ -15,11 +15,11 @@ When data is in the form of dates, such as schedules, timetables, prices calenda ## Examples -Basic -Notice Calendar -Card -Selectable Calendar -Customize Header +Basic +Notice Calendar +Card +Selectable Calendar +Customize Header ## API diff --git a/components/calendar/index.zh-CN.md b/components/calendar/index.zh-CN.md index dafca9643d..d50cf4a36f 100644 --- a/components/calendar/index.zh-CN.md +++ b/components/calendar/index.zh-CN.md @@ -16,11 +16,11 @@ coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*-p-wQLik200AAA ## 代码演示 -基本 -通知事项日历 -卡片模式 -选择功能 -自定义头部 +基本 +通知事项日历 +卡片模式 +选择功能 +自定义头部 ## API From eaa08a39fc402e95ade47982b760ed66f1b3f343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E7=88=B1=E5=90=83=E7=99=BD=E8=90=9D?= =?UTF-8?q?=E5=8D=9C?= Date: Tue, 21 Mar 2023 14:18:43 +0800 Subject: [PATCH 9/9] chore: add diff report (#41354) * chore: add diff report * chore: more --- .github/workflows/mock-project-build.yml | 34 ++++++++++++++++++++++++ scripts/ci-mock-project-build.sh | 6 +++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mock-project-build.yml b/.github/workflows/mock-project-build.yml index 9719f183f7..527f5362ba 100644 --- a/.github/workflows/mock-project-build.yml +++ b/.github/workflows/mock-project-build.yml @@ -6,6 +6,11 @@ on: schedule: - cron: '*/30 * * * *' +# Cancel prev CI if new commit come +concurrency: + group: unique + cancel-in-progress: true + jobs: pr-check-ci: runs-on: ubuntu-latest @@ -18,9 +23,38 @@ jobs: with: node-version: 16 + - uses: actions/cache@v3 + with: + path: ~tmpProj/yarn.lock + key: primes-${{ runner.os }}-${{ github.run_id }} + restore-keys: mock-proj-lock-file + - name: Run Script run: bash ./scripts/ci-mock-project-build.sh + ################################################################## + ## Diff Lock File ## + ################################################################## + - name: Rename failed lock file + if: ${{ failure() }} + run: mv ~tmpProj/yarn.lock ~tmpProj/yarn.lock.failed + + - name: Download success lock file as `success.lock` + if: ${{ failure() }} + uses: actions/cache/restore@v3 + with: + path: ~tmpProj/yarn.lock + key: primes-${{ runner.os }}-${{ github.run_id }} + restore-keys: mock-proj-lock-file + + - name: ls tmpProj + if: ${{ failure() }} + run: ls ~tmpProj + + - name: 🎨 Diff Report + if: ${{ failure() }} + run: npx diff-yarn-lock --source=~tmpProj/yarn.lock --target=~tmpProj/yarn.lock.failed + - uses: actions-cool/ci-notice@v1 if: ${{ failure() }} with: diff --git a/scripts/ci-mock-project-build.sh b/scripts/ci-mock-project-build.sh index 0e5ff0cdce..6302a77c8f 100644 --- a/scripts/ci-mock-project-build.sh +++ b/scripts/ci-mock-project-build.sh @@ -6,9 +6,11 @@ rm -rf ~tmpProj/ # clone project git clone https://github.com/ant-design/create-next-app-antd.git ~tmpProj --depth=1 -# install +# change directory cd ~tmpProj + +# install dependencies yarn # build -yarn run build \ No newline at end of file +yarn run build