tmui-cli 1.3.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -82
- package/data/components.json +637 -0
- package/data/config.json +169 -0
- package/data/doc-index.json +61 -0
- package/data/docs/alert.md +79 -0
- package/data/docs/avatar-group.md +73 -0
- package/data/docs/badge.md +62 -0
- package/data/docs/between-time.md +76 -0
- package/data/docs/button.md +114 -0
- package/data/docs/calendar-multiple.md +90 -0
- package/data/docs/cell.md +91 -0
- package/data/docs/checkbox-group.md +62 -0
- package/data/docs/checkbox.md +74 -0
- package/data/docs/circle-progress.md +74 -0
- package/data/docs/code-input.md +77 -0
- package/data/docs/col.md +57 -0
- package/data/docs/collapse-item.md +76 -0
- package/data/docs/collapse.md +59 -0
- package/data/docs/countdown.md +79 -0
- package/data/docs/date-view.md +65 -0
- package/data/docs/drawer.md +94 -0
- package/data/docs/dropdown-item.md +68 -0
- package/data/docs/dropdown-menu.md +70 -0
- package/data/docs/echart.md +69 -0
- package/data/docs/float-drawer.md +79 -0
- package/data/docs/form-item.md +67 -0
- package/data/docs/form.md +68 -0
- package/data/docs/html.md +70 -0
- package/data/docs/icon.md +67 -0
- package/data/docs/image.md +73 -0
- package/data/docs/input.md +126 -0
- package/data/docs/modal.md +92 -0
- package/data/docs/money.md +70 -0
- package/data/docs/more.md +69 -0
- package/data/docs/navbar.md +82 -0
- package/data/docs/picker-date.md +75 -0
- package/data/docs/picker-selected.md +75 -0
- package/data/docs/picker-time.md +77 -0
- package/data/docs/picker-view.md +70 -0
- package/data/docs/picker.md +76 -0
- package/data/docs/popover.md +68 -0
- package/data/docs/progress.md +72 -0
- package/data/docs/pull-refresh.md +73 -0
- package/data/docs/radio-group.md +61 -0
- package/data/docs/radio.md +74 -0
- package/data/docs/rate.md +72 -0
- package/data/docs/row.md +61 -0
- package/data/docs/sheet.md +72 -0
- package/data/docs/sign-board.md +61 -0
- package/data/docs/skeleton.md +60 -0
- package/data/docs/sku.md +69 -0
- package/data/docs/slider-double.md +71 -0
- package/data/docs/slider-menu.md +78 -0
- package/data/docs/slider.md +71 -0
- package/data/docs/stepper.md +76 -0
- package/data/docs/steps-item.md +71 -0
- package/data/docs/steps.md +73 -0
- package/data/docs/sticky-header.md +57 -0
- package/data/docs/sticky.md +55 -0
- package/data/docs/switch-slider.md +82 -0
- package/data/docs/switch.md +68 -0
- package/data/docs/tabbar.md +83 -0
- package/data/docs/tabs.md +84 -0
- package/data/docs/tag.md +78 -0
- package/data/docs/text.md +69 -0
- package/data/docs/upload-photo.md +86 -0
- package/data/docs/upload-video.md +86 -0
- package/data/docs//346/250/241/346/235/277.md +47 -0
- package/data/examples/alert.vue +39 -0
- package/data/examples/avatar-group.vue +97 -0
- package/data/examples/badge.vue +87 -0
- package/data/examples/between-time.vue +39 -0
- package/data/examples/button.vue +70 -0
- package/data/examples/calendar-multiple.vue +57 -0
- package/data/examples/cell.vue +39 -0
- package/data/examples/checkbox.vue +71 -0
- package/data/examples/circle-progress.vue +69 -0
- package/data/examples/code-input.vue +36 -0
- package/data/examples/collapse.vue +76 -0
- package/data/examples/countdown.vue +39 -0
- package/data/examples/drawer.vue +138 -0
- package/data/examples/dropdown-menu.vue +59 -0
- package/data/examples/echart.vue +91 -0
- package/data/examples/float-drawer.vue +45 -0
- package/data/examples/form.vue +147 -0
- package/data/examples/html.vue +53 -0
- package/data/examples/icon.vue +65 -0
- package/data/examples/image.vue +38 -0
- package/data/examples/input.vue +66 -0
- package/data/examples/modal.vue +122 -0
- package/data/examples/money.vue +60 -0
- package/data/examples/more.vue +47 -0
- package/data/examples/navbar.vue +68 -0
- package/data/examples/picker-date.vue +53 -0
- package/data/examples/picker-selected.vue +35 -0
- package/data/examples/picker-time.vue +46 -0
- package/data/examples/picker-view.vue +35 -0
- package/data/examples/picker.vue +101 -0
- package/data/examples/popover.vue +130 -0
- package/data/examples/progress.vue +57 -0
- package/data/examples/pull-refresh.vue +41 -0
- package/data/examples/radio.vue +61 -0
- package/data/examples/rate.vue +35 -0
- package/data/examples/row.vue +52 -0
- package/data/examples/sheet.vue +36 -0
- package/data/examples/sign-board.vue +43 -0
- package/data/examples/skeleton.vue +45 -0
- package/data/examples/sku.vue +106 -0
- package/data/examples/slider-menu.vue +65 -0
- package/data/examples/slider.vue +51 -0
- package/data/examples/stepper.vue +44 -0
- package/data/examples/steps.vue +77 -0
- package/data/examples/sticky.vue +46 -0
- package/data/examples/switch-slider.vue +113 -0
- package/data/examples/switch.vue +62 -0
- package/data/examples/tabbar.vue +41 -0
- package/data/examples/tabs.vue +46 -0
- package/data/examples/tag.vue +69 -0
- package/data/examples/text.vue +38 -0
- package/data/examples/upload-photo.vue +39 -0
- package/data/examples/upload-video.vue +29 -0
- package/data/guides/cli.md +110 -0
- package/data/guides//344/273/213/347/273/215.md +34 -0
- package/data/guides//345/205/274/345/256/271/346/200/247.md +41 -0
- package/data/guides//345/215/225/344/275/215/346/240/207/347/255/276/350/257/264/346/230/216.md +22 -0
- package/data/guides//345/233/275/351/231/205/345/214/226.md +454 -0
- package/data/guides//345/256/211/350/243/205.md +103 -0
- package/data/guides//345/260/217/347/250/213/345/272/217/345/210/206/344/272/253.md +34 -0
- package/data/guides//345/270/270/350/247/201/351/227/256/351/242/230.md +102 -0
- package/data/guides//345/277/253/351/200/237/344/270/212/346/211/213.md +191 -0
- package/data/guides//346/233/264/346/226/260/346/227/245/345/277/227.md +155 -0
- package/data/guides//350/264/241/347/214/256/350/200/205.md +97 -0
- package/dist/main.mjs +93 -0
- package/package.json +54 -50
- package/bin/cmdTool.js +0 -229
- package/bin/createTmui.js +0 -383
- package/bin/dirTool.js +0 -152
- package/bin/hooks.js +0 -233
- package/bin/net.js +0 -139
- package/bin/selectedDir.js +0 -28
- package/bin/tmui.js +0 -28
- package/dist/tmui.js +0 -1
- package/webpack.config.js +0 -17
- package/website/css/app.fa961c8f.css +0 -1
- package/website/css/chunk-vendors.4ad1cdb5.css +0 -2
- package/website/favicon.ico +0 -0
- package/website/index.html +0 -1
- package/website/js/app.b68ad484.js +0 -2
- package/website/js/app.b68ad484.js.map +0 -1
- package/website/js/chunk-vendors.d9ea5cfa.js +0 -15
- package/website/js/chunk-vendors.d9ea5cfa.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,50 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "tmui-cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
],
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"node
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "tmui-cli",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "TMUI DESIGN 终端 CLI:创建与升级 uniapp CLI / HBX 项目,并提供 IDE MCP 服务",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/main.mjs",
|
|
7
|
+
"bin": {
|
|
8
|
+
"tmui": "dist/main.mjs"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"data"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"dev": "vite",
|
|
16
|
+
"check:type": "vue-tsc --build",
|
|
17
|
+
"build": "vite build && node ./scripts/add-shebang.mjs",
|
|
18
|
+
"build:data": "node ./scripts/build-data.mjs",
|
|
19
|
+
"smoke": "node ./scripts/smoke.mjs",
|
|
20
|
+
"preview": "npm run build && node dist/main.mjs",
|
|
21
|
+
"prepublishOnly": "npm run build:data && npm run build && npm run smoke"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"tmui",
|
|
25
|
+
"uniapp",
|
|
26
|
+
"cli",
|
|
27
|
+
"mcp"
|
|
28
|
+
],
|
|
29
|
+
"author": {
|
|
30
|
+
"name": "tmzdy"
|
|
31
|
+
},
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=22.18.0"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
38
|
+
"@vue-tui/components": "^0.3.0",
|
|
39
|
+
"@vue-tui/runtime": "0.3.0",
|
|
40
|
+
"compressing": "^1.10.1",
|
|
41
|
+
"vue": "^3.5.0",
|
|
42
|
+
"zod": "^3.25.76"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@tsconfig/node22": "^22.0.5",
|
|
46
|
+
"@types/node": "^22.18.0",
|
|
47
|
+
"@vue-tui/vite": "0.3.1",
|
|
48
|
+
"@vue/tsconfig": "^0.9.1",
|
|
49
|
+
"typescript": "~5.9.0",
|
|
50
|
+
"unplugin-vue": "7.2.0",
|
|
51
|
+
"vite": "8.2.1",
|
|
52
|
+
"vue-tsc": "3.3.4"
|
|
53
|
+
}
|
|
54
|
+
}
|
package/bin/cmdTool.js
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const path = require("path")
|
|
3
|
-
const fs = require("fs")
|
|
4
|
-
const {spawn,exec} = require("child_process")
|
|
5
|
-
const process = require("process")
|
|
6
|
-
const codecs = require("codecs")
|
|
7
|
-
const psTree = require("ps-tree")
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function detectEncoding(str) {
|
|
13
|
-
const buffer = Buffer.from(str);
|
|
14
|
-
if (buffer[0] < 128) {
|
|
15
|
-
return 'ascii';
|
|
16
|
-
} else if (buffer[0] < 224) {
|
|
17
|
-
return 'utf8';
|
|
18
|
-
} else if (buffer[0] < 240) {
|
|
19
|
-
return 'utf16le';
|
|
20
|
-
} else {
|
|
21
|
-
return 'utf32le';
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function send(ws, arg) {
|
|
27
|
-
ws.forEach(function(el){
|
|
28
|
-
el.send(arg)
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function execCmd(cb, end, command) {
|
|
33
|
-
try {
|
|
34
|
-
// const npmPath = path.join(process.env.APPDATA, 'npm', 'npm.cmd');
|
|
35
|
-
const spawnObj = exec(command, {
|
|
36
|
-
encoding: 'binary'
|
|
37
|
-
})
|
|
38
|
-
// const spawnObj = spawn("npm.cmd",["run","dev:h5"],{detached:true})
|
|
39
|
-
|
|
40
|
-
spawnObj.stdout?.on('data', function(chunk) {
|
|
41
|
-
// Buffer.from(chunk,'binary').toString('utf-8')
|
|
42
|
-
// var str = iconv.decode(, 'cp936');
|
|
43
|
-
if (cb) {
|
|
44
|
-
let str = Buffer.from(chunk, 'binary').toString("utf8")
|
|
45
|
-
|
|
46
|
-
var codecsDecode = codecs(detectEncoding(chunk))
|
|
47
|
-
let strii = codecsDecode.decode(Buffer.from(chunk, 'binary')).toString('utf-8');
|
|
48
|
-
// 去除控制符
|
|
49
|
-
const cleanStr = strii.replace(
|
|
50
|
-
/[\u001B\u009B][[\]()#;?]*(?:(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[A-PR-Za-z~])/g, '');
|
|
51
|
-
cb(cleanStr, spawnObj.pid || 0)
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
spawnObj.addListener('error', function(err) {
|
|
55
|
-
if (end) {
|
|
56
|
-
cb(err)
|
|
57
|
-
end('error')
|
|
58
|
-
}
|
|
59
|
-
})
|
|
60
|
-
spawnObj.on('close', function(code) {
|
|
61
|
-
// console.log('close code : ' + code);
|
|
62
|
-
if (end) {
|
|
63
|
-
end('end')
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
spawnObj.on('exit', function(code){
|
|
67
|
-
// console.log('exit code : ' + code);
|
|
68
|
-
if (end) {
|
|
69
|
-
end('end')
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
return spawnObj;
|
|
74
|
-
} catch (error) {
|
|
75
|
-
if (end) {
|
|
76
|
-
cb(error)
|
|
77
|
-
end('end')
|
|
78
|
-
}
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// 杀死子进程及其所有子孙进程
|
|
83
|
-
function killChildAndGrandChildren(pid) {
|
|
84
|
-
|
|
85
|
-
if (process.platform === 'win32') {
|
|
86
|
-
// 在 Windows 系统上执行的代码
|
|
87
|
-
const command = `taskkill /T /F /PID ${pid}`;
|
|
88
|
-
exec(command, function(err, stdout, stderr){
|
|
89
|
-
if (err) {
|
|
90
|
-
console.error(`服务进程退出失败!不要担心,当你关闭主进程时,未退出的子进程会一并关闭哦`);
|
|
91
|
-
}
|
|
92
|
-
// console.log(`stdout: ${stdout}`);
|
|
93
|
-
// console.error(`stderr: ${stderr}`);
|
|
94
|
-
});
|
|
95
|
-
} else {
|
|
96
|
-
// 在 Linux/Unix/Mac 系统上执行的代码
|
|
97
|
-
psTree(pid, function(err, children){
|
|
98
|
-
// 使用 kill 命令杀死所有子孙进程
|
|
99
|
-
console.log(5555)
|
|
100
|
-
exec(`kill -TERM ${pid} ${children.map(function(c) {return c.PID}).join(' ')}`);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function devRunApp(ws, obj) {
|
|
107
|
-
|
|
108
|
-
const nowcd = process.cwd();
|
|
109
|
-
process.chdir(path.normalize(obj.data.path));
|
|
110
|
-
|
|
111
|
-
const childreProcess = execCmd(function(msg, pid) {
|
|
112
|
-
send(ws, JSON.stringify({
|
|
113
|
-
event: 'info',
|
|
114
|
-
data: msg
|
|
115
|
-
}))
|
|
116
|
-
const reg_1 = /http:\/\/localhost(:\d+)?(\/[^\s]*)?/g;
|
|
117
|
-
const reg_2 = /http:\/\/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(:\d+)?(\/[^\s]*)?/g;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (reg_1.test(msg)) {
|
|
121
|
-
send(ws, JSON.stringify({
|
|
122
|
-
event: '1',
|
|
123
|
-
data: {
|
|
124
|
-
id: obj.data.id,
|
|
125
|
-
msg: msg.match(reg_1)[0],
|
|
126
|
-
pid: pid
|
|
127
|
-
}
|
|
128
|
-
}))
|
|
129
|
-
}
|
|
130
|
-
if (reg_2.test(msg)) {
|
|
131
|
-
send(ws, JSON.stringify({
|
|
132
|
-
event: '1',
|
|
133
|
-
data: {
|
|
134
|
-
id: obj.data.id,
|
|
135
|
-
msg: msg.match(reg_2)[0],
|
|
136
|
-
pid: pid
|
|
137
|
-
}
|
|
138
|
-
}))
|
|
139
|
-
}
|
|
140
|
-
if (msg.indexOf('ready') > -1) {
|
|
141
|
-
send(ws, JSON.stringify({
|
|
142
|
-
event: 'ready',
|
|
143
|
-
data: {
|
|
144
|
-
id: obj.data.id,
|
|
145
|
-
pid: pid
|
|
146
|
-
},
|
|
147
|
-
}))
|
|
148
|
-
}
|
|
149
|
-
}, function(type) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (type == 'end') {
|
|
153
|
-
send(ws, JSON.stringify({
|
|
154
|
-
event: 'end',
|
|
155
|
-
data: {
|
|
156
|
-
id: obj.data.id
|
|
157
|
-
},
|
|
158
|
-
}))
|
|
159
|
-
} else {
|
|
160
|
-
send(ws, JSON.stringify({
|
|
161
|
-
event: 'error',
|
|
162
|
-
data: {
|
|
163
|
-
id: obj.data.id
|
|
164
|
-
},
|
|
165
|
-
}))
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
}, obj.command)
|
|
170
|
-
|
|
171
|
-
return childreProcess;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
function buildApp(ws, obj, end) {
|
|
175
|
-
|
|
176
|
-
const nowcd = process.cwd();
|
|
177
|
-
process.chdir(path.normalize(obj.data.path));
|
|
178
|
-
|
|
179
|
-
const childreProcess = execCmd(function(msg, pid) {
|
|
180
|
-
send(ws, JSON.stringify({
|
|
181
|
-
event: 'info',
|
|
182
|
-
data: msg
|
|
183
|
-
}))
|
|
184
|
-
if (msg.indexOf('DONE') > -1) {
|
|
185
|
-
send(ws, JSON.stringify({
|
|
186
|
-
event: 'buildSucess',
|
|
187
|
-
data: {
|
|
188
|
-
id: obj.data.id,
|
|
189
|
-
pid: pid
|
|
190
|
-
},
|
|
191
|
-
}))
|
|
192
|
-
}
|
|
193
|
-
}, function(type) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if (type == 'end') {
|
|
197
|
-
send(ws, JSON.stringify({
|
|
198
|
-
event: 'end',
|
|
199
|
-
data: {
|
|
200
|
-
id: obj.data.id
|
|
201
|
-
},
|
|
202
|
-
}))
|
|
203
|
-
|
|
204
|
-
console.log('编译完成')
|
|
205
|
-
} else {
|
|
206
|
-
send(ws, JSON.stringify({
|
|
207
|
-
event: 'error',
|
|
208
|
-
data: {
|
|
209
|
-
id: obj.data.id
|
|
210
|
-
},
|
|
211
|
-
}))
|
|
212
|
-
}
|
|
213
|
-
if (end) {
|
|
214
|
-
end()
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
}, obj.command)
|
|
218
|
-
|
|
219
|
-
return childreProcess;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
module.exports = {
|
|
223
|
-
execCmd,
|
|
224
|
-
killChildAndGrandChildren,
|
|
225
|
-
devRunApp,
|
|
226
|
-
buildApp
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|