diff --git a/.umirc.ts b/.dumirc.ts similarity index 56% rename from .umirc.ts rename to .dumirc.ts index 4a422ff..69833f0 100644 --- a/.umirc.ts +++ b/.dumirc.ts @@ -2,9 +2,11 @@ import { defineConfig } from 'dumi'; export default defineConfig({ - title: 'rc-util', - favicon: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', - logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', + favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'], + themeConfig: { + name: 'portal', + logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', + }, outputPath: '.doc', exportStatic: {}, styles: [ diff --git a/.fatherrc.js b/.fatherrc.ts similarity index 100% rename from .fatherrc.js rename to .fatherrc.ts diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fd20354..83dcb71 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/setup-node@v1 with: - node-version: '12' + 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-scripts - name: hack for singe file run: | diff --git a/.gitignore b/.gitignore index 8a331ed..21dbd0b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -.storybook *.iml *.log .idea @@ -29,8 +28,8 @@ yarn.lock package-lock.json .doc -# umi -.umi -.umi-production -.umi-test +# dumi +.dumi/tmp +.dumi/tmp-test +.dumi/tmp-production .env.local \ No newline at end of file diff --git a/docs/demo/basic.md b/docs/demo/basic.md index ad6f032..0f22440 100644 --- a/docs/demo/basic.md +++ b/docs/demo/basic.md @@ -1,4 +1,8 @@ -## basic +--- +title: basic +nav: + title: Demo + path: /demo +--- - - + diff --git a/docs/demo/getContainer.md b/docs/demo/getContainer.md index c456cc1..91b47fe 100644 --- a/docs/demo/getContainer.md +++ b/docs/demo/getContainer.md @@ -1,4 +1,8 @@ -## getContainer +--- +title: getContainer +nav: + title: Demo + path: /demo +--- - - + diff --git a/docs/demo/inlineOrder.md b/docs/demo/inlineOrder.md index 7a33fc9..be16cce 100644 --- a/docs/demo/inlineOrder.md +++ b/docs/demo/inlineOrder.md @@ -1,4 +1,8 @@ -## Inline Order +--- +title: inlineOrder +nav: + title: Demo + path: /demo +--- - - + diff --git a/docs/index.md b/docs/index.md index 8563407..e7d6310 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,5 +1,7 @@ --- -title: rc-portal +hero: + title: rc-portal + description: React Portal Component --- diff --git a/package.json b/package.json index 2e45c2d..7537926 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ ], "scripts": { "compile": "father build", + "prepare": "dumi setup", "deploy": "npm run docs:build && npm run docs:deploy", "docs:build": "dumi build", "docs:deploy": "gh-pages -d docs-dist", @@ -52,18 +53,20 @@ "@testing-library/jest-dom": "^5.16.4", "@testing-library/react": "^13.0.0", "@types/jest": "^26.0.20", + "@types/node": "^20.9.0", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", - "@umijs/fabric": "^2.5.2", - "dumi": "^1.1.0", + "@umijs/fabric": "^3.0.0", + "dumi": "^2.0.0", "eslint": "^7.18.0", - "father": "^4.0.0-rc.8", + "father": "^4.0.0", "gh-pages": "^3.1.0", + "glob": "^10.0.0", "np": "^5.0.3", "prettier": "^2.1.2", "react": "^18.0.0", "react-dom": "^18.0.0", - "typescript": "^4.6.3", + "typescript": "^5.0.0", "umi-test": "^1.9.7" }, "peerDependencies": { diff --git a/script/update-content.js b/script/update-content.js new file mode 100644 index 0000000..e9ed487 --- /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/*.tsx'); + +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 c28fb52..6e12177 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,7 @@ "esModuleInterop": true, "paths": { "@/*": ["src/*"], - "@@/*": ["src/.umi/*"], + "@@/*": [".dumi/tmp/*"], "@rc-component/portal": ["src/Portal.tsx"] } }