Skip to content

Commit

Permalink
Merge branch 'react-component:master' into fix-export-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
xettri authored Nov 20, 2023
2 parents 80a8ef3 + 6578c65 commit c5af389
Show file tree
Hide file tree
Showing 15 changed files with 122 additions and 34 deletions.
19 changes: 19 additions & 0 deletions .dumirc.ts
Original file line number Diff line number Diff line change
@@ -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;
}
`,
],
});
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.storybook
*.iml
*.log
.idea/
Expand Down Expand Up @@ -31,7 +30,7 @@ yarn.lock
package-lock.json

# dumi
.umi
.umi-production
.umi-test
.dumi/tmp
.dumi/tmp-test
.dumi/tmp-production
.docs
8 changes: 0 additions & 8 deletions .umirc.ts

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
9 changes: 7 additions & 2 deletions docs/demo/arrow.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Arrow
---
title: arrow
nav:
title: Demo
path: /demo
---

<code src="../examples/arrow.jsx" />
<code src="../examples/arrow.jsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/context-menu.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Context Menu
---
title: context-menu
nav:
title: Demo
path: /demo
---

<code src="../examples/context-menu.jsx" />
<code src="../examples/context-menu.jsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/dropdown-menu-width.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Dropdown Menu Width
---
title: dropdown-menu-width
nav:
title: Demo
path: /demo
---

<code src="../examples/dropdown-menu-width.jsx" />
<code src="../examples/dropdown-menu-width.jsx"></code>
10 changes: 7 additions & 3 deletions docs/demo/multiple.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Multiple
---
title: multiple
nav:
title: Demo
path: /demo
---


<code src="../examples/multiple.jsx" />
<code src="../examples/multiple.jsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/overlay-callback.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Overlay Callback
---
title: overlay-callback
nav:
title: Demo
path: /demo
---

<code src="../examples/overlay-callback.jsx" />
<code src="../examples/overlay-callback.jsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/simple.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Simple
---
title: simple
nav:
title: Demo
path: /demo
---

<code src="../examples/simple.jsx" />
<code src="../examples/simple.jsx"></code>
7 changes: 7 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
hero:
title: rc-dropdown
description: React Dropdown Component
---

<embed src="../README.md"></embed>
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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",
Expand All @@ -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",
Expand Down
34 changes: 34 additions & 0 deletions script/update-content.js
Original file line number Diff line number Diff line change
@@ -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
---
<code src="../examples/${name}.jsx"></code>
`,
'utf8',
function (error) {
if (error) {
console.log(error);
return false;
}
console.log(`${name} 更新成功~`);
},
);
});
6 changes: 5 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit c5af389

Please sign in to comment.