Skip to content

Commit d631c3d

Browse files
authored
refactor: use tsup and tsx instead of esbuild and ts-node (#1)
1 parent 26b5bfd commit d631c3d

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

package.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"main": "dist/index.js",
1313
"module": "dist/index.mjs",
1414
"exports": {
15+
"types": "./dist/index.d.ts",
1516
"require": "./dist/index.js",
1617
"import": "./dist/index.js"
1718
},
@@ -22,10 +23,10 @@
2223
"README.md"
2324
],
2425
"scripts": {
25-
"build": "yarn build:esbuild",
26-
"dev": "cross-env NODE_ENV=development yarn build:esbuild",
27-
"build:esbuild": "node -r esbuild-register ./scripts/build.ts",
28-
"fetch-data": "ts-node scripts/fetch-data.ts && prettier --write src/data.ts",
26+
"build": "yarn tsup --minify",
27+
"dev": "yarn tsup --sourcemap",
28+
"tsup": "tsup src/index.ts --dts --format cjs,esm --clean",
29+
"fetch-data": "tsx scripts/fetch-data.ts && prettier --write src/data.ts",
2930
"test": "yarn test:text",
3031
"test:text": "nyc --reporter=text mocha ./__tests__",
3132
"test:html": "nyc --reporter=html mocha ./__tests__",
@@ -63,19 +64,16 @@
6364
"chai": "^4.3.6",
6465
"chai-each": "^0.0.1",
6566
"cross-env": "^7.0.3",
66-
"esbuild": "^0.15.5",
67-
"esbuild-plugin-yaml": "^0.0.1",
68-
"esbuild-register": "^3.3.3",
6967
"eslint": "^8.22.0",
7068
"eslint-import-resolver-typescript": "^3.5.0",
7169
"fast-glob": "^3.2.11",
72-
"js-yaml": "^4.1.0",
7370
"mocha": "^10.0.0",
7471
"nyc": "^15.1.0",
7572
"prettier": "^2.7.1",
7673
"source-map-support": "^0.5.21",
77-
"ts-node": "^10.9.1",
78-
"typescript": "^4.7.4"
74+
"tsup": "^8.0.2",
75+
"tsx": "^4.7.1",
76+
"typescript": "^5.2.2"
7977
},
8078
"packageManager": "yarn@3.2.1",
8179
"dependencies": {

scripts/build.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ const options: BuildOptions = {
1818
format: 'cjs',
1919
outdir: 'dist',
2020
})
21-
21+
2222
console.log('Building d.ts files...')
2323
await transpile('src/index.ts', {
2424
declaration: true,
2525
emitDeclarationOnly: true,
2626
outDir: 'dist',
2727
})
28-
28+
2929
console.log('Adding ESM entry...')
3030
await writeFile('dist/index.mjs', `export * from './index.js'`)
3131
})()

0 commit comments

Comments
 (0)