From 2c477083c82396f3a0470660defc7f7e16bf09cf 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: Thu, 21 Sep 2023 11:12:52 +0800 Subject: [PATCH] docs: use father@4 & dumi@2 (#944) * chore: update dumi * docs: update * docs: now * chore: now folder --- .dumirc.ts | 16 ++++++++++++++++ .fatherrc.js | 14 +++++--------- .gitignore | 1 + .umirc.ts | 21 --------------------- docs/demo/debug.md | 9 +++++++-- docs/demo/handle.md | 9 +++++++-- docs/demo/marks.md | 9 +++++++-- docs/demo/range.md | 9 +++++++-- docs/demo/slider.md | 9 +++++++-- docs/demo/vertical.md | 9 +++++++-- jest.config.js | 1 - now.json | 5 +---- package.json | 13 ++++++------- tests/setup.js | 9 --------- 14 files changed, 71 insertions(+), 63 deletions(-) create mode 100644 .dumirc.ts delete mode 100644 .umirc.ts diff --git a/.dumirc.ts b/.dumirc.ts new file mode 100644 index 000000000..0c6969ca9 --- /dev/null +++ b/.dumirc.ts @@ -0,0 +1,16 @@ +import { defineConfig } from 'dumi'; +import path from 'path'; + +export default defineConfig({ + alias: { + 'rc-slider$': path.resolve('src'), + 'rc-slider/es': path.resolve('src'), + }, + mfsu: false, + favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'], + themeConfig: { + name: 'Slider', + logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', + }, + styles: [``], +}); diff --git a/.fatherrc.js b/.fatherrc.js index 912aa0aae..4ddbafd19 100644 --- a/.fatherrc.js +++ b/.fatherrc.js @@ -1,9 +1,5 @@ -export default { - cjs: 'babel', - esm: { type: 'babel', importLibToEs: true }, - preCommit: { - eslint: true, - prettier: true, - }, - runtimeHelpers: true, -}; +import { defineConfig } from 'father'; + +export default defineConfig({ + plugins: ['@rc-component/father-plugin'], +}); \ No newline at end of file diff --git a/.gitignore b/.gitignore index 39baebe78..5289a2524 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ package-lock.json .umi-production .umi-test .env.local +.dumi/ \ No newline at end of file diff --git a/.umirc.ts b/.umirc.ts deleted file mode 100644 index 467e2e455..000000000 --- a/.umirc.ts +++ /dev/null @@ -1,21 +0,0 @@ -// more config: https://d.umijs.org/config -import { defineConfig } from 'dumi'; - -const name = 'rc-slider'; - -export default defineConfig({ - title: name, - favicon: - 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', - logo: - 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', - outputPath: '.doc', - exportStatic: {}, - styles: [ - ` - .markdown table { - width: auto !important; - } - `, - ] -}); diff --git a/docs/demo/debug.md b/docs/demo/debug.md index 27706ef0f..e686944a2 100644 --- a/docs/demo/debug.md +++ b/docs/demo/debug.md @@ -1,3 +1,8 @@ -## debug +--- +title: Debug +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/handle.md b/docs/demo/handle.md index 5c0b3b37c..3b625d4c4 100644 --- a/docs/demo/handle.md +++ b/docs/demo/handle.md @@ -1,3 +1,8 @@ -## handle +--- +title: Handle +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/marks.md b/docs/demo/marks.md index 9229dd9a5..fd435f94c 100644 --- a/docs/demo/marks.md +++ b/docs/demo/marks.md @@ -1,3 +1,8 @@ -## marks +--- +title: Marks +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/range.md b/docs/demo/range.md index ee0985c4e..9fba5b6df 100644 --- a/docs/demo/range.md +++ b/docs/demo/range.md @@ -1,3 +1,8 @@ -## range +--- +title: Range +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/slider.md b/docs/demo/slider.md index a12fc54ba..e45fba26f 100644 --- a/docs/demo/slider.md +++ b/docs/demo/slider.md @@ -1,3 +1,8 @@ -## slider +--- +title: Slider +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/vertical.md b/docs/demo/vertical.md index 4c8d42174..e181210d1 100644 --- a/docs/demo/vertical.md +++ b/docs/demo/vertical.md @@ -1,3 +1,8 @@ -## vertical +--- +title: Vertical +nav: + title: Demo + path: /demo +--- - + diff --git a/jest.config.js b/jest.config.js index 2ddb77c2c..90d413906 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,3 @@ module.exports = { setupFiles: ["./tests/setup.js"], - snapshotSerializers: [require.resolve("enzyme-to-json/serializer")] }; diff --git a/now.json b/now.json index e907ff500..a23b01b82 100644 --- a/now.json +++ b/now.json @@ -5,10 +5,7 @@ { "src": "package.json", "use": "@now/static-build", - "config": { "distDir": ".doc" } + "config": { "distDir": "dist" } } - ], - "routes": [ - { "src": "/(.*)", "dest": "/dist/$1" } ] } \ No newline at end of file diff --git a/package.json b/package.json index 00b000406..caf249920 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,8 @@ "prepublishOnly": "npm run compile && np --yolo --no-publish", "lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md", "prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"", - "test": "father test", - "coverage": "father test --coverage", + "test": "rc-test", + "coverage": "rc-test --coverage", "now-build": "npm run docs:build" }, "peerDependencies": { @@ -54,6 +54,7 @@ "rc-util": "^5.27.0" }, "devDependencies": { + "@rc-component/father-plugin": "^1.0.2", "@testing-library/jest-dom": "^5.16.2", "@testing-library/react": "^12.1.3", "@types/classnames": "^2.2.9", @@ -62,17 +63,15 @@ "@types/react-dom": "^18.0.11", "@umijs/fabric": "^2.0.0", "cross-env": "^7.0.0", - "dumi": "^1.1.7", - "enzyme": "^3.1.0", - "enzyme-adapter-react-16": "^1.0.1", - "enzyme-to-json": "^3.1.2", + "dumi": "^2.2.10", "eslint": "^7.1.0", - "father": "^2.22.0", + "father": "^4.3.5", "father-build": "^1.18.6", "gh-pages": "^3.1.0", "glob": "^7.1.6", "less": "^3.10.3", "np": "^7.0.0", + "rc-test": "^7.0.15", "rc-tooltip": "^5.0.1", "rc-trigger": "^5.0.4", "react": "^16.0.0", diff --git a/tests/setup.js b/tests/setup.js index b74e53e15..e69de29bb 100644 --- a/tests/setup.js +++ b/tests/setup.js @@ -1,9 +0,0 @@ -global.requestAnimationFrame = global.requestAnimationFrame || function _raf(cb) { - return setTimeout(cb, 0); -}; -require('regenerator-runtime'); - -const Enzyme = require('enzyme'); -const Adapter = require('enzyme-adapter-react-16'); - -Enzyme.configure({ adapter: new Adapter() });