Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use dumi #98

Merged
merged 1 commit into from
Jan 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ yarn.lock
package-lock.json
.storybook
.doc

# umi
.umi
.umi-production
.umi-test
.env.local
19 changes: 19 additions & 0 deletions .umirc.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({
title: 'rc-progress',
favicon:
'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
logo:
'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
outputPath: '.doc',
exportStatic: {},
styles: [
`
.markdown table {
width: auto !important;
}
`,
]
});
14 changes: 12 additions & 2 deletions HISTORY.md → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# History
# Changelog

---
## 3.1.2

`2020.12.29`

- fix: line progress percentage. [#94](https://github.com/react-component/progress/pull/94)

## 3.1.1

`2020.10.21`

- chore: support react 17. [#87](https://github.com/react-component/progress/pull/87)

## 3.1.0

Expand Down
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

Progress Bar.

[![NPM version][npm-image]][npm-url]
[![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]
[![NPM version][npm-image]][npm-url] [![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]

[npm-image]: http://img.shields.io/npm/v/rc-progress.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rc-progress
Expand All @@ -29,7 +23,7 @@ Progress Bar.

## Example

http://react-component.github.io/progress/
https://progress.react-component.vercel.app/

## Screenshots

Expand Down
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<embed src="../CHANGELOG.md"></embed>
3 changes: 3 additions & 0 deletions docs/demo/fast-progress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## fast-progress

<code src="../examples/fast-progress.tsx">
3 changes: 3 additions & 0 deletions docs/demo/gap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## gap

<code src="../examples/gap.tsx">
3 changes: 3 additions & 0 deletions docs/demo/gradient-circle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## gradient-circle

<code src="../examples/gradient-circle.tsx">
3 changes: 3 additions & 0 deletions docs/demo/simple.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## simple

<code src="../examples/simple.tsx">
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Line, Circle, ProgressProps } from '../src';
import { Line, Circle, ProgressProps } from 'rc-progress';

class App extends React.Component<ProgressProps, any> {
constructor(props) {
Expand Down
2 changes: 1 addition & 1 deletion examples/gap.tsx → docs/examples/gap.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Circle, ProgressProps } from '../src';
import { Circle, ProgressProps } from 'rc-progress';

const colorMap = ['#3FC7FA', '#85D262', '#FE8C6A'];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Circle } from '../src';
import { Circle } from 'rc-progress';

const Example = () => {
const circleContainerStyle = {
Expand Down
28 changes: 26 additions & 2 deletions examples/simple.tsx → docs/examples/simple.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Line, Circle, ProgressProps } from '../src';
import { Line, Circle, ProgressProps } from 'rc-progress';

class Example extends React.Component<ProgressProps, any> {
constructor(props) {
Expand All @@ -9,6 +9,8 @@ class Example extends React.Component<ProgressProps, any> {
color: '#3FC7FA',
};
this.changeState = this.changeState.bind(this);
this.changeIncrease = this.changeIncrease.bind(this);
this.changeReduce = this.changeReduce.bind(this);
}

changeState() {
Expand All @@ -18,7 +20,23 @@ class Example extends React.Component<ProgressProps, any> {
percent: value,
color: colorMap[parseInt((Math.random() * 3).toString(), 10)],
});
}
};

changeIncrease() {
let percent = this.state.percent + 10;
if (percent > 100) {
percent = 100;
}
this.setState({ percent });
};

changeReduce() {
let percent = this.state.percent - 10;
if (percent < 0) {
percent = 0;
}
this.setState({ percent });
};

render() {
const { percent, color } = this.state;
Expand Down Expand Up @@ -49,6 +67,12 @@ class Example extends React.Component<ProgressProps, any> {
<button type="button" onClick={this.changeState}>
Change State
</button>
<button type="button" onClick={this.changeIncrease}>
Increase
</button>
<button type="button" onClick={this.changeReduce}>
Reduce
</button>
</p>
</div>
);
Expand Down
5 changes: 5 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: rc-progress
---

<embed src="../README.md"></embed>
3 changes: 3 additions & 0 deletions now.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"use": "@now/static-build",
"config": { "distDir": ".doc" }
}
],
"routes": [
{ "src": "/(.*)", "dest": "/dist/$1" }
]
}
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@
"es"
],
"scripts": {
"start": "cross-env NODE_ENV=development father doc dev --storybook",
"build": "father doc build --storybook",
"start": "dumi dev",
"docs:build": "dumi build",
"docs:deploy": "gh-pages -d docs-dist",
"compile": "father build",
"gh-pages": "npm run build && father doc deploy",
"prepublishOnly": "npm run compile && np --yolo --no-publish",
"lint": "eslint src/ --ext .ts,.tsx,.jsx,.js",
"prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
"test": "father test",
"coverage": "father test --coverage"
"coverage": "father test --coverage",
"now-build": "npm run docs:build"
},
"peerDependencies": {
"react": ">=16.9.0",
Expand All @@ -49,11 +51,13 @@
"@types/react-dom": "^16.9.0",
"@umijs/fabric": "^2.0.0",
"cross-env": "^7.0.0",
"dumi": "^1.1.0",
"enzyme": "^3.1.1",
"enzyme-adapter-react-16": "^1.0.1",
"enzyme-to-json": "^3.1.2",
"eslint": "^7.6.0",
"father": "^2.29.6",
"glob": "^7.1.6",
"np": "^6.5.0",
"prettier": "^2.1.1",
"react": "^16.9.0",
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"esModuleInterop": true,
"paths": {
"@/*": ["src/*"],
"@@/*": ["src/.umi/*"]
"@@/*": ["src/.umi/*"],
"rc-progress": ["src/index.tsx"]
}
}
}
2 changes: 2 additions & 0 deletions typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare module '*.css';
declare module '*.less';
29 changes: 29 additions & 0 deletions update-content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
用于 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`,
`## ${name}

<code src="../examples/${name}.tsx">
`,
'utf8',
function(error) {
if(error){
console.log(error);
return false;
}
console.log(`${name} 更新成功~`);
}
)
});