Skip to content

Commit bdb38c8

Browse files
committed
Migrate to tsdown for bundling
1 parent e96008b commit bdb38c8

File tree

4 files changed

+31
-26
lines changed

4 files changed

+31
-26
lines changed

package.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,20 @@
1616
"url": "git+https://github.com/neaps/tide-database.git"
1717
},
1818
"license": "MIT",
19-
"author": "",
19+
"author": "Brandon Keepers <brandon@openwaters.io>",
2020
"type": "module",
21-
"main": "dist/index.js",
21+
"main": "dist/index.cjs",
22+
"exports": {
23+
".": {
24+
"types": "./dist/index.d.ts",
25+
"import": "./dist/index.js"
26+
}
27+
},
2228
"directories": {
2329
"doc": "docs"
2430
},
2531
"scripts": {
26-
"build": "tsc -b && tsc -p tsconfig.node.json && vite build",
32+
"build": "tsc -b && tsc -p tsconfig.node.json && tsdown",
2733
"prepare": "npm run build",
2834
"test": "vitest"
2935
},
@@ -38,8 +44,8 @@
3844
"make-fetch-happen": "^15.0.3",
3945
"moment": "^2.30.1",
4046
"sort-object-keys": "^2.0.1",
41-
"vite": "^7.2.6",
42-
"vite-plugin-dts": "^4.5.4",
47+
"tsdown": "^0.19.0-beta.3",
48+
"typescript": "^5.9.3",
4349
"vitest": "^4.0.15"
4450
},
4551
"files": [

src/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import _constituents from './constituents.json' with { type: 'json' }
2+
13
export interface HarmonicConstituent {
24
name: string
35
description?: string
@@ -7,6 +9,12 @@ export interface HarmonicConstituent {
79
speed?: number
810
}
911

12+
export interface Constituent {
13+
name: string
14+
description: string | null
15+
speed: number
16+
}
17+
1018
export interface Station {
1119
// Basic station information
1220
id: string
@@ -49,7 +57,7 @@ export interface Station {
4957
datums: Record<string, number>
5058
}
5159

52-
export { default as constituents } from './constituents.json' with { type: 'json' }
60+
export const constituents: Constituent[] = _constituents
5361

5462
export const stations: Station[] = Object.values(
5563
import.meta.glob('../data/**/*.json', { eager: true, import: 'default' })

tsdown.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { defineConfig } from 'tsdown'
2+
3+
export default defineConfig({
4+
entry: ['./src/index.ts'],
5+
dts: true,
6+
format: ['cjs', 'esm'],
7+
sourcemap: true,
8+
declarationMap: true,
9+
target: 'es2020',
10+
platform: 'neutral'
11+
})

vite.config.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)