Skip to content

Commit 5f86793

Browse files
committed
build: reuse values from package.json
1 parent c415651 commit 5f86793

File tree

5 files changed

+55
-20
lines changed

5 files changed

+55
-20
lines changed

.size-limit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
"import": "{ Chart }"
1212
},
1313
{
14-
"path": "dist/index.modern.js",
14+
"path": "dist/index.js",
1515
"limit": "1.6 KB",
1616
"webpack": false,
1717
"running": false
1818
},
1919
{
20-
"path": "dist/index.modern.js",
20+
"path": "dist/index.js",
2121
"limit": "800 B",
2222
"import": "{ Chart }"
2323
}

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,26 @@ React components for <a href="https://www.chartjs.org">Chart.js</a>, the most po
66

77
Supports Chart.js v3 and v2.
88

9-
[![version](https://img.shields.io/npm/v/react-chartjs-2.svg)](https://www.npmjs.com/package/react-chartjs-2)
10-
[![downloads](https://img.shields.io/npm/dm/react-chartjs-2.svg)](https://www.npmjs.com/package/react-chartjs-2)
11-
[![license](https://shields.io/badge/license-MIT-green)](http://opensource.org/licenses/MIT)
9+
[![NPM version][npm]][npm-url]
10+
[![Downloads][downloads]][downloads-url]
11+
[![Build status][build]][build-url]
12+
[![Coverage status][coverage]][coverage-url]
13+
[![Bundle size][size]][size-url]
14+
15+
[npm]: https://img.shields.io/npm/v/react-chartjs-2.svg
16+
[npm-url]: https://www.npmjs.com/package/react-chartjs-2
17+
18+
[downloads]: https://img.shields.io/npm/dm/react-chartjs-2.svg
19+
[downloads-url]: https://www.npmjs.com/package/react-chartjs-2
20+
21+
[build]: https://img.shields.io/github/workflow/status/reactchartjs/react-chartjs-2/CI.svg
22+
[build-url]: https://github.com/reactchartjs/react-chartjs-2/actions
23+
24+
[coverage]: https://img.shields.io/codecov/c/github/reactchartjs/react-chartjs-2.svg
25+
[coverage-url]: https://app.codecov.io/gh/reactchartjs/react-chartjs-2
26+
27+
[size]: https://img.shields.io/bundlephobia/minzip/react-chartjs-2
28+
[size-url]: https://bundlephobia.com/package/react-chartjs-2
1229

1330
<br />
1431
<a href="#quickstart">Quickstart</a>

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@
1313
"url": "https://github.com/reactchartjs/react-chartjs-2/issues"
1414
},
1515
"sideEffects": false,
16-
"main": "dist/index.cjs",
17-
"module": "dist/index.modern.js",
18-
"types": "dist/index.d.ts",
16+
"main": "./src/index.tsx",
17+
"types": "./dist/index.d.ts",
18+
"publishConfig": {
19+
"main": "./dist/index.cjs",
20+
"module": "./dist/index.js",
21+
"directory": "package"
22+
},
1923
"keywords": [
2024
"chart",
2125
"chart-js",
@@ -25,10 +29,10 @@
2529
"react-chart.js"
2630
],
2731
"scripts": {
28-
"emitDeclarations": "tsc --skipLibCheck --emitDeclarationOnly",
29-
"build": "rollup -c & pnpm emitDeclarations",
3032
"prepublishOnly": "pnpm test && pnpm build && del ./package && clean-publish",
3133
"postpublish": "del ./package",
34+
"emitDeclarations": "tsc --skipLibCheck --emitDeclarationOnly",
35+
"build": "rollup -c & pnpm emitDeclarations",
3236
"start:storybook": "start-storybook -p 6006 --ci",
3337
"test:lint": "eslint 'src/**/*.{ts,tsx}' 'stories/**/*.{ts,tsx}' 'sandboxes/**/*.{ts,tsx}' 'test/**/*.{ts,tsx}'",
3438
"test:unit": "jest -c jest.config.json",
@@ -117,8 +121,5 @@
117121
"files": [
118122
"dist"
119123
],
120-
"publishConfig": {
121-
"directory": "package"
122-
},
123124
"readme": ""
124125
}

rollup.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,22 @@ const plugins = targets => [
3333

3434
export default [
3535
{
36-
input: 'src/index.tsx',
36+
input: pkg.main,
3737
plugins: plugins('defaults, not ie 11, not ie_mob 11'),
3838
external,
3939
output: {
40-
file: pkg.main,
40+
file: pkg.publishConfig.main,
4141
format: 'cjs',
4242
exports: 'named',
4343
sourcemap: true,
4444
},
4545
},
4646
{
47-
input: 'src/index.tsx',
47+
input: pkg.main,
4848
plugins: plugins('defaults and supports es6-module'),
4949
external,
5050
output: {
51-
file: pkg.module,
51+
file: pkg.publishConfig.module,
5252
format: 'es',
5353
sourcemap: true,
5454
},

website/docs/index.mdx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,26 @@ React components for [Chart.js](https://www.chartjs.org), the most popular chart
1515

1616
Supports Chart.js v3 (read below) and Chart.js v2 (see [this guide](/docs/chartjs-v2)).
1717

18-
[![version](https://img.shields.io/npm/v/react-chartjs-2.svg)](https://www.npmjs.com/package/react-chartjs-2)
19-
[![downloads](https://img.shields.io/npm/dm/react-chartjs-2.svg)](https://www.npmjs.com/package/react-chartjs-2)
20-
[![license](https://shields.io/badge/license-MIT-green)](http://opensource.org/licenses/MIT)
18+
[![NPM version][npm]][npm-url]
19+
[![Downloads][downloads]][downloads-url]
20+
[![Build status][build]][build-url]
21+
[![Coverage status][coverage]][coverage-url]
22+
[![Bundle size][size]][size-url]
23+
24+
[npm]: https://img.shields.io/npm/v/react-chartjs-2.svg
25+
[npm-url]: https://www.npmjs.com/package/react-chartjs-2
26+
27+
[downloads]: https://img.shields.io/npm/dm/react-chartjs-2.svg
28+
[downloads-url]: https://www.npmjs.com/package/react-chartjs-2
29+
30+
[build]: https://img.shields.io/github/workflow/status/reactchartjs/react-chartjs-2/CI.svg
31+
[build-url]: https://github.com/reactchartjs/react-chartjs-2/actions
32+
33+
[coverage]: https://img.shields.io/codecov/c/github/reactchartjs/react-chartjs-2.svg
34+
[coverage-url]: https://app.codecov.io/gh/reactchartjs/react-chartjs-2
35+
36+
[size]: https://img.shields.io/bundlephobia/minzip/react-chartjs-2
37+
[size-url]: https://bundlephobia.com/package/react-chartjs-2
2138

2239
## Quickstart
2340

0 commit comments

Comments
 (0)