Skip to content

Commit 37d2dc8

Browse files
committed
Cleanup
1 parent 3506136 commit 37d2dc8

34 files changed

+2481
-2081
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
}
88
],
99
"@babel/react"
10-
],
10+
]
1111
}

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if (process.env.NODE_ENV === 'production') {
2+
module.exports = require('./dist/react-charts.production.min.js')
3+
} else {
4+
module.exports = require('./dist/react-charts.development.js')
5+
}

package.json

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,60 +5,66 @@
55
"author": "tannerlinsley",
66
"license": "MIT",
77
"repository": "react-tools/react-charts",
8-
"main": "dist/index.js",
9-
"_module": "dist/index.es.js",
10-
"_jsnext:main": "dist/index.es.js",
8+
"main": "index.js",
9+
"module": "dist/react-charts.mjs",
1110
"scripts": {
12-
"test": "cross-env CI=1 react-scripts test --env=jsdom",
13-
"test:watch": "react-scripts test --env=jsdom",
14-
"build": "rollup -c",
15-
"start": "rollup -c -w",
11+
"test": "is-ci \"test:ci\" \"test:dev\"",
12+
"test:dev": "jest --watch",
13+
"test:ci": "jest",
14+
"test:coverage": "yarn test:ci; open coverage/lcov-report/index.html",
15+
"build-d3": "rollup -c src/d3/rollup.config.js",
16+
"build": "yarn build-d3 && NODE_ENV=production rollup -c",
17+
"now-build": "yarn && cd www && yarn && yarn build",
18+
"start": "yarn build-d3 && rollup -c -w",
19+
"prepare": "yarn build",
20+
"prepublishOnly": "yarn test:ci",
1621
"release": "yarn publish",
1722
"releaseNext": "yarn publish --tag next",
18-
"prettier": "prettier src/**/*.js --write"
23+
"format": "prettier {src,src/**,example/src,example/src/**}/*.{md,js,jsx,tsx} --write",
24+
"doctoc": "npx doctoc --maxlevel 2 README.md"
1925
},
26+
"files": [
27+
"dist"
28+
],
2029
"peerDependencies": {
21-
"prop-types": "^15.5.4",
2230
"react": "^16.6.3"
2331
},
2432
"dependencies": {
25-
"@reach/observe-rect": "^1.0.3",
26-
"d3-delaunay": "^5.1.6",
27-
"d3-scale": "^3.2.0",
33+
"@reach/observe-rect": "^1.1.0",
34+
"d3-delaunay": "^5.2.1",
35+
"d3-scale": "^3.2.1",
2836
"d3-shape": "^1.3.7",
29-
"d3-voronoi": "^1.1.2",
30-
"raf": "^3.4.1"
37+
"d3-voronoi": "^1.1.2"
3138
},
3239
"devDependencies": {
33-
"@babel/plugin-proposal-class-properties": "^7.7.0",
34-
"@babel/preset-env": "^7.7.1",
35-
"@babel/preset-react": "^7.7.0",
36-
"@svgr/rollup": "^4.3.3",
40+
"@babel/preset-env": "^7.9.0",
41+
"@babel/preset-react": "^7.9.4",
42+
"@rollup/plugin-node-resolve": "^7.1.1",
43+
"@svgr/rollup": "^5.3.0",
3744
"babel-core": "7.0.0-bridge.0",
38-
"babel-eslint": "10.0.3",
39-
"cross-env": "^6.0.3",
40-
"eslint": "6.6.0",
41-
"eslint-config-prettier": "^6.7.0",
42-
"eslint-config-react-app": "^5.0.2",
43-
"eslint-config-standard": "^14.1.0",
45+
"babel-eslint": "10.1.0",
46+
"cross-env": "^7.0.2",
47+
"eslint": "6.8.0",
48+
"eslint-config-prettier": "^6.10.1",
49+
"eslint-config-react-app": "^5.2.1",
50+
"eslint-config-standard": "^14.1.1",
4451
"eslint-config-standard-react": "^9.2.0",
45-
"eslint-plugin-flowtype": "4.4.1",
46-
"eslint-plugin-import": "2.18.2",
52+
"eslint-plugin-flowtype": "4.7.0",
53+
"eslint-plugin-import": "2.20.1",
4754
"eslint-plugin-jsx-a11y": "6.2.3",
48-
"eslint-plugin-node": "^10.0.0",
55+
"eslint-plugin-node": "^11.0.0",
4956
"eslint-plugin-promise": "^4.2.1",
50-
"eslint-plugin-react": "7.16.0",
51-
"eslint-plugin-react-hooks": "2.3.0",
57+
"eslint-plugin-react": "7.19.0",
58+
"eslint-plugin-react-hooks": "2.5.1",
5259
"eslint-plugin-standard": "^4.0.1",
53-
"react": "^16.12.0",
54-
"react-dom": "^16.12.0",
55-
"rollup": "^1.27.2",
56-
"rollup-plugin-babel": "^4.3.3",
60+
"react": "^16.13.1",
61+
"react-dom": "^16.13.1",
62+
"rollup": "^2.2.0",
63+
"rollup-plugin-babel": "^4.4.0",
5764
"rollup-plugin-commonjs": "^10.1.0",
5865
"rollup-plugin-node-resolve": "^5.2.0",
59-
"rollup-plugin-peer-deps-external": "^2.2.0"
60-
},
61-
"files": [
62-
"dist"
63-
]
66+
"rollup-plugin-peer-deps-external": "^2.2.2",
67+
"rollup-plugin-size": "^0.2.2",
68+
"rollup-plugin-terser": "^5.3.0"
69+
}
6470
}

prettier.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
printWidth: 80,
3+
tabWidth: 2,
4+
useTabs: false,
5+
semi: false,
6+
singleQuote: true,
7+
trailingComma: "es5",
8+
bracketSpacing: true,
9+
jsxBracketSameLine: false,
10+
arrowParens: "avoid",
11+
endOfLine: "auto"
12+
};

rollup.config.js

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,47 @@
1-
import babel from "rollup-plugin-babel";
2-
import commonjs from "rollup-plugin-commonjs";
3-
import external from "rollup-plugin-peer-deps-external";
4-
import resolve from "rollup-plugin-node-resolve";
1+
import babel from 'rollup-plugin-babel'
2+
import { terser } from 'rollup-plugin-terser'
3+
import size from 'rollup-plugin-size'
4+
import resolve from '@rollup/plugin-node-resolve'
55

6-
import pkg from "./package.json";
6+
const external = ['react']
77

8-
export default {
9-
input: "src/index.js",
10-
output: [
11-
{
12-
file: pkg.main,
13-
format: "cjs",
14-
sourcemap: true
15-
}
16-
// {
17-
// file: pkg.module,
18-
// format: "es",
19-
// sourcemap: true
20-
// }
21-
],
22-
plugins: [
23-
external(),
24-
babel({
25-
exclude: "node_modules/**"
26-
}),
27-
resolve(),
28-
commonjs()
29-
]
30-
};
8+
const globals = {
9+
react: 'React',
10+
}
11+
12+
export default [
13+
{
14+
input: 'src/index.js',
15+
output: {
16+
file: 'dist/react-charts.min.mjs',
17+
format: 'es',
18+
sourcemap: true,
19+
},
20+
external,
21+
plugins: [resolve(), babel(), terser()],
22+
},
23+
{
24+
input: 'src/index.js',
25+
output: {
26+
name: 'ReactCharts',
27+
file: 'dist/react-charts.development.js',
28+
format: 'umd',
29+
sourcemap: true,
30+
globals,
31+
},
32+
external,
33+
plugins: [resolve(), babel()],
34+
},
35+
{
36+
input: 'src/index.js',
37+
output: {
38+
name: 'ReactCharts',
39+
file: 'dist/react-charts.production.min.js',
40+
format: 'umd',
41+
sourcemap: true,
42+
globals,
43+
},
44+
external,
45+
plugins: [resolve(), babel(), terser(), size()],
46+
},
47+
]

size-plugin.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"timestamp":1585154943498,"files":[{"filename":"react-charts.production.min.js","size":16475,"delta":16475}]}]

src/components/Axis.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
1-
import React from "react";
1+
import React from 'react'
22
//
3-
// import AxisPie from './AxisPie'
4-
import AxisLinear from "./AxisLinear";
3+
import AxisLinear from './AxisLinear'
54

6-
export default class Axis extends React.Component {
7-
render() {
8-
const { type } = this.props;
9-
10-
// if (type === 'pie') {
11-
// return <AxisPie {...this.props} />
12-
// }
13-
14-
return <AxisLinear {...this.props} />;
15-
}
5+
export default function Axis(props) {
6+
return <AxisLinear {...props} />
167
}

0 commit comments

Comments
 (0)