Skip to content

Commit 4fbaf8f

Browse files
authored
chore: use dumi (#289)
* chore: use dumi * Update README.md * Update package.json
1 parent 3c313ff commit 4fbaf8f

26 files changed

+130
-39
lines changed

.editorconfig

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
# top-most EditorConfig file
1+
# http://editorconfig.org
22
root = true
33

4-
# Unix-style newlines with a newline ending every file
5-
[*.{js,css}]
6-
end_of_line = lf
7-
insert_final_newline = true
4+
[*]
85
indent_style = space
96
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[Makefile]
16+
indent_style = tab

.gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@ es
2727
coverage
2828
yarn.lock
2929
package-lock.json
30-
.doc/
30+
.doc/
31+
32+
# umi
33+
.umi
34+
.umi-production
35+
.umi-test
36+
.env.local

.umirc.ts

+19
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-input-number',
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 CHANGELOG.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# History
2-
----
1+
# Changelog
2+
3+
https://github.com/react-component/input-number/releases
34

45
## 5.0.0
56

README.md

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
# rc-input-number
2-
---
32

43
Input number control.
54

6-
[![NPM version][npm-image]][npm-url]
7-
[![build status][github-actions-image]][github-actions-url]
8-
[![Test coverage][coveralls-image]][coveralls-url]
9-
[![Dependencies][david-image]][david-url]
10-
[![DevDependencies][david-dev-image]][david-dev-url]
11-
[![npm download][download-image]][download-url]
12-
[![bundle size][bundlephobia-image]][bundlephobia-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] [![Dependencies][david-image]][david-url] [![DevDependencies][david-dev-image]][david-dev-url] [![npm download][download-image]][download-url] [![bundle size][bundlephobia-image]][bundlephobia-url]
136

147
[npm-image]: http://img.shields.io/npm/v/rc-input-number.svg?style=flat-square
158
[npm-url]: http://npmjs.org/package/rc-input-number
@@ -55,7 +48,7 @@ npm start
5548

5649
http://127.0.0.1:8000/examples/
5750

58-
online example: http://react-component.github.io/input-number/examples
51+
online example: https://input-number.vercel.app/
5952

6053
## API
6154

docs/demo/combination-key-format.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## combination-key-format
2+
3+
<code src="../examples/combination-key-format.tsx">

docs/demo/custom.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## custom
2+
3+
<code src="../examples/custom.tsx">

docs/demo/decimal.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## decimal
2+
3+
<code src="../examples/decimal.tsx">

docs/demo/formatter.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## formatter
2+
3+
<code src="../examples/formatter.tsx">

docs/demo/precision.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## precision
2+
3+
<code src="../examples/precision.tsx">

docs/demo/simple-use-touch.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## simple-use-touch
2+
3+
<code src="../examples/simple-use-touch.tsx">

docs/demo/simple.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## simple
2+
3+
<code src="../examples/simple.tsx">

docs/demo/small-step.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## small-step
2+
3+
<code src="../examples/small-step.tsx">

examples/combination-key-format.tsx docs/examples/combination-key-format.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import InputNumber from '../src';
4-
import '../assets/index.less';
3+
import InputNumber from 'rc-input-number';
4+
import '../../assets/index.less';
55

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

examples/custom.tsx docs/examples/custom.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import InputNumber from '../src';
4-
import '../assets/index.less';
3+
import InputNumber from 'rc-input-number';
4+
import '../../assets/index.less';
55

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

examples/decimal.tsx docs/examples/decimal.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import InputNumber from '../src';
4-
import '../assets/index.less';
3+
import InputNumber from 'rc-input-number';
4+
import '../../assets/index.less';
55

66
export default class Demo extends React.Component {
77
state = {

examples/formatter.tsx docs/examples/formatter.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import InputNumber from '../src';
4-
import '../assets/index.less';
3+
import InputNumber from 'rc-input-number';
4+
import '../../assets/index.less';
55

66
function getSum(str) {
77
let total = 0;

examples/precision.tsx docs/examples/precision.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import InputNumber from '../src';
4-
import '../assets/index.less';
3+
import InputNumber from 'rc-input-number';
4+
import '../../assets/index.less';
55

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

examples/simple-use-touch.tsx docs/examples/simple-use-touch.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import InputNumber from '../src';
4-
import '../assets/index.less';
3+
import InputNumber from 'rc-input-number';
4+
import '../../assets/index.less';
55

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

examples/simple.tsx docs/examples/simple.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import InputNumber from '../src';
4-
import '../assets/index.less';
3+
import InputNumber from 'rc-input-number';
4+
import '../../assets/index.less';
55

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

examples/small-step.tsx docs/examples/small-step.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import InputNum from '../src';
4-
import '../assets/index.less';
3+
import InputNum from 'rc-input-number';
4+
import '../../assets/index.less';
55

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

docs/index.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: rc-input-number
3+
---
4+
5+
<embed src="../README.md"></embed>

now.json

+3
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

+7-5
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626
},
2727
"license": "MIT",
2828
"scripts": {
29-
"start": "cross-env NODE_ENV=development father doc dev --storybook",
30-
"build": "father doc build --storybook",
29+
"start": "dumi dev",
30+
"docs:build": "dumi build",
31+
"docs:deploy": "gh-pages -d docs-dist",
3132
"compile": "father build && lessc assets/index.less assets/index.css",
32-
"gh-pages": "npm run build && father doc deploy",
3333
"prepublishOnly": "npm run compile && np --yolo --no-publish",
34-
"postpublish": "npm run gh-pages",
3534
"lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md",
3635
"prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
3736
"test": "father test",
38-
"coverage": "father test --coverage"
37+
"coverage": "father test --coverage",
38+
"now-build": "npm run docs:build"
3939
},
4040
"dependencies": {
4141
"@babel/runtime": "^7.10.1",
@@ -49,12 +49,14 @@
4949
"@types/react-dom": "^16.9.0",
5050
"@umijs/fabric": "^2.0.0",
5151
"cross-env": "^7.0.0",
52+
"dumi": "^1.1.0",
5253
"enzyme": "^3.1.1",
5354
"enzyme-adapter-react-16": "^1.0.1",
5455
"enzyme-to-json": "^3.1.2",
5556
"eslint": "^7.1.0",
5657
"expect.js": "~0.3.1",
5758
"father": "^2.22.0",
59+
"glob": "^7.1.6",
5860
"less": "^3.12.2",
5961
"np": "^6.0.0",
6062
"rc-tooltip": "^4.0.3",

tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"skipLibCheck": true,
99
"esModuleInterop": true,
1010
"paths": {
11-
"@/*": ["src/*"]
11+
"@/*": ["src/*"],
12+
"@@/*": ["src/.umi/*"],
13+
"rc-input-number": ["src/index.ts"]
1214
}
1315
}
1416
}

update-demo.js

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

0 commit comments

Comments
 (0)