Skip to content

Commit fcfa319

Browse files
committed
chore: use dumi
1 parent 07a3eda commit fcfa319

36 files changed

+146
-44
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,9 @@ package-lock.json
3030
coverage/
3131
.doc
3232
dist
33-
.vscode
33+
.vscode
34+
# umi
35+
.umi
36+
.umi-production
37+
.umi-test
38+
.env.local

.umirc.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// more config: https://d.umijs.org/config
2+
import { defineConfig } from 'dumi';
3+
4+
export default defineConfig({
5+
title: 'rc-pagination',
6+
favicon:
7+
'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
8+
logo:
9+
'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
10+
outputPath: '.doc',
11+
exportStatic: {},
12+
styles: [
13+
`
14+
.markdown table {
15+
width: auto !important;
16+
}
17+
`,
18+
]
19+
});

HISTORY.md renamed to CHANGELOG.md

File renamed without changes.

README.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
# rc-pagination
22

3-
---
4-
53
React Pagination Component.
64

7-
[![NPM version][npm-image]][npm-url]
8-
[![build status][github-actions-image]][github-actions-url]
9-
[![Test coverage][coveralls-image]][coveralls-url]
10-
[![codecov](https://codecov.io/gh/react-component/pagination/branch/master/graph/badge.svg)](https://codecov.io/gh/react-component/pagination)
11-
[![Dependencies](https://img.shields.io/david/react-component/pagination.svg?style=flat-square)](https://david-dm.org/react-component/pagination)
12-
[![DevDependencies](https://img.shields.io/david/dev/react-component/pagination.svg?style=flat-square)](https://david-dm.org/react-component/pagination?type=dev)
13-
[![npm download][download-image]][download-url]
5+
[![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Test coverage][coveralls-image]][coveralls-url] [![codecov](https://codecov.io/gh/react-component/pagination/branch/master/graph/badge.svg)](https://codecov.io/gh/react-component/pagination) [![Dependencies](https://img.shields.io/david/react-component/pagination.svg?style=flat-square)](https://david-dm.org/react-component/pagination) [![DevDependencies](https://img.shields.io/david/dev/react-component/pagination.svg?style=flat-square)](https://david-dm.org/react-component/pagination?type=dev) [![npm download][download-image]][download-url]
146

157
[npm-image]: http://img.shields.io/npm/v/rc-pagination.svg?style=flat-square
168
[npm-url]: http://npmjs.org/package/rc-pagination
@@ -32,7 +24,7 @@ npm start
3224

3325
http://localhost:9001
3426

35-
online example: http://react-component.github.io/pagination/
27+
online example: https://pagination-react-component.vercel.app
3628

3729
## Install
3830

docs/demo/default.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## default
2+
3+
<code src="../examples/default.js">

docs/demo/itemRender.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## itemRender
2+
3+
<code src="../examples/itemRender.js">

docs/demo/jumper.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## jumper
2+
3+
<code src="../examples/jumper.js">

docs/demo/jumperWithGoButton.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## jumperWithGoButton
2+
3+
<code src="../examples/jumperWithGoButton.js">

docs/demo/lessPages.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## lessPages
2+
3+
<code src="../examples/lessPages.js">

docs/demo/locale.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## locale
2+
3+
<code src="../examples/locale.js">

docs/demo/more.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## more
2+
3+
<code src="../examples/more.js">

docs/demo/showTitle.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## showTitle
2+
3+
<code src="../examples/showTitle.js">

docs/demo/showTotal.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## showTotal
2+
3+
<code src="../examples/showTotal.js">

docs/demo/simple.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## simple
2+
3+
<code src="../examples/simple.js">

docs/demo/sizer.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## sizer
2+
3+
<code src="../examples/sizer.js">

docs/demo/stupid.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## stupid
2+
3+
<code src="../examples/stupid.js">

docs/demo/styles.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## styles
2+
3+
<code src="../examples/styles.js">

examples/default.js renamed to docs/examples/default.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint func-names: 0, no-console: 0 */
22
import React from 'react';
3-
import Pagination from '..';
4-
import '../assets/index.less';
3+
import Pagination from 'rc-pagination';
4+
import '../../assets/index.less';
55
import 'rc-select/assets/index.less';
66

77
export default class App extends React.Component {

examples/itemRender.js renamed to docs/examples/itemRender.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import '../assets/index.less';
1+
import '../../assets/index.less';
22
import React from 'react';
3-
import Pagination from '..';
3+
import Pagination from 'rc-pagination';
44

55
const itemRender = (current, type, element) => {
66
if (type === 'page') {

examples/jumper.js renamed to docs/examples/jumper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint func-names: 0, no-console: 0 */
22
import React from 'react';
33
import Select from 'rc-select';
4-
import Pagination from '..';
5-
import '../assets/index.less';
4+
import Pagination from 'rc-pagination';
5+
import '../../assets/index.less';
66
import 'rc-select/assets/index.less';
77

88
function onShowSizeChange(current, pageSize) {

examples/jumperWithGoButton.js renamed to docs/examples/jumperWithGoButton.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint func-names: 0, no-console: 0 */
22
import React from 'react';
33
import Select from 'rc-select';
4-
import Pagination from '..';
5-
import '../assets/index.less';
4+
import Pagination from 'rc-pagination';
5+
import '../../assets/index.less';
66
import 'rc-select/assets/index.less';
77

88
class App extends React.Component {

examples/lessPages.js renamed to docs/examples/lessPages.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint func-names: 0, no-console: 0 */
22
import React from 'react';
3-
import Pagination from '..';
4-
import '../assets/index.less';
3+
import Pagination from 'rc-pagination';
4+
import '../../assets/index.less';
55

66
const arrowPath =
77
'M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h' +

examples/locale.js renamed to docs/examples/locale.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint func-names: 0, no-console: 0 */
22
import React from 'react';
33
import Select from 'rc-select';
4-
import Pagination from '..';
5-
import localeInfo from '../src/locale/en_US';
6-
import '../assets/index.less';
4+
import Pagination from 'rc-pagination';
5+
import localeInfo from 'rc-pagination/locale/en_US';
6+
import '../../assets/index.less';
77
import 'rc-select/assets/index.less';
88

99
function onShowSizeChange(current, pageSize) {

examples/more.js renamed to docs/examples/more.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import '../assets/index.less';
1+
import '../../assets/index.less';
22
import React from 'react';
3-
import Pagination from '..';
3+
import Pagination from 'rc-pagination';
44

55
const App = () => (
66
<Pagination className="ant-pagination" defaultCurrent={3} total={450} />

examples/showTitle.js renamed to docs/examples/showTitle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint func-names: 0, no-console: 0 */
22
import React from 'react';
3-
import Pagination from '..';
4-
import '../assets/index.less';
3+
import Pagination from 'rc-pagination';
4+
import '../../assets/index.less';
55

66
class App extends React.Component {
77
state = {

examples/showTotal.js renamed to docs/examples/showTotal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
2-
import Pagination from '..';
3-
import '../assets/index.less';
2+
import Pagination from 'rc-pagination';
3+
import '../../assets/index.less';
44

55
const App = () => (
66
<>

examples/simple.js renamed to docs/examples/simple.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import '../assets/index.less';
1+
import '../../assets/index.less';
22
import React from 'react';
3-
import Pagination from '..';
3+
import Pagination from 'rc-pagination';
44

55
const App = () => (
66
<>

examples/sizer.js renamed to docs/examples/sizer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint func-names: 0, no-console: 0 */
22
import React from 'react';
33
import Select from 'rc-select';
4-
import Pagination from '..';
5-
import '../assets/index.less';
4+
import Pagination from 'rc-pagination';
5+
import '../../assets/index.less';
66
import 'rc-select/assets/index.less';
77

88
class App extends React.Component {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import Pagination from '..';
3-
import '../assets/index.less';
2+
import Pagination from 'rc-pagination';
3+
import '../../assets/index.less';
44

55
export default () => <Pagination simple defaultCurrent={1} total={50} />;

examples/styles.js renamed to docs/examples/styles.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import '../assets/index.less';
1+
import '../../assets/index.less';
22
import React from 'react';
3-
import Pagination from '..';
3+
import Pagination from 'rc-pagination';
44

55
export default () => (
66
<Pagination defaultCurrent={2} total={25} style={{ margin: '100px' }} />

docs/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: rc-image
3+
---
4+
5+
<embed src="../README.md"></embed>

index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

now.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
"use": "@now/static-build",
88
"config": { "distDir": ".doc" }
99
}
10+
],
11+
"routes": [
12+
{ "src": "/(.*)", "dest": "/dist/$1" }
1013
]
1114
}

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,17 @@
3131
},
3232
"license": "MIT",
3333
"scripts": {
34-
"start": "cross-env NODE_ENV=development father doc dev --storybook",
35-
"build": "father doc build --storybook",
34+
"start": "dumi dev",
35+
"docs:build": "dumi build",
36+
"docs:deploy": "gh-pages -d docs-dist",
3637
"compile": "father build && lessc assets/index.less assets/index.css",
37-
"gh-pages": "npm run build && father doc deploy",
3838
"prepublishOnly": "npm run compile && np --yolo --no-publish && npm run gh-pages",
3939
"lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md",
4040
"prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
4141
"pretty-quick": "pretty-quick",
4242
"test": "father test",
43-
"coverage": "father test --coverage"
43+
"coverage": "father test --coverage",
44+
"now-build": "npm run docs:build"
4445
},
4546
"dependencies": {
4647
"@babel/runtime": "^7.10.1",
@@ -54,11 +55,13 @@
5455
"@umijs/fabric": "^2.0.3",
5556
"coveralls": "^3.0.6",
5657
"cross-env": "^7.0.0",
58+
"dumi": "^1.1.7",
5759
"enzyme": "^3.0.0",
5860
"enzyme-adapter-react-16": "^1.0.1",
5961
"enzyme-to-json": "^3.4.0",
6062
"eslint": "^7.0.0",
6163
"father": "^2.13.4",
64+
"glob": "^7.1.6",
6265
"less": "^3.10.3",
6366
"np": "^7.0.0",
6467
"prettier": "^2.0.1",

tsconfig.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@
55
"lib": ["dom", "es2017"],
66
"jsx": "react",
77
"strict": true,
8+
"baseUrl": "./",
89
"esModuleInterop": true,
910
"experimentalDecorators": true,
1011
"emitDecoratorMetadata": true,
1112
"skipLibCheck": true,
12-
"declaration": true
13+
"declaration": true,
14+
"paths": {
15+
"@/*": ["src/*"],
16+
"@@/*": ["src/.umi/*"],
17+
"rc-pagination": ["src/index.js"]
18+
}
1319
}
1420
}

update-example.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
用于 dumi 改造使用,
3+
可用于将 examples 的文件批量修改为 demo 引入形式,
4+
其他项目根据具体情况使用。
5+
*/
6+
7+
const fs = require('fs');
8+
const glob = require('glob');
9+
10+
const suffix = '.js';
11+
12+
const paths = glob.sync(`./docs/examples/*${suffix}`);
13+
14+
paths.forEach(path => {
15+
const name = path.split('/').pop().split('.')[0];
16+
fs.writeFile(
17+
`./docs/demo/${name}.md`,
18+
`## ${name}
19+
20+
<code src="../examples/${name}${suffix}">
21+
`,
22+
'utf8',
23+
function(error) {
24+
if(error){
25+
console.log(error);
26+
return false;
27+
}
28+
console.log(`${name} 更新成功~`);
29+
}
30+
)
31+
});

0 commit comments

Comments
 (0)