From 2350aa140eb692610cc8ba1788ac0300188a5144 Mon Sep 17 00:00:00 2001 From: Pawel Zelawski Date: Wed, 9 Apr 2025 20:33:24 +0200 Subject: build: Configure Vite for library build and finalize package fields - Add `vite-plugin-dts` dev dependency. - Create `vite.config.ts` specifically for library build mode: - Configure ESM and UMD outputs (`dist/digiid-ts.es.js`, `dist/digiid-ts.umd.js`). - Set up `vite-plugin-dts` for generating `dist/index.d.ts`. - Externalize Node.js built-ins and 'digibyte-message' dependency. - Update `package.json`: - Change `scripts.build` to `vite build`. - Point `main`, `module`, and `types` fields to the correct files in `dist/`. - Run and verify the build process successfully generates the expected distribution files. --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'package.json') diff --git a/package.json b/package.json index 895c8b2..990ea54 100644 --- a/package.json +++ b/package.json @@ -2,15 +2,15 @@ "name": "digiid-ts", "version": "0.1.0", "description": "A modern TypeScript implementation of the DigiID authentication protocol.", - "main": "dist/index.js", - "module": "dist/index.mjs", + "main": "dist/digiid-ts.umd.js", + "module": "dist/digiid-ts.es.js", "types": "dist/index.d.ts", "type": "module", "files": [ "dist" ], "scripts": { - "build": "tsc && vite build", + "build": "vite build", "dev": "vite", "test": "vitest run", "test:watch": "vitest", @@ -55,6 +55,7 @@ "ts-node": "^10.9.2", "typescript": "^5.8.3", "vite": "^6.2.5", + "vite-plugin-dts": "^4.5.3", "vitest": "^3.1.1" }, "dependencies": { -- cgit v1.2.3