Skip to content

Commit 0ea20c5

Browse files
LoTwTwebfansplz
andauthored
refactor(applet): use vite-plugin-dts to generate dts (#323)
Co-authored-by: arlo <[email protected]>
1 parent 4372aaa commit 0ea20c5

File tree

6 files changed

+12
-26
lines changed

6 files changed

+12
-26
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"build": "turbo build",
4949
"lint": "eslint .",
5050
"lint:fix": "eslint . --fix",
51-
"lint:packages": "pnpm -r --filter='./packages/{core,devtools,devtools-api,devtools-kit,electron,shared}' exec publint && pnpm -r --filter='./packages/{core,devtools,devtools-api,devtools-kit,electron,shared}' exec attw --pack",
51+
"lint:packages": "pnpm -r --filter='./packages/{core,devtools,devtools-api,devtools-kit,electron,shared,applet}' exec publint && pnpm -r --filter='./packages/{core,devtools,devtools-api,devtools-kit,electron,shared,applet}' exec attw --pack",
5252
"prepublishOnly": "npm run build",
5353
"release": "bumpp -r && nr build && pnpm -r publish --access public",
5454
"release:beta": "bumpp -r && nr build && pnpm -r publish --access public --tag beta",

packages/applet/index.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/applet/package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@
1414
"main": "./dist/index.cjs",
1515
"module": "./dist/index.js",
1616
"files": [
17-
"**.d.ts",
1817
"dist"
1918
],
2019
"scripts": {
21-
"build": "vite build && pnpm types",
22-
"prepare:type": "pnpm types",
23-
"stub": "vite build --watch",
24-
"types": "vue-tsc --declaration --emitDeclarationOnly -p ./tsconfig.json"
20+
"build": "vite build",
21+
"stub": "vite build --watch"
2522
},
2623
"peerDependencies": {
2724
"vue": "^3.0.0"
@@ -37,8 +34,8 @@
3734
},
3835
"devDependencies": {
3936
"unplugin-vue": "^5.0.5",
37+
"vite-plugin-dts": "^3.8.1",
4038
"vue": "^3.4.21",
41-
"vue-router": "^4.3.0",
42-
"vue-tsc": "^1.8.27"
39+
"vue-router": "^4.3.0"
4340
}
4441
}

packages/applet/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"outDir": "./dist",
1414
"skipLibCheck": true
1515
},
16-
"include": ["**/*.vue", "**/*.d.ts", "**/*.ts"]
16+
"include": ["src/**/*.vue", "src/**/*.d.ts", "src/**/*.ts"]
1717
}

packages/applet/vite.config.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { join, resolve } from 'node:path'
1+
import { resolve } from 'node:path'
22
import Vue from '@vitejs/plugin-vue'
33
import Unocss from 'unocss/vite'
4-
import fse from 'fs-extra'
4+
import Dts from 'vite-plugin-dts'
55

66
const argv = process.argv.slice(2)
77
const enableWatch = argv.includes('--watch')
@@ -15,17 +15,7 @@ export default {
1515
plugins: [
1616
Unocss(),
1717
Vue(),
18-
{
19-
name: 'move-dts',
20-
apply: 'build',
21-
enforce: 'post',
22-
closeBundle() {
23-
// copy
24-
const targetDir = resolve(__dirname, './dist')
25-
26-
fse.copySync('./index.d.ts', join(targetDir, './index.d.ts'))
27-
},
28-
},
18+
Dts(),
2919
],
3020
build: {
3121
emptyOutDir: !enableWatch,

pnpm-lock.yaml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)