Skip to content

Commit 82b871b

Browse files
authored
refactor: remove svelte files from package (#54)
BREAKING CHANGE: svelte files were removed from the package, now you should use named exports
1 parent 813804d commit 82b871b

File tree

11 files changed

+14
-54
lines changed

11 files changed

+14
-54
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Need an API to fetch data? Consider [Cube](https://cube.dev/?ref=eco-svelte-char
4545

4646
```svelte
4747
<script>
48-
import Line from 'svelte-chartjs/Line.svelte'
48+
import { Line } from 'svelte-chartjs'
4949
</script>
5050
5151
<Line data={...} />
@@ -79,7 +79,7 @@ import Line from 'svelte-chartjs/src/Line.svelte'
7979
v2:
8080

8181
```javascript
82-
import Line from 'svelte-chartjs/Line.svelte'
82+
import { Line } from 'svelte-chartjs'
8383
```
8484

8585
### Tree-shaking
@@ -97,14 +97,14 @@ import Line from 'svelte-chartjs/src/Line.svelte'
9797
v2 — lazy way:
9898

9999
```javascript
100-
import Line from 'svelte-chartjs/Line.svelte'
100+
import { Line } from 'svelte-chartjs'
101101
import 'chart.js/auto';
102102
```
103103

104104
v2 — tree-shakable way:
105105

106106
```javascript
107-
import Line from 'svelte-chartjs/Line.svelte'
107+
import { Line } from 'svelte-chartjs'
108108
import { Chart as ChartJS, Title, Tooltip, Legend, LineElement, LinearScale, PointElement, CategoryScale } from 'chart.js';
109109

110110
ChartJS.register(Title, Tooltip, Legend, LineElement, LinearScale, PointElement, CategoryScale);
@@ -115,7 +115,7 @@ Using the "lazy way" is okay to simplify the migration, but please consider usin
115115
Please note that typed chart components register their controllers by default, so you don't need to register them by yourself. For example, when using the Pie component, you don't need to register PieController explicitly.
116116

117117
```javascript
118-
import Pie from 'svelte-chartjs/Pie.svelte';
118+
import { Pie } from 'svelte-chartjs';
119119
import { Chart as ChartJS, Title, Tooltip, Legend, ArcElement, CategoryScale } from 'chart.js'
120120

121121
ChartJS.register(Title, Tooltip, Legend, ArcElement, CategoryScale)

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
},
2727
"scripts": {
2828
"emitDeclarations": "node scripts/emitSvelteDeclarations.cjs",
29-
"build:svelte": "svelte-strip strip src/ dist",
30-
"build": "rollup -c && pnpm build:svelte && pnpm emitDeclarations",
29+
"build": "rollup -c && pnpm emitDeclarations",
3130
"prepublishOnly": "pnpm test && pnpm build && del ./package && clean-publish",
3231
"postpublish": "del ./package",
3332
"commit": "cz",
@@ -87,7 +86,6 @@
8786
"svelte-jester": "^2.3.2",
8887
"svelte-loader": "^3.1.3",
8988
"svelte-preprocess": "^4.10.7",
90-
"svelte-strip": "^1.0.1",
9189
"svelte2tsx": "^0.5.11",
9290
"typescript": "^4.7.4"
9391
}

pnpm-lock.yaml

Lines changed: 0 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sandboxes/bar/components/Chart.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import Bar from 'svelte-chartjs/Bar.svelte';
2+
import { Bar } from 'svelte-chartjs';
33
import { data } from './data.js';
44
55
import {

sandboxes/bubble/components/Chart.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import Bubble from 'svelte-chartjs/Bubble.svelte';
2+
import { Bubble } from 'svelte-chartjs';
33
import { data } from './data.js';
44
55
import {

sandboxes/doughnut/components/Chart.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import Doughnut from 'svelte-chartjs/Doughnut.svelte';
2+
import { Doughnut } from 'svelte-chartjs';
33
import { data } from './data.js';
44
55
import {

sandboxes/line/components/Chart.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import Line from 'svelte-chartjs/Line.svelte';
2+
import { Line } from 'svelte-chartjs';
33
import { data } from './data.js';
44
55
import {

sandboxes/pie/components/Chart.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import Pie from 'svelte-chartjs/Pie.svelte';
2+
import { Pie } from 'svelte-chartjs';
33
import { data } from './data.js';
44
55
import {

sandboxes/polar/components/Chart.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import Polar from 'svelte-chartjs/Polar.svelte';
2+
import { Polar } from 'svelte-chartjs';
33
import { data } from './data.js';
44
55
import {

sandboxes/radar/components/Chart.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import Radar from 'svelte-chartjs/Radar.svelte';
2+
import { Radar } from 'svelte-chartjs';
33
import { data } from './data.js';
44
55
import {

0 commit comments

Comments
 (0)