Skip to content

Commit 518677d

Browse files
NiloCKclaude
authored andcommitted
improve types generation from common-ui...
using DTS plugin as used in `courseware` pkg
1 parent 0b0638a commit 518677d

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

packages/common-ui/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
],
2323
"scripts": {
2424
"dev": "vite build --watch",
25-
"build": "vite build && yarn build-types",
26-
"build-types": "tsc --project tsconfig.types.json",
25+
"build": "vite build",
2726
"lint": "eslint . --fix",
2827
"lint:check": "eslint .",
2928
"test:unit": "vitest run",
@@ -68,6 +67,7 @@
6867
"sass": "^1.83.0",
6968
"typescript": "~5.7.2",
7069
"vite": "^6.0.9",
70+
"vite-plugin-dts": "^4.5.3",
7171
"vitest": "^3.0.5"
7272
},
7373
"stableVersion": "0.1.14"

packages/common-ui/tsconfig.types.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/common-ui/vite.config.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// packages/common-ui/vite.config.js
22
import { defineConfig } from 'vite';
33
import vue from '@vitejs/plugin-vue';
4+
import dts from 'vite-plugin-dts';
45
import { resolve } from 'path';
56
import { createBaseResolve } from '../../vite.config.base.js';
67

@@ -53,7 +54,16 @@ export default defineConfig({
5354
// This is crucial for component libraries - allow CSS to be in chunks
5455
cssCodeSplit: true,
5556
},
56-
plugins: [vue()],
57+
plugins: [
58+
vue(),
59+
dts({
60+
insertTypesEntry: true,
61+
// Exclude test files from type generation
62+
exclude: ['**/*.spec.ts', '**/*.test.ts'],
63+
// Include only necessary files
64+
include: ['src/**/*.ts', 'src/**/*.d.ts', 'src/**/*.vue'],
65+
}),
66+
],
5767
resolve: createBaseResolve(resolve(__dirname, '../..'), {
5868
'@cui': resolve(__dirname, 'src'), // Override for self-imports during build
5969
}),

yarn.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6547,6 +6547,7 @@ __metadata:
65476547
sass: "npm:^1.83.0"
65486548
typescript: "npm:~5.7.2"
65496549
vite: "npm:^6.0.9"
6550+
vite-plugin-dts: "npm:^4.5.3"
65506551
vitest: "npm:^3.0.5"
65516552
vue: "npm:^3.5.13"
65526553
vuetify: "npm:^3.7.0"

0 commit comments

Comments
 (0)