From efd8c03ca8d8dcb89c15746bd823bf68daf62a84 Mon Sep 17 00:00:00 2001
From: xrkffgg
Date: Fri, 8 Jan 2021 15:24:47 +0800
Subject: [PATCH] chore: use dumi
---
.gitignore | 6 ++++
.umirc.ts | 19 ++++++++++++
HISTORY.md => CHANGELOG.md | 14 +++++++--
README.md | 10 ++-----
docs/changelog.md | 1 +
docs/demo/fast-progress.md | 3 ++
docs/demo/gap.md | 3 ++
docs/demo/gradient-circle.md | 3 ++
docs/demo/simple.md | 3 ++
{examples => docs/examples}/fast-progress.tsx | 2 +-
{examples => docs/examples}/gap.tsx | 2 +-
.../examples}/gradient-circle.tsx | 2 +-
{examples => docs/examples}/simple.tsx | 28 ++++++++++++++++--
docs/index.md | 5 ++++
now.json | 3 ++
package.json | 10 +++++--
tsconfig.json | 3 +-
typings.d.ts | 2 ++
update-content.js | 29 +++++++++++++++++++
19 files changed, 129 insertions(+), 19 deletions(-)
create mode 100644 .umirc.ts
rename HISTORY.md => CHANGELOG.md (75%)
create mode 100644 docs/changelog.md
create mode 100644 docs/demo/fast-progress.md
create mode 100644 docs/demo/gap.md
create mode 100644 docs/demo/gradient-circle.md
create mode 100644 docs/demo/simple.md
rename {examples => docs/examples}/fast-progress.tsx (94%)
rename {examples => docs/examples}/gap.tsx (97%)
rename {examples => docs/examples}/gradient-circle.tsx (96%)
rename {examples => docs/examples}/simple.tsx (68%)
create mode 100644 docs/index.md
create mode 100644 typings.d.ts
create mode 100644 update-content.js
diff --git a/.gitignore b/.gitignore
index 4e39e43..3a57596 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,3 +31,9 @@ yarn.lock
package-lock.json
.storybook
.doc
+
+# umi
+.umi
+.umi-production
+.umi-test
+.env.local
diff --git a/.umirc.ts b/.umirc.ts
new file mode 100644
index 0000000..61fee84
--- /dev/null
+++ b/.umirc.ts
@@ -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;
+ }
+ `,
+ ]
+});
diff --git a/HISTORY.md b/CHANGELOG.md
similarity index 75%
rename from HISTORY.md
rename to CHANGELOG.md
index 57a1081..df7e33a 100644
--- a/HISTORY.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/README.md b/README.md
index 40f2ada..8bf4be6 100644
--- a/README.md
+++ b/README.md
@@ -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
@@ -29,7 +23,7 @@ Progress Bar.
## Example
-http://react-component.github.io/progress/
+https://progress.react-component.vercel.app/
## Screenshots
diff --git a/docs/changelog.md b/docs/changelog.md
new file mode 100644
index 0000000..beb2edd
--- /dev/null
+++ b/docs/changelog.md
@@ -0,0 +1 @@
+
diff --git a/docs/demo/fast-progress.md b/docs/demo/fast-progress.md
new file mode 100644
index 0000000..15a2c54
--- /dev/null
+++ b/docs/demo/fast-progress.md
@@ -0,0 +1,3 @@
+## fast-progress
+
+
diff --git a/docs/demo/gap.md b/docs/demo/gap.md
new file mode 100644
index 0000000..4529d83
--- /dev/null
+++ b/docs/demo/gap.md
@@ -0,0 +1,3 @@
+## gap
+
+
diff --git a/docs/demo/gradient-circle.md b/docs/demo/gradient-circle.md
new file mode 100644
index 0000000..b1a10f8
--- /dev/null
+++ b/docs/demo/gradient-circle.md
@@ -0,0 +1,3 @@
+## gradient-circle
+
+
diff --git a/docs/demo/simple.md b/docs/demo/simple.md
new file mode 100644
index 0000000..efaf04c
--- /dev/null
+++ b/docs/demo/simple.md
@@ -0,0 +1,3 @@
+## simple
+
+
diff --git a/examples/fast-progress.tsx b/docs/examples/fast-progress.tsx
similarity index 94%
rename from examples/fast-progress.tsx
rename to docs/examples/fast-progress.tsx
index 7b8d8dd..83cb04d 100644
--- a/examples/fast-progress.tsx
+++ b/docs/examples/fast-progress.tsx
@@ -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 {
constructor(props) {
diff --git a/examples/gap.tsx b/docs/examples/gap.tsx
similarity index 97%
rename from examples/gap.tsx
rename to docs/examples/gap.tsx
index cd752b3..913a1ee 100644
--- a/examples/gap.tsx
+++ b/docs/examples/gap.tsx
@@ -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'];
diff --git a/examples/gradient-circle.tsx b/docs/examples/gradient-circle.tsx
similarity index 96%
rename from examples/gradient-circle.tsx
rename to docs/examples/gradient-circle.tsx
index 2b844e8..58762d0 100644
--- a/examples/gradient-circle.tsx
+++ b/docs/examples/gradient-circle.tsx
@@ -1,5 +1,5 @@
import * as React from 'react';
-import { Circle } from '../src';
+import { Circle } from 'rc-progress';
const Example = () => {
const circleContainerStyle = {
diff --git a/examples/simple.tsx b/docs/examples/simple.tsx
similarity index 68%
rename from examples/simple.tsx
rename to docs/examples/simple.tsx
index b09ec41..1e3f8ec 100644
--- a/examples/simple.tsx
+++ b/docs/examples/simple.tsx
@@ -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 {
constructor(props) {
@@ -9,6 +9,8 @@ class Example extends React.Component {
color: '#3FC7FA',
};
this.changeState = this.changeState.bind(this);
+ this.changeIncrease = this.changeIncrease.bind(this);
+ this.changeReduce = this.changeReduce.bind(this);
}
changeState() {
@@ -18,7 +20,23 @@ class Example extends React.Component {
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;
@@ -49,6 +67,12 @@ class Example extends React.Component {
+
+
);
diff --git a/docs/index.md b/docs/index.md
new file mode 100644
index 0000000..8ad49d0
--- /dev/null
+++ b/docs/index.md
@@ -0,0 +1,5 @@
+---
+title: rc-progress
+---
+
+
diff --git a/now.json b/now.json
index 2302b8d..79b71e2 100644
--- a/now.json
+++ b/now.json
@@ -7,5 +7,8 @@
"use": "@now/static-build",
"config": { "distDir": ".doc" }
}
+ ],
+ "routes": [
+ { "src": "/(.*)", "dest": "/dist/$1" }
]
}
diff --git a/package.json b/package.json
index 42db8b8..624a03e 100644
--- a/package.json
+++ b/package.json
@@ -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",
@@ -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",
diff --git a/tsconfig.json b/tsconfig.json
index 3260922..a52bda9 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -10,7 +10,8 @@
"esModuleInterop": true,
"paths": {
"@/*": ["src/*"],
- "@@/*": ["src/.umi/*"]
+ "@@/*": ["src/.umi/*"],
+ "rc-progress": ["src/index.tsx"]
}
}
}
\ No newline at end of file
diff --git a/typings.d.ts b/typings.d.ts
new file mode 100644
index 0000000..71e0e9f
--- /dev/null
+++ b/typings.d.ts
@@ -0,0 +1,2 @@
+declare module '*.css';
+declare module '*.less';
diff --git a/update-content.js b/update-content.js
new file mode 100644
index 0000000..c898f9e
--- /dev/null
+++ b/update-content.js
@@ -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}
+
+
+`,
+ 'utf8',
+ function(error) {
+ if(error){
+ console.log(error);
+ return false;
+ }
+ console.log(`${name} 更新成功~`);
+ }
+ )
+});