Skip to content

Commit 89b1587

Browse files
liweijie0812RSS1102
authored andcommitted
chore: migrate to tsdown
1 parent 656568a commit 89b1587

5 files changed

Lines changed: 53 additions & 97 deletions

File tree

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry=https://registry.npmmirror.com/

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@
33
"version": "0.5.3",
44
"description": "CLI tool for TDesign Starter project",
55
"type": "module",
6-
"main": "./src/main.ts",
6+
"main": "./bin/index.js",
77
"lib": "./bin/index.js",
88
"bin": {
99
"td-starter": "./bin/index.js"
1010
},
1111
"typings": "./src/types/index.d.ts",
1212
"scripts": {
13-
"watch": "rollup -w -c",
13+
"watch": "tsdown -w",
1414
"test": "npm run dev",
1515
"dev": "node ./bin/index.js",
16-
"prebuild": "rimraf bin/",
17-
"build": "rollup -c ",
16+
"build": "tsdown",
1817
"lint": "eslint 'src/**/*.{js,ts}'",
1918
"site": "echo 'no need to build site'",
2019
"site:preview": "echo 'no need to run site preview'"
@@ -32,11 +31,6 @@
3231
"@babel/plugin-transform-runtime": "7.24.3",
3332
"@babel/preset-env": "7.24.4",
3433
"@babel/preset-typescript": "^7.24.1",
35-
"@rollup/plugin-babel": "^6.0.4",
36-
"@rollup/plugin-json": "6.1.0",
37-
"@rollup/plugin-node-resolve": "15.2.3",
38-
"@rollup/plugin-terser": "^0.4.4",
39-
"@rollup/plugin-typescript": "^11.1.6",
4034
"@types/babel__core": "^7.20.5",
4135
"@types/node": "^22.1.0",
4236
"@types/shelljs": "^0.8.15",
@@ -45,8 +39,8 @@
4539
"babel-loader": "9.1.3",
4640
"eslint": "^8.56.0",
4741
"prettier": "^3.2.5",
48-
"rollup": "^4.29.1",
49-
"rollup-plugin-copy": "3.5.0"
42+
"rollup-plugin-copy": "3.5.0",
43+
"tsdown": "^0.15.9"
5044
},
5145
"dependencies": {
5246
"@babel/plugin-transform-typescript": "^7.24.4",
@@ -99,5 +93,11 @@
9993
],
10094
"engines": {
10195
"node": ">=16.0.0"
96+
},
97+
"module": "./bin/index.js",
98+
"types": "./bin/index.d.ts",
99+
"exports": {
100+
".": "./bin/index.js",
101+
"./package.json": "./package.json"
102102
}
103103
}

rollup.config.js

Lines changed: 0 additions & 86 deletions
This file was deleted.
File renamed without changes.

tsdown.config.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { defineConfig } from 'tsdown'
2+
import copy from 'rollup-plugin-copy';
3+
4+
export default defineConfig({
5+
entry: 'src/index.ts',
6+
platform: 'node',
7+
outDir: 'bin',
8+
exports: true,
9+
shims: true,
10+
dts: false,
11+
plugins: [
12+
// 复制templates文件; 复制 .gitignore 文件;添加.npmignore文件:"!.gitignore\n.npmignore"
13+
copy({
14+
targets: [
15+
'templates/farm/vue-lite',
16+
'templates/farm/vue-next-lite',
17+
'templates/farm/react-lite',
18+
'templates/vite/vue-lite',
19+
'templates/vite/vue-next-lite',
20+
'templates/vite/react-lite',
21+
'templates/webpack/vue-lite',
22+
'templates/webpack/vue-next-lite',
23+
'templates/webpack/react-lite',
24+
]
25+
.map((filePath) => [
26+
{
27+
src: [`${filePath}/*`, `${filePath}/.gitignore`, `!${filePath}/node_modules`],
28+
dest: `bin/${filePath}`
29+
},
30+
{
31+
src: `${filePath}/.gitignore`,
32+
dest: `bin/${filePath}`,
33+
rename: '.npmignore',
34+
transform: () => Buffer.from('!.gitignore\n.npmignore', 'utf-8')
35+
}
36+
])
37+
.flat(),
38+
verbose: true
39+
})
40+
],
41+
})

0 commit comments

Comments
 (0)