Skip to content

Commit

Permalink
chore: use father (#85)
Browse files Browse the repository at this point in the history
* chore: use father

* fix test

* change name

* update lint

* update

* uptate ci

* update

* update

* update

* update

* update

* remove rc-tools

* add lock

* update

* update

* Update .travis.yml

* update ts

* update package

* fix name up

* add test

* fix example & define

Co-authored-by: 偏右 <afc163@gmail.com>
  • Loading branch information
xrkffgg and afc163 authored Sep 1, 2020
1 parent 3d693d8 commit 4bada1e
Show file tree
Hide file tree
Showing 27 changed files with 481 additions and 170 deletions.
16 changes: 16 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const base = require('@umijs/fabric/dist/eslint');

module.exports = {
...base,
rules: {
...base.rules,
'no-template-curly-in-string': 0,
'prefer-promise-reject-errors': 0,
'react/no-array-index-key': 0,
'react/sort-comp': 0,
'@typescript-eslint/no-explicit-any': 0,
'jsx-a11y/role-supports-aria-props': 0,
'jsx-a11y/no-noninteractive-tabindex': 0,
'import/no-extraneous-dependencies': 0,
},
};
9 changes: 9 additions & 0 deletions .fatherrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
cjs: "babel",
esm: { type: "babel", importLibToEs: true },
preCommit: {
eslint: true,
prettier: true,
},
runtimeHelpers: true,
};
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ build
lib
es
coverage/
yarn.lock
yarn.lock
package-lock.json
.storybook
.doc
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": true,
"trailingComma": "all",
"proseWrap": "never",
"printWidth": 100
}
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ sudo: false
notifications:
email:
- yiminghe@gmail.com
- afc163@gmail.com
- yesmeck@gmail.com

node_js:
- 10
- 12

script:
- |
Expand All @@ -19,7 +17,10 @@ script:
else
npm run $TEST_TYPE
fi
env:
matrix:
- TEST_TYPE=lint
- TEST_TYPE=test
- TEST_TYPE=coverage
- TEST_TYPE=compile
Empty file removed assets/index.less
Empty file.
1 change: 0 additions & 1 deletion examples/fast-progress.html

This file was deleted.

20 changes: 10 additions & 10 deletions examples/fast-progress.js → examples/fast-progress.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import 'rc-progress/assets/index.less';
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { Line, Circle } from 'rc-progress';
import * as React from 'react';
import { Line, Circle, ProgressProps } from '../src';

class App extends Component {
constructor() {
super();
class App extends React.Component<ProgressProps, any> {
constructor(props) {
super(props);
this.state = {
percent: 0,
};
this.increase = this.increase.bind(this);
this.restart = this.restart.bind(this);
}

private tm: number;

componentDidMount() {
this.increase();
}
Expand All @@ -39,8 +39,8 @@ class App extends Component {
const { percent } = this.state;
return (
<div style={{ margin: 10, width: 200 }}>
<Circle strokeWidth="6" percent={percent} />
<Line strokeWidth="4" percent={percent} />
<Circle strokeWidth={6} percent={percent} />
<Line strokeWidth={4} percent={percent} />
<button type="button" onClick={this.restart}>
Restart
</button>
Expand All @@ -49,4 +49,4 @@ class App extends Component {
}
}

ReactDOM.render(<App />, document.getElementById('__react-content'));
export default App;
1 change: 0 additions & 1 deletion examples/gap.html

This file was deleted.

30 changes: 15 additions & 15 deletions examples/gap.js → examples/gap.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import 'rc-progress/assets/index.less';
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { Circle } from 'rc-progress';
import * as React from 'react';
import { Circle, ProgressProps } from '../src';

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

function getColor(index) {
return colorMap[(index + colorMap.length) % colorMap.length];
}
class Example extends Component {
constructor() {
super();

class Example extends React.Component<ProgressProps, any> {
constructor(props) {
super(props);
this.state = {
percent: 30,
colorIndex: 0,
Expand All @@ -18,8 +18,8 @@ class Example extends Component {
}

changeState() {
const value = parseInt(Math.random() * 100, 10);
const colorIndex = parseInt(Math.random() * 3, 10);
const value = parseInt((Math.random() * 100).toString(), 10);
const colorIndex = parseInt((Math.random() * 3).toString(), 10);
this.setState({
percent: value,
colorIndex,
Expand All @@ -45,7 +45,7 @@ class Example extends Component {
percent={percent}
gapDegree={70}
gapPosition="top"
strokeWidth="6"
strokeWidth={6}
strokeLinecap="square"
strokeColor={color}
/>
Expand All @@ -55,8 +55,8 @@ class Example extends Component {
percent={[percent / 3, percent / 3, percent / 3]}
gapDegree={70}
gapPosition="bottom"
strokeWidth="6"
trailWidth="6"
strokeWidth={6}
trailWidth={6}
strokeLinecap="round"
strokeColor={[color, getColor(colorIndex + 1), getColor(colorIndex + 2)]}
/>
Expand All @@ -67,7 +67,7 @@ class Example extends Component {
percent={percent}
gapDegree={70}
gapPosition="left"
strokeWidth="6"
strokeWidth={6}
strokeLinecap="square"
strokeColor={color}
/>
Expand All @@ -77,7 +77,7 @@ class Example extends Component {
percent={percent}
gapDegree={70}
gapPosition="right"
strokeWidth="6"
strokeWidth={6}
strokeLinecap="square"
strokeColor={color}
/>
Expand All @@ -87,4 +87,4 @@ class Example extends Component {
}
}

ReactDOM.render(<Example />, document.getElementById('__react-content'));
export default Example;
1 change: 0 additions & 1 deletion examples/gradient-circle.html

This file was deleted.

15 changes: 7 additions & 8 deletions examples/gradient-circle.js → examples/gradient-circle.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import 'rc-progress/assets/index.less';
import React from 'react';
import ReactDOM from 'react-dom';
import { Circle } from 'rc-progress';
import * as React from 'react';
import { Circle } from '../src';

const Example = () => {
const circleContainerStyle = {
width: '250px',
height: '250px',
display: 'inline-block',
};

return (
<div>
<h3>Circle Progress {90}%</h3>
<div style={circleContainerStyle}>
<Circle
percent={90}
strokeWidth="6"
strokeWidth={6}
strokeLinecap="round"
strokeColor={{
'0%': '#108ee9',
Expand All @@ -27,7 +26,7 @@ const Example = () => {
<div style={circleContainerStyle}>
<Circle
percent={100}
strokeWidth="6"
strokeWidth={6}
strokeLinecap="round"
strokeColor={{
'100%': '#108ee9',
Expand All @@ -39,7 +38,7 @@ const Example = () => {
<div style={circleContainerStyle}>
<Circle
percent={[65, 100]}
strokeWidth="6"
strokeWidth={6}
strokeLinecap="round"
strokeColor={[
'#87d068',
Expand All @@ -54,4 +53,4 @@ const Example = () => {
);
};

ReactDOM.render(<Example />, document.getElementById('__react-content'));
export default Example;
1 change: 0 additions & 1 deletion examples/simple.html

This file was deleted.

24 changes: 11 additions & 13 deletions examples/simple.js → examples/simple.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import 'rc-progress/assets/index.less';
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { Line, Circle } from 'rc-progress';
import * as React from 'react';
import { Line, Circle, ProgressProps } from '../src';

class Example extends Component {
constructor() {
super();
class Example extends React.Component<ProgressProps, any> {
constructor(props) {
super(props);
this.state = {
percent: 30,
color: '#3FC7FA',
Expand All @@ -15,10 +13,10 @@ class Example extends Component {

changeState() {
const colorMap = ['#3FC7FA', '#85D262', '#FE8C6A'];
const value = parseInt(Math.random() * 100, 10);
const value = parseInt((Math.random() * 100).toString(), 10);
this.setState({
percent: value,
color: colorMap[parseInt(Math.random() * 3, 10)],
color: colorMap[parseInt((Math.random() * 3).toString(), 10)],
});
}

Expand All @@ -36,16 +34,16 @@ class Example extends Component {
<div>
<h3>Line Progress {percent}%</h3>
<div style={containerStyle}>
<Line percent={percent} strokeWidth="4" strokeColor={color} />
<Line percent={percent} strokeWidth={4} strokeColor={color} />
<Line
percent={[percent / 2, percent / 2]}
strokeWidth="4"
strokeWidth={4}
strokeColor={[color, '#CCC']}
/>
</div>
<h3>Circle Progress {percent}%</h3>
<div style={circleContainerStyle}>
<Circle percent={percent} strokeWidth="6" strokeLinecap="round" strokeColor={color} />
<Circle percent={percent} strokeWidth={6} strokeLinecap="round" strokeColor={color} />
</div>
<p>
<button type="button" onClick={this.changeState}>
Expand All @@ -57,4 +55,4 @@ class Example extends Component {
}
}

ReactDOM.render(<Example />, document.getElementById('__react-content'));
export default Example;
8 changes: 0 additions & 8 deletions index.js

This file was deleted.

4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
setupFiles: ["./tests/setup.js"],
snapshotSerializers: [require.resolve("enzyme-to-json/serializer")],
};
11 changes: 11 additions & 0 deletions now.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": 2,
"name": "rc-progress",
"builds": [
{
"src": "package.json",
"use": "@now/static-build",
"config": { "distDir": ".doc" }
}
]
}
Loading

1 comment on commit 4bada1e

@vercel
Copy link

@vercel vercel bot commented on 4bada1e Sep 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.