From 6a4d40e7beedd683d04cf8f9a73cf7ab45d132cd Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Sun, 6 Sep 2026 22:28:58 +0200 Subject: [PATCH] refactor(cli): build with vite-plus instead of tsup --- packages/cli/build.js | 16 ---------------- packages/cli/package.json | 15 ++++++++------- packages/cli/vite.config.ts | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 23 deletions(-) delete mode 100644 packages/cli/build.js create mode 100644 packages/cli/vite.config.ts diff --git a/packages/cli/build.js b/packages/cli/build.js deleted file mode 100644 index 14f66c0..0000000 --- a/packages/cli/build.js +++ /dev/null @@ -1,16 +0,0 @@ -import { build } from 'tsup' -import pkg from './package.json' with { type: 'json' } - -const watch = process.argv.slice(2)[0] === '--watch' - -await build({ - entry: ['src/index.ts', 'src/cli.ts'], - dts: true, - minify: true, - format: ['esm'], - target: 'es2022', - clean: true, - noExternal: ['@cryptgeon/shared'], - define: { VERSION: `"${pkg.version}"` }, - watch, -}) \ No newline at end of file diff --git a/packages/cli/package.json b/packages/cli/package.json index f07a3bd..b6d377d 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -9,18 +9,18 @@ }, "type": "module", "exports": { - ".": "./dist/index.js" + ".": "./dist/index.mjs" }, - "types": "./dist/index.d.ts", + "types": "./dist/index.d.mts", "bin": { - "cryptgeon": "./dist/cli.js" + "cryptgeon": "./dist/cli.mjs" }, "files": [ "dist" ], "scripts": { - "build": "node build.js", - "dev": "node build.js --watch", + "build": "vp pack", + "dev": "vp pack --watch", "prepublishOnly": "run-s build" }, "dependencies": { @@ -32,11 +32,12 @@ "pretty-bytes": "^6.1.1" }, "devDependencies": { + "@tsconfig/strictest": "catalog:", "@types/inquirer": "^9.0.9", "@types/node": "^22.15.3", "commander": "^12.1.0", - "tsup": "^8.5.1", - "typescript": "^5.9.3" + "typescript": "catalog:", + "vite-plus": "catalog:" }, "engines": { "node": ">=22" diff --git a/packages/cli/vite.config.ts b/packages/cli/vite.config.ts new file mode 100644 index 0000000..64bff3c --- /dev/null +++ b/packages/cli/vite.config.ts @@ -0,0 +1,14 @@ +import { defineConfig } from "vite-plus"; +import pkg from "./package.json" with { type: "json" }; + +export default defineConfig({ + pack: { + entry: ["src/index.ts", "src/cli.ts"], + dts: true, + minify: true, + format: ["esm"], + target: "es2023", + deps: { alwaysBundle: ["**"] }, + define: { VERSION: JSON.stringify(pkg.version) }, + }, +});