From 8be79dbd2055d156ce8bdb078954b48cf1638348 Mon Sep 17 00:00:00 2001 From: David Worms Date: Sun, 29 Sep 2024 13:45:39 +0200 Subject: [PATCH] build: tsup bundler --- package.json | 15 ++++++++------- tsconfig.cjs.json | 11 ----------- tsconfig.esm.json | 10 ---------- tsup.config.ts | 13 +++++++++++++ 4 files changed, 21 insertions(+), 28 deletions(-) delete mode 100644 tsconfig.cjs.json delete mode 100644 tsconfig.esm.json create mode 100644 tsup.config.ts diff --git a/package.json b/package.json index d122a6c..2040370 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "should": "^13.2.3", "ssh2-connect": "^4.0.3", "standard-version": "^9.5.0", + "tsup": "^8.3.0", "tsx": "^4.19.1", "typedoc": "^0.26.7", "typedoc-plugin-markdown": "^4.2.8", @@ -44,14 +45,14 @@ }, "exports": { ".": { - "import": "./dist/esm/index.js", - "types": "./dist/types/index.d.ts", - "require": "./dist/cjs/index.cjs" + "import": "./dist/index.js", + "types": "./dist/index.d.ts", + "require": "./dist/index.cjs" }, "./promises": { - "import": "./dist/esm/promises.js", - "types": "./dist/types/promises.d.ts", - "require": "./dist/cjs/promises.cjs" + "import": "./dist/promises.js", + "types": "./dist/promises.d.ts", + "require": "./dist/promises.cjs" } }, "files": [ @@ -77,7 +78,7 @@ "url": "https://github.com/adaltas/node-ssh2-exec.git" }, "scripts": { - "build": "tsc --project tsconfig.esm.json && tsc --project tsconfig.cjs.json", + "build": "tsup-node", "lint:check": "eslint", "lint:fix": "eslint --fix", "lint:staged": "npx lint-staged", diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json deleted file mode 100644 index ed6743e..0000000 --- a/tsconfig.cjs.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": ["./src/**/*.ts"], - "compilerOptions": { - "module": "CommonJs", - "moduleResolution": "node", - "outDir": "./dist/cjs", - "rootDir": "./src", - "target": "esnext" - } -} diff --git a/tsconfig.esm.json b/tsconfig.esm.json deleted file mode 100644 index fcbc5af..0000000 --- a/tsconfig.esm.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": ["./src/**/*.ts"], - "compilerOptions": { - "declaration": true, - "declarationDir": "dist/types", - "outDir": "./dist/esm", - "rootDir": "./src" - } -} diff --git a/tsup.config.ts b/tsup.config.ts new file mode 100644 index 0000000..e1b1938 --- /dev/null +++ b/tsup.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from "tsup"; + +export default defineConfig({ + entry: ["src/index.ts", "src/promises.ts"], + outDir: "dist", + clean: true, + format: ["esm", "cjs"], + target: ["esnext", "esnext"], + dts: true, + minify: false, + sourcemap: false, + splitting: true, +});