From 6578c657ab0926dfa27bdda785b439be46ef03e4 Mon Sep 17 00:00:00 2001 From: Optimistic-Chen <64662582+DBSDs@users.noreply.github.com> Date: Sat, 18 Nov 2023 22:07:35 +0800 Subject: [PATCH] chore: bump dumi@2.x.x (#232) * chore: bump dumi@2.x.x * chore: create package-lock.json add flag 'igonre-scripts' && update snapshots --- .dumirc.ts | 19 ++++++++++++++++++ .github/workflows/ci.yml | 4 ++-- .gitignore | 7 +++---- .umirc.ts | 8 -------- README.md | 6 +++--- docs/demo/arrow.md | 9 +++++++-- docs/demo/context-menu.md | 9 +++++++-- docs/demo/dropdown-menu-width.md | 9 +++++++-- docs/demo/multiple.md | 10 +++++++--- docs/demo/overlay-callback.md | 9 +++++++-- docs/demo/simple.md | 9 +++++++-- docs/index.md | 7 +++++++ package.json | 10 +++++++--- script/update-content.js | 34 ++++++++++++++++++++++++++++++++ tsconfig.json | 6 +++++- 15 files changed, 122 insertions(+), 34 deletions(-) create mode 100644 .dumirc.ts delete mode 100644 .umirc.ts create mode 100644 docs/index.md create mode 100644 script/update-content.js diff --git a/.dumirc.ts b/.dumirc.ts new file mode 100644 index 0000000..ad57b55 --- /dev/null +++ b/.dumirc.ts @@ -0,0 +1,19 @@ +// more config: https://d.umijs.org/config +import { defineConfig } from 'dumi'; + +export default defineConfig({ + favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'], + themeConfig: { + name: 'rc-dropdown', + logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', + }, + outputPath: '.docs', + exportStatic: {}, + styles: [ + ` + section.dumi-default-header-left { + width: 240px; + } + `, + ], +}); diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4f0f92..df8184e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/setup-node@v1 with: - node-version: '14' + node-version: '18' - name: cache package-lock.json uses: actions/cache@v2 @@ -24,7 +24,7 @@ jobs: key: lock-${{ github.sha }} - name: create package-lock.json - run: npm i --package-lock-only + run: npm i --package-lock-only --ignore-script - name: hack for singe file run: | diff --git a/.gitignore b/.gitignore index 8e6550a..0a00254 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -.storybook *.iml *.log .idea/ @@ -31,7 +30,7 @@ yarn.lock package-lock.json # dumi -.umi -.umi-production -.umi-test +.dumi/tmp +.dumi/tmp-test +.dumi/tmp-production .docs diff --git a/.umirc.ts b/.umirc.ts deleted file mode 100644 index b751994..0000000 --- a/.umirc.ts +++ /dev/null @@ -1,8 +0,0 @@ -// more config: https://d.umijs.org/config -import { defineConfig } from 'dumi'; - -export default defineConfig({ - title: 'rc-dropdown', - outputPath: '.docs', - exportStatic: {}, -}); \ No newline at end of file diff --git a/README.md b/README.md index c6c0ff3..76b52a2 100644 --- a/README.md +++ b/README.md @@ -139,21 +139,21 @@ Note: Additional props are passed into the underlying [rc-trigger](https://githu ## Development -``` +```bash npm install npm start ``` ## Test Case -``` +```bash npm test npm run chrome-test ``` ## Coverage -``` +```bash npm run coverage ``` diff --git a/docs/demo/arrow.md b/docs/demo/arrow.md index 03551a4..c43cc24 100644 --- a/docs/demo/arrow.md +++ b/docs/demo/arrow.md @@ -1,3 +1,8 @@ -## Arrow +--- +title: arrow +nav: + title: Demo + path: /demo +--- - \ No newline at end of file + diff --git a/docs/demo/context-menu.md b/docs/demo/context-menu.md index 27649e5..aead798 100644 --- a/docs/demo/context-menu.md +++ b/docs/demo/context-menu.md @@ -1,3 +1,8 @@ -## Context Menu +--- +title: context-menu +nav: + title: Demo + path: /demo +--- - \ No newline at end of file + diff --git a/docs/demo/dropdown-menu-width.md b/docs/demo/dropdown-menu-width.md index 7852342..7cc392e 100644 --- a/docs/demo/dropdown-menu-width.md +++ b/docs/demo/dropdown-menu-width.md @@ -1,3 +1,8 @@ -## Dropdown Menu Width +--- +title: dropdown-menu-width +nav: + title: Demo + path: /demo +--- - \ No newline at end of file + diff --git a/docs/demo/multiple.md b/docs/demo/multiple.md index 7df9366..72581fc 100644 --- a/docs/demo/multiple.md +++ b/docs/demo/multiple.md @@ -1,4 +1,8 @@ -# Multiple +--- +title: multiple +nav: + title: Demo + path: /demo +--- - - \ No newline at end of file + diff --git a/docs/demo/overlay-callback.md b/docs/demo/overlay-callback.md index 215d10c..59efb61 100644 --- a/docs/demo/overlay-callback.md +++ b/docs/demo/overlay-callback.md @@ -1,3 +1,8 @@ -# Overlay Callback +--- +title: overlay-callback +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/simple.md b/docs/demo/simple.md index eda4992..89ac535 100644 --- a/docs/demo/simple.md +++ b/docs/demo/simple.md @@ -1,3 +1,8 @@ -# Simple +--- +title: simple +nav: + title: Demo + path: /demo +--- - \ No newline at end of file + diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..003afe5 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,7 @@ +--- +hero: + title: rc-dropdown + description: React Dropdown Component +--- + + diff --git a/package.json b/package.json index 867df15..882d7c4 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "coverage": "rc-test --coverage", "lint": "eslint src/ docs/examples/ --ext .tsx,.ts,.jsx,.js", "now-build": "npm run build", - "prepare": "husky install", + "prepare": "husky install && dumi setup", "prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish", "start": "dumi dev", "test": "rc-test" @@ -58,9 +58,12 @@ "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", "@types/warning": "^3.0.0", + "@umijs/fabric": "^3.0.0", "cross-env": "^7.0.0", - "dumi": "^1.1.38", + "dumi": "^2.0.0", + "eslint": "^7.18.0", "father": "^4.0.0", + "glob": "^10.0.0", "husky": "^8.0.3", "jest-environment-jsdom": "^29.5.0", "jquery": "^3.3.1", @@ -69,11 +72,12 @@ "np": "^6.0.0", "prettier": "^2.8.7", "rc-menu": "^9.5.2", + "rc-resize-observer": "^1.4.0", "rc-test": "^7.0.14", "react": "^18.0.0", "react-dom": "^18.0.0", "regenerator-runtime": "^0.13.9", - "typescript": "^4.0.2" + "typescript": "^5.0.0" }, "peerDependencies": { "react": ">=16.11.0", diff --git a/script/update-content.js b/script/update-content.js new file mode 100644 index 0000000..365a15a --- /dev/null +++ b/script/update-content.js @@ -0,0 +1,34 @@ +/* + 用于 dumi 改造使用, + 可用于将 examples 的文件批量修改为 demo 引入形式, + 其他项目根据具体情况使用。 +*/ + +const fs = require('fs'); +const glob = require('glob'); + +const paths = glob.sync('./docs/examples/*.jsx'); + +paths.forEach((path) => { + const name = path.split('/').pop().split('.')[0]; + fs.writeFile( + `./docs/demo/${name}.md`, + `--- +title: ${name} +nav: + title: Demo + path: /demo +--- + + +`, + 'utf8', + function (error) { + if (error) { + console.log(error); + return false; + } + console.log(`${name} 更新成功~`); + }, + ); +}); diff --git a/tsconfig.json b/tsconfig.json index 6b571e9..468fa20 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,12 +1,16 @@ { "compilerOptions": { "allowSyntheticDefaultImports": true, + "baseUrl": "./", "declaration": true, "module": "esnext", "target": "esnext", "moduleResolution": "node", "jsx": "react", - "skipLibCheck": true + "skipLibCheck": true, + "paths": { + "@@/*": [".dumi/tmp/*"] + } }, "include": ["./src", "./tests", "./typings/"], "typings": "./typings/index.d.ts",