From 9d74dfdb7ab3f4ce06bab00ce685541293bd37a6 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Thu, 23 Dec 2021 16:04:18 +0100 Subject: build: Enable typescript composite mode and clean Moves all typings to the dist-types directories from the dist directories so that we can let vite clean the dist directories on build without clobbering the typings generated by tsc. --- packages/shared/package.json | 4 +++- packages/shared/tsconfig.json | 3 +-- packages/shared/vite.config.js | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'packages/shared') diff --git a/packages/shared/package.json b/packages/shared/package.json index f49be47..83aec54 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -4,12 +4,14 @@ "private": true, "main": "dist/index.cjs", "module": "dist/index.es.js", - "types": "dist/index.d.ts", + "types": "dist-types/index.d.ts", "scripts": { + "clean": "rimraf dist dist-types tsconfig.tsbuildinfo", "build": "vite build", "typecheck": "tsc" }, "devDependencies": { + "rimraf": "^3.0.2", "typescript": "^4.5.4", "vite": "^2.7.6" }, diff --git a/packages/shared/tsconfig.json b/packages/shared/tsconfig.json index d441cc8..de75833 100644 --- a/packages/shared/tsconfig.json +++ b/packages/shared/tsconfig.json @@ -2,8 +2,7 @@ "extends": "../../tsconfig.json", "compilerOptions": { "composite": true, - "declaration": true, - "declarationDir": "dist", + "declarationDir": "dist-types", "emitDeclarationOnly": true, "rootDir": "src" }, diff --git a/packages/shared/vite.config.js b/packages/shared/vite.config.js index 05ec118..a3efc87 100644 --- a/packages/shared/vite.config.js +++ b/packages/shared/vite.config.js @@ -36,7 +36,7 @@ const config = { ...builtinModules, ], }, - emptyOutDir: false, // Do not remove `.d.ts` files. + emptyOutDir: true, brotliSize: false, }, }; -- cgit v1.2.3-70-g09d2