From 6f18ef7a31373d160712921ce38c2ce6c06a8b17 Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Sun, 9 Oct 2022 16:59:11 +0800 Subject: [PATCH] chore: fix ci (#37899) * chore: fix ci * ci: remove check-ts-demo * ci: preview build * test: ignore demo.tsx * chore: update script * test: update snapshot * test: update node and image test * chore: add .surgeignore --- .eslintignore | 5 +- .github/workflows/test.yml | 22 --- .jest.js | 2 + .surgeignore | 1 + .umirc.ts | 1 + components/__tests__/node.test.tsx | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 8 +- .../__tests__/__snapshots__/demo.test.ts.snap | 8 +- .../__snapshots__/demo-extend.test.ts.snap | 75 ++------- .../__tests__/__snapshots__/demo.test.ts.snap | 75 ++------- .../alert/__tests__/demo-extend.test.ts | 2 +- components/alert/__tests__/demo.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 12 +- .../__tests__/__snapshots__/demo.test.ts.snap | 12 +- .../__snapshots__/demo-extend.test.ts.snap | 18 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 18 +-- .../__snapshots__/demo-extend.test.ts.snap | 16 +- .../__tests__/__snapshots__/demo.test.ts.snap | 16 +- .../__snapshots__/demo-extend.test.ts.snap | 4 +- .../__tests__/__snapshots__/demo.test.ts.snap | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 28 ++-- .../__tests__/__snapshots__/demo.test.ts.snap | 28 ++-- .../__snapshots__/demo-extend.test.ts.snap | 10 +- .../__tests__/__snapshots__/demo.test.ts.snap | 10 +- .../breadcrumb/__tests__/demo-extend.test.ts | 2 +- components/breadcrumb/__tests__/demo.test.ts | 2 +- components/breadcrumb/__tests__/image.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 22 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 22 +-- components/button/__tests__/image.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 10 +- .../__tests__/__snapshots__/demo.test.js.snap | 10 +- .../__snapshots__/demo-extend.test.ts.snap | 20 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 20 +-- .../__snapshots__/demo-extend.test.ts.snap | 8 +- .../__tests__/__snapshots__/demo.test.ts.snap | 8 +- .../__snapshots__/demo-extend.test.ts.snap | 36 ++--- .../__tests__/__snapshots__/demo.test.ts.snap | 36 ++--- .../cascader/demo/showCheckedStrategy.tsx | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 14 +- .../__tests__/__snapshots__/demo.test.ts.snap | 14 +- .../__snapshots__/demo-extend.test.ts.snap | 18 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 18 +-- .../config-provider/__tests__/image.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 38 ++--- .../__tests__/__snapshots__/demo.test.ts.snap | 38 ++--- .../date-picker/__tests__/demo-extend.test.ts | 2 +- components/date-picker/__tests__/demo.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 16 +- .../__tests__/__snapshots__/demo.test.ts.snap | 16 +- .../__snapshots__/demo-extend.test.ts.snap | 10 +- .../__tests__/__snapshots__/demo.test.ts.snap | 10 +- .../__snapshots__/demo-extend.test.tsx.snap | 22 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 22 +-- .../__snapshots__/demo-extend.test.ts.snap | 30 ++-- .../__tests__/__snapshots__/demo.test.ts.snap | 30 ++-- components/dropdown/__tests__/image.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 10 +- .../__tests__/__snapshots__/demo.test.ts.snap | 10 +- components/empty/demo/basic.tsx | 1 + components/empty/demo/description.tsx | 1 + components/empty/demo/simple.tsx | 1 + .../__snapshots__/demo-extend.test.ts.snap | 16 +- .../__tests__/__snapshots__/demo.test.ts.snap | 16 +- .../__snapshots__/demo-extend.test.ts.snap | 64 ++++---- .../__tests__/__snapshots__/demo.test.ts.snap | 147 ++++-------------- components/form/__tests__/demo-extend.test.ts | 2 +- components/form/__tests__/demo.test.ts | 2 +- components/form/__tests__/image.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 24 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 24 +-- .../__snapshots__/demo-extend.test.ts.snap | 10 +- .../__tests__/__snapshots__/demo.test.ts.snap | 10 +- components/icon/__tests__/image.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 18 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 18 +-- .../image/demo/preview-group-top-progress.tsx | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 28 ++-- .../__tests__/__snapshots__/demo.test.ts.snap | 28 ++-- components/input-number/demo/debug-token.tsx | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 40 ++--- .../__tests__/__snapshots__/demo.test.ts.snap | 40 ++--- components/input/__tests__/image.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 18 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 18 +-- .../layout/__tests__/demo-extend.test.ts | 2 +- components/layout/__tests__/demo.test.ts | 2 +- components/layout/__tests__/image.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 18 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 18 +-- components/list/__tests__/image.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 18 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 18 +-- .../__snapshots__/demo-extend.test.ts.snap | 20 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 20 +-- components/menu/demo/deprecated.tsx | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 18 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 18 +-- components/message/demo/render-panel.tsx | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 30 ++-- .../__tests__/__snapshots__/demo.test.ts.snap | 30 ++-- components/modal/demo/dark.tsx | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 20 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 20 +-- components/notification/demo/render-panel.tsx | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 20 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 20 +-- .../__snapshots__/demo-extend.test.ts.snap | 16 +- .../__tests__/__snapshots__/demo.test.js.snap | 16 +- .../__snapshots__/demo-extend.test.ts.snap | 14 +- .../__tests__/__snapshots__/demo.test.ts.snap | 14 +- .../__snapshots__/demo-extend.test.ts.snap | 24 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 24 +-- .../__snapshots__/demo-extend.test.ts.snap | 20 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 20 +-- .../__snapshots__/demo-extend.test.ts.snap | 14 +- .../__tests__/__snapshots__/demo.test.ts.snap | 14 +- .../__snapshots__/demo-extend.test.ts.snap | 16 +- .../__tests__/__snapshots__/demo.test.ts.snap | 16 +- .../__snapshots__/demo-extend.test.ts.snap | 22 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 22 +-- components/segmented/demo/basic.tsx | 1 + components/segmented/demo/block.tsx | 1 + components/segmented/demo/controlled-two.tsx | 7 +- components/segmented/demo/custom.tsx | 1 + components/segmented/demo/disabled.tsx | 1 + components/segmented/demo/icon-only.tsx | 1 + components/segmented/demo/size-consistent.tsx | 4 +- components/segmented/demo/size.tsx | 1 + components/segmented/demo/with-icon.tsx | 1 + .../__snapshots__/demo-extend.test.ts.snap | 44 +++--- .../__tests__/__snapshots__/demo.test.ts.snap | 46 +++--- .../select/__tests__/demo-extend.test.ts | 2 +- components/select/__tests__/demo.test.ts | 2 +- components/select/__tests__/image.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 12 +- .../__tests__/__snapshots__/demo.test.ts.snap | 12 +- .../__snapshots__/demo-extend.test.ts.snap | 20 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 72 ++------- components/slider/__tests__/demo.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 18 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 18 +-- .../__snapshots__/demo-extend.test.ts.snap | 14 +- .../__tests__/__snapshots__/demo.test.ts.snap | 14 +- .../__snapshots__/demo-extend.test.ts.snap | 8 +- .../__tests__/__snapshots__/demo.test.ts.snap | 8 +- components/statistic/__tests__/image.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 32 ++-- .../__tests__/__snapshots__/demo.test.ts.snap | 32 ++-- components/steps/__tests__/image.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 10 +- .../__tests__/__snapshots__/demo.test.ts.snap | 10 +- components/switch/__tests__/image.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 80 +++++----- .../__tests__/__snapshots__/demo.test.ts.snap | 80 +++++----- .../__snapshots__/demo-extend.test.ts.snap | 34 ++-- .../__tests__/__snapshots__/demo.test.ts.snap | 34 ++-- .../__snapshots__/demo-extend.test.ts.snap | 18 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 18 +-- components/tag/__tests__/image.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 28 ++-- .../__tests__/__snapshots__/demo.test.ts.snap | 28 ++-- .../__snapshots__/demo-extend.test.ts.snap | 14 +- .../__tests__/__snapshots__/demo.test.ts.snap | 14 +- components/timeline/__tests__/image.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 14 +- .../__tests__/__snapshots__/demo.test.ts.snap | 14 +- components/tooltip/index.tsx | 3 +- .../__snapshots__/demo-extend.test.ts.snap | 20 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 20 +-- .../__snapshots__/demo-extend.test.ts.snap | 20 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 20 +-- .../__snapshots__/demo-extend.test.ts.snap | 20 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 20 +-- components/tree/__tests__/demo-extend.test.ts | 2 +- components/tree/__tests__/demo.test.ts | 2 +- components/tree/__tests__/image.test.ts | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 18 +-- .../__tests__/__snapshots__/demo.test.ts.snap | 18 +-- .../__snapshots__/demo-extend.test.ts.snap | 38 ++--- .../__tests__/__snapshots__/demo.test.ts.snap | 38 ++--- package.json | 10 +- tests/shared/demoTest.tsx | 9 +- tests/shared/imageTest.tsx | 2 +- 184 files changed, 1414 insertions(+), 1641 deletions(-) create mode 100644 .surgeignore diff --git a/.eslintignore b/.eslintignore index 12391cdd50..4691c01d71 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,7 +2,8 @@ components/**/*.js components/**/*.jsx components/version/token.tsx !components/*/__tests__/**/*.js -!components/*/demo/* +!components/*/demo/*.md +components/*/demo/*.tsx !.*.js ~* # Docs templates @@ -19,6 +20,8 @@ site/theme/template/Content/EditButton.jsx site/theme/template/Resources/*.jsx site/theme/template/Resources/**/*.jsx site/theme/template/NotFound.jsx +site/theme/template/Content/ComponentDoc.jsx +site/**/*.tsx typings es/**/* lib/**/* diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1fc87e596f..d522526689 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -67,28 +67,6 @@ jobs: run: npm run lint needs: setup - tsx-demo: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3 - - - 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: tsx-demo - run: npm run check-ts-demo - needs: setup - check_metadata: runs-on: ubuntu-latest steps: diff --git a/.jest.js b/.jest.js index b9434c048d..0115fdb041 100644 --- a/.jest.js +++ b/.jest.js @@ -27,6 +27,8 @@ module.exports = { '/^react-dnd-test-backend$/': 'react-dnd-test-backend/dist/cjs', '/^react-dnd-test-utils$/': 'react-dnd-test-utils/dist/cjs', '/\\.(css|less)$/': 'identity-obj-proxy', + '^antd$': '/components/index', + '^antd/es/(.*)$': '/components/$1', }, testPathIgnorePatterns: ['/node_modules/', 'dekko', 'node', 'image.test.js', 'image.test.ts'], transform: { diff --git a/.surgeignore b/.surgeignore new file mode 100644 index 0000000000..514190ab9d --- /dev/null +++ b/.surgeignore @@ -0,0 +1 @@ +!.dumi* diff --git a/.umirc.ts b/.umirc.ts index 260586e0de..e18a128108 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -4,6 +4,7 @@ import rehypeAntd from './.dumi/rehypeAntd'; import { version } from './package.json'; export default defineConfig({ + outputPath: '_site', resolve: { // FIXME: disable docs in temporary docDirs: [], diff --git a/components/__tests__/node.test.tsx b/components/__tests__/node.test.tsx index ff197dec83..41437d03e8 100644 --- a/components/__tests__/node.test.tsx +++ b/components/__tests__/node.test.tsx @@ -26,7 +26,7 @@ describe('node', () => { // Test for ssr describe(componentName, () => { - const demoList = glob.sync(`./components/${componentName}/demo/*.md`); + const demoList = glob.sync(`./components/${componentName}/demo/*.tsx`); // Use mock to get config require(`../../${componentTestFile}`); // eslint-disable-line global-require, import/no-dynamic-require diff --git a/components/affix/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/affix/__tests__/__snapshots__/demo-extend.test.ts.snap index 2edf5200fb..7918167942 100644 --- a/components/affix/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/affix/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`renders ./components/affix/demo/basic.md extend context correctly 1`] = ` +exports[`renders ./components/affix/demo/basic.tsx extend context correctly 1`] = ` Array [
@@ -65,7 +65,7 @@ exports[`renders ./components/affix/demo/debug.md extend context correctly 1`] =
`; -exports[`renders ./components/affix/demo/on-change.md extend context correctly 1`] = ` +exports[`renders ./components/affix/demo/on-change.tsx extend context correctly 1`] = `
`; -exports[`renders ./components/affix/demo/target.md extend context correctly 1`] = ` +exports[`renders ./components/affix/demo/target.tsx extend context correctly 1`] = `
diff --git a/components/affix/__tests__/__snapshots__/demo.test.ts.snap b/components/affix/__tests__/__snapshots__/demo.test.ts.snap index 8cf91e371d..37f34a7490 100644 --- a/components/affix/__tests__/__snapshots__/demo.test.ts.snap +++ b/components/affix/__tests__/__snapshots__/demo.test.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`renders ./components/affix/demo/basic.md correctly 1`] = ` +exports[`renders ./components/affix/demo/basic.tsx correctly 1`] = ` Array [
@@ -65,7 +65,7 @@ exports[`renders ./components/affix/demo/debug.md correctly 1`] = `
`; -exports[`renders ./components/affix/demo/on-change.md correctly 1`] = ` +exports[`renders ./components/affix/demo/on-change.tsx correctly 1`] = `
`; -exports[`renders ./components/affix/demo/target.md correctly 1`] = ` +exports[`renders ./components/affix/demo/target.tsx correctly 1`] = `
diff --git a/components/alert/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/alert/__tests__/__snapshots__/demo-extend.test.ts.snap index 616c776b53..c6ca275596 100644 --- a/components/alert/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/alert/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`renders ./components/alert/demo/action.md extend context correctly 1`] = ` +exports[`renders ./components/alert/demo/action.tsx extend context correctly 1`] = ` Array [
`; -exports[`renders ./components/alert/demo/closable.md extend context correctly 1`] = ` +exports[`renders ./components/alert/demo/closable.tsx extend context correctly 1`] = ` Array [
`; -exports[`renders ./components/alert/demo/custom-icon.md extend context correctly 1`] = ` +exports[`renders ./components/alert/demo/custom-icon.tsx extend context correctly 1`] = ` Array [
`; -exports[`renders ./components/alert/demo/icon.md extend context correctly 1`] = ` +exports[`renders ./components/alert/demo/icon.tsx extend context correctly 1`] = ` Array [ -`; - -exports[`renders ./components/alert/demo/smooth-closed.md extend context correctly 1`] = ` +exports[`renders ./components/alert/demo/smooth-closed.tsx extend context correctly 1`] = `
`; -exports[`renders ./components/alert/demo/style.md extend context correctly 1`] = ` +exports[`renders ./components/alert/demo/style.tsx extend context correctly 1`] = ` Array [
`; -exports[`renders ./components/alert/demo/closable.md correctly 1`] = ` +exports[`renders ./components/alert/demo/closable.tsx correctly 1`] = ` Array [
`; -exports[`renders ./components/alert/demo/custom-icon.md correctly 1`] = ` +exports[`renders ./components/alert/demo/custom-icon.tsx correctly 1`] = ` Array [
`; -exports[`renders ./components/alert/demo/icon.md correctly 1`] = ` +exports[`renders ./components/alert/demo/icon.tsx correctly 1`] = ` Array [ -`; - -exports[`renders ./components/alert/demo/smooth-closed.md correctly 1`] = ` +exports[`renders ./components/alert/demo/smooth-closed.tsx correctly 1`] = `
`; -exports[`renders ./components/alert/demo/style.md correctly 1`] = ` +exports[`renders ./components/alert/demo/style.tsx correctly 1`] = ` Array [
`; -exports[`renders ./components/anchor/demo/customizeHighlight.md extend context correctly 1`] = ` +exports[`renders ./components/anchor/demo/customizeHighlight.tsx extend context correctly 1`] = `
`; -exports[`renders ./components/anchor/demo/onChange.md extend context correctly 1`] = ` +exports[`renders ./components/anchor/demo/onChange.tsx extend context correctly 1`] = `
`; -exports[`renders ./components/anchor/demo/onClick.md extend context correctly 1`] = ` +exports[`renders ./components/anchor/demo/onClick.tsx extend context correctly 1`] = `
`; -exports[`renders ./components/anchor/demo/static.md extend context correctly 1`] = ` +exports[`renders ./components/anchor/demo/static.tsx extend context correctly 1`] = `
`; -exports[`renders ./components/anchor/demo/targetOffset.md extend context correctly 1`] = ` +exports[`renders ./components/anchor/demo/targetOffset.tsx extend context correctly 1`] = `
`; -exports[`renders ./components/anchor/demo/customizeHighlight.md correctly 1`] = ` +exports[`renders ./components/anchor/demo/customizeHighlight.tsx correctly 1`] = `
`; -exports[`renders ./components/anchor/demo/onChange.md correctly 1`] = ` +exports[`renders ./components/anchor/demo/onChange.tsx correctly 1`] = `
`; -exports[`renders ./components/anchor/demo/onClick.md correctly 1`] = ` +exports[`renders ./components/anchor/demo/onClick.tsx correctly 1`] = `
`; -exports[`renders ./components/anchor/demo/static.md correctly 1`] = ` +exports[`renders ./components/anchor/demo/static.tsx correctly 1`] = `
`; -exports[`renders ./components/anchor/demo/targetOffset.md correctly 1`] = ` +exports[`renders ./components/anchor/demo/targetOffset.tsx correctly 1`] = `
`; -exports[`renders ./components/auto-complete/demo/custom.md extend context correctly 1`] = ` +exports[`renders ./components/auto-complete/demo/custom.tsx extend context correctly 1`] = `