diff --git a/.umirc.ts b/.dumirc.ts similarity index 61% rename from .umirc.ts rename to .dumirc.ts index 3ca4313..f50092d 100644 --- a/.umirc.ts +++ b/.dumirc.ts @@ -2,9 +2,11 @@ import { defineConfig } from 'dumi'; export default defineConfig({ - title: 'rc-footer', - 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: 'rc-footer', + logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', + }, outputPath: '.doc', exportStatic: {}, base: '/footer/', diff --git a/.fatherrc.js b/.fatherrc.js deleted file mode 100644 index 912aa0a..0000000 --- a/.fatherrc.js +++ /dev/null @@ -1,9 +0,0 @@ -export default { - cjs: 'babel', - esm: { type: 'babel', importLibToEs: true }, - preCommit: { - eslint: true, - prettier: true, - }, - runtimeHelpers: true, -}; diff --git a/.fatherrc.ts b/.fatherrc.ts new file mode 100644 index 0000000..a5e7c0d --- /dev/null +++ b/.fatherrc.ts @@ -0,0 +1,5 @@ +import { defineConfig } from "father"; + +export default defineConfig({ + plugins: ["@rc-component/father-plugin"], +}); diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 432a3fb..6bfd63e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,9 +2,9 @@ name: CI on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: setup: @@ -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: | @@ -43,7 +43,7 @@ jobs: - name: install if: steps.node_modules_cache_id.outputs.cache-hit != 'true' run: npm ci - + lint: runs-on: ubuntu-latest steps: @@ -66,7 +66,7 @@ jobs: run: npm run lint needs: setup - + compile: runs-on: ubuntu-latest steps: @@ -89,7 +89,7 @@ jobs: run: npm run compile needs: setup - + coverage: runs-on: ubuntu-latest steps: diff --git a/.gitignore b/.gitignore index b23f753..4e75ffd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -.storybook *.iml *.log .idea/ @@ -30,8 +29,8 @@ package-lock.json coverage/ .doc -# umi -.umi -.umi-production -.umi-test -.env.local \ No newline at end of file +# dumi +.dumi/tmp +.dumi/tmp-test +.dumi/tmp-production +.env.local diff --git a/docs/demo/rows.md b/docs/demo/rows.md index e9ec929..17148fd 100644 --- a/docs/demo/rows.md +++ b/docs/demo/rows.md @@ -1,3 +1,8 @@ -## rows +--- +title: rows +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/simple.md b/docs/demo/simple.md index efaf04c..64848ae 100644 --- a/docs/demo/simple.md +++ b/docs/demo/simple.md @@ -1,3 +1,8 @@ -## simple +--- +title: simple +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/demo/theme.md b/docs/demo/theme.md index 173386b..4944e71 100644 --- a/docs/demo/theme.md +++ b/docs/demo/theme.md @@ -1,3 +1,8 @@ -## theme +--- +title: theme +nav: + title: Demo + path: /demo +--- - + diff --git a/docs/index.md b/docs/index.md index 9d31e3a..05d48ba 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,5 +1,7 @@ --- -title: rc-footer +hero: + title: rc-footer + description: React Footer Component --- diff --git a/package.json b/package.json index 842602a..02671be 100644 --- a/package.json +++ b/package.json @@ -33,42 +33,44 @@ "docs:build": "dumi build", "docs:deploy": "gh-pages -d .doc", "compile": "father build && lessc assets/index.less assets/index.css", + "prepare": "husky install && dumi setup", "gh-pages": "npm run docs:build && father doc deploy", "prepublishOnly": "npm run compile && np --yolo --no-publish && npm run gh-pages", "lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md", "prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"", "pretty-quick": "pretty-quick", - "test": "father test", - "coverage": "father test --coverage" + "test": "rc-test", + "coverage": "rc-test --coverage" }, "dependencies": { "@babel/runtime": "^7.11.1", "classnames": "^2.2.1" }, "devDependencies": { + "@rc-component/father-plugin": "^1.0.0", "@types/classnames": "^2.2.9", "@types/react": "^17.0.13", "@types/react-dom": "^16.9.0", "@umijs/fabric": "^2.0.8", "coveralls": "^3.0.6", "cross-env": "^7.0.2", - "dumi": "^1.1.0", + "dumi": "^2.0.0", "enzyme": "^3.0.0", - "enzyme-adapter-react-16": "^1.0.1", + "enzyme-adapter-react-16": "^1.15.6", "enzyme-to-json": "^3.4.0", "eslint": "^7.0.0", - "father": "^2.13.4", - "father-build": "^1.18.6", + "father": "^4.0.0", "gh-pages": "^3.1.0", - "husky": "^4.2.5", + "glob": "^10.0.0", + "husky": "^8.0.3", "less": "^3.10.3", "np": "^7.0.0", "prettier": "^2.0.5", "pretty-quick": "^3.0.0", + "rc-test": "^7.0.15", "react": "^16.0.0", "react-dom": "^16.0.0", - "react-test-renderer": "^16.0.0", - "typescript": "^4.0.5" + "typescript": "^5.0.0" }, "peerDependencies": { "react": ">=16.0.0", diff --git a/script/update-content.js b/script/update-content.js new file mode 100644 index 0000000..9ac5777 --- /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 2e2e5a9..f058414 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,7 +14,7 @@ "declaration": true, "paths": { "@/*": ["src/*"], - "@@/*": ["src/.umi/*"], + "@@/*": [".dumi/tmp/*"], "rc-footer": ["src/index.tsx"] } }