Skip to content

Commit

Permalink
update paths
Browse files Browse the repository at this point in the history
  • Loading branch information
bherbruck committed May 21, 2024
1 parent 0bc9d57 commit 88f1bb9
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 31 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"package": "svelte-kit sync && svelte-package && publint",
"package": "svelte-kit sync && svelte-package -i ./src/lib/svelte-echarts && publint",
"prepublishOnly": "npm run package",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
Expand Down
2 changes: 0 additions & 2 deletions src/lib/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type { init as coreInit, EChartsType as CoreEchartsType } from 'echarts/core'
import type { EChartsOption, EChartsInitOpts } from 'echarts'
import { createEventDispatcher } from 'svelte'
import { EVENT_NAMES, type EventHandlers } from '$lib/constants/events'
import { EVENT_NAMES, type EventHandlers } from '$lib/svelte-echarts/constants/events'
import type { Action } from 'svelte/action'
export let init: typeof baseInit | typeof coreInit
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions src/lib/svelte-echarts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as Chart } from '$lib/svelte-echarts/components/Chart.svelte'
export type { ECMouseEvent, ECInteractionEvent } from '$lib/svelte-echarts/constants/events'
File renamed without changes.
7 changes: 2 additions & 5 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script lang="ts">
import { onMount } from 'svelte'
import { Chart } from '$lib'
import type { ECMouseEvent } from '$lib/constants/events'
import { Chart, type ECMouseEvent } from 'svelte-echarts'
import { init, use } from 'echarts/core'
import type { EChartsOption } from 'echarts'
Expand Down Expand Up @@ -53,14 +52,12 @@
data = randomData(7, 100)
}
let interval: number
const handleClick = ({ detail }: CustomEvent<ECMouseEvent>) => {
alert(`${detail.name} ${detail.value}`)
}
onMount(() => {
interval = setInterval(updateData, 10000)
const interval = setInterval(updateData, 10000)
return () => clearInterval(interval)
})
</script>
Expand Down
13 changes: 3 additions & 10 deletions src/routes/examples/classic/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script lang="ts">
import { onMount } from 'svelte'
import { Chart } from '$lib'
import type { ECMouseEvent } from '$lib/constants/events'
import { Chart } from 'svelte-echarts'
import { init } from 'echarts'
import type { EChartsOption } from 'echarts'
Expand Down Expand Up @@ -34,14 +33,8 @@
data = randomData(7, 100)
}
let interval: number
const handleClick = ({ detail }: CustomEvent<ECMouseEvent>) => {
alert(`${detail.name} ${detail.value}`)
}
onMount(() => {
interval = setInterval(updateData, 10000)
const interval = setInterval(updateData, 10000)
return () => clearInterval(interval)
})
</script>
Expand All @@ -50,4 +43,4 @@
<title>Classic Example - svelte-echarts</title>
</svelte:head>

<Chart {init} {options} on:click={handleClick} />
<Chart {init} {options} />
13 changes: 3 additions & 10 deletions src/routes/examples/tree-shaking/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script lang="ts">
import { onMount } from 'svelte'
import { Chart } from '$lib'
import type { ECMouseEvent } from '$lib/constants/events'
import { Chart } from 'svelte-echarts'
import { init, use } from 'echarts/core'
import type { EChartsOption } from 'echarts'
Expand Down Expand Up @@ -53,14 +52,8 @@
data = randomData(7, 100)
}
let interval: number
const handleClick = ({ detail }: CustomEvent<ECMouseEvent>) => {
alert(`${detail.name} ${detail.value}`)
}
onMount(() => {
interval = setInterval(updateData, 10000)
const interval = setInterval(updateData, 10000)
return () => clearInterval(interval)
})
</script>
Expand All @@ -69,4 +62,4 @@
<title>Tree-shaking | svelte-echarts</title>
</svelte:head>

<Chart {init} {options} on:click={handleClick} />
<Chart {init} {options} />
4 changes: 4 additions & 0 deletions svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const config = {
precompress: false,
strict: false,
}),
alias: {
'svelte-echarts': './src/lib/svelte-echarts',
'svelte-echarts/*': './src/lib/svelte-echarts/*',
},
},
}

Expand Down
2 changes: 1 addition & 1 deletion test/Chart.test.ts → tests/Chart.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, it, expect, vi, beforeAll } from 'vitest'
import { render, screen } from '@testing-library/svelte'
import { queryHelpers } from '@testing-library/dom'
import { Chart } from '../src/lib'
import { Chart } from '$lib/svelte-echarts'
import * as echarts from 'echarts/core'
import type { EChartsOption } from 'echarts'
import { BarChart } from 'echarts/charts'
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { defineConfig } from 'vitest/config'
export default defineConfig({
plugins: [sveltekit()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}'],
include: ['tests/**/*.{test,spec}.{js,ts,svelte}'],
},
})
1 change: 1 addition & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default defineConfig({
resolve: {
alias: {
$lib: '/src/lib',
'svelte-echarts': '/src/lib/svelte-echarts',
},
},
})

0 comments on commit 88f1bb9

Please sign in to comment.