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.
Files changed (151) hide show
  1. package/README.md +58 -82
  2. package/data/components.json +637 -0
  3. package/data/config.json +169 -0
  4. package/data/doc-index.json +61 -0
  5. package/data/docs/alert.md +79 -0
  6. package/data/docs/avatar-group.md +73 -0
  7. package/data/docs/badge.md +62 -0
  8. package/data/docs/between-time.md +76 -0
  9. package/data/docs/button.md +114 -0
  10. package/data/docs/calendar-multiple.md +90 -0
  11. package/data/docs/cell.md +91 -0
  12. package/data/docs/checkbox-group.md +62 -0
  13. package/data/docs/checkbox.md +74 -0
  14. package/data/docs/circle-progress.md +74 -0
  15. package/data/docs/code-input.md +77 -0
  16. package/data/docs/col.md +57 -0
  17. package/data/docs/collapse-item.md +76 -0
  18. package/data/docs/collapse.md +59 -0
  19. package/data/docs/countdown.md +79 -0
  20. package/data/docs/date-view.md +65 -0
  21. package/data/docs/drawer.md +94 -0
  22. package/data/docs/dropdown-item.md +68 -0
  23. package/data/docs/dropdown-menu.md +70 -0
  24. package/data/docs/echart.md +69 -0
  25. package/data/docs/float-drawer.md +79 -0
  26. package/data/docs/form-item.md +67 -0
  27. package/data/docs/form.md +68 -0
  28. package/data/docs/html.md +70 -0
  29. package/data/docs/icon.md +67 -0
  30. package/data/docs/image.md +73 -0
  31. package/data/docs/input.md +126 -0
  32. package/data/docs/modal.md +92 -0
  33. package/data/docs/money.md +70 -0
  34. package/data/docs/more.md +69 -0
  35. package/data/docs/navbar.md +82 -0
  36. package/data/docs/picker-date.md +75 -0
  37. package/data/docs/picker-selected.md +75 -0
  38. package/data/docs/picker-time.md +77 -0
  39. package/data/docs/picker-view.md +70 -0
  40. package/data/docs/picker.md +76 -0
  41. package/data/docs/popover.md +68 -0
  42. package/data/docs/progress.md +72 -0
  43. package/data/docs/pull-refresh.md +73 -0
  44. package/data/docs/radio-group.md +61 -0
  45. package/data/docs/radio.md +74 -0
  46. package/data/docs/rate.md +72 -0
  47. package/data/docs/row.md +61 -0
  48. package/data/docs/sheet.md +72 -0
  49. package/data/docs/sign-board.md +61 -0
  50. package/data/docs/skeleton.md +60 -0
  51. package/data/docs/sku.md +69 -0
  52. package/data/docs/slider-double.md +71 -0
  53. package/data/docs/slider-menu.md +78 -0
  54. package/data/docs/slider.md +71 -0
  55. package/data/docs/stepper.md +76 -0
  56. package/data/docs/steps-item.md +71 -0
  57. package/data/docs/steps.md +73 -0
  58. package/data/docs/sticky-header.md +57 -0
  59. package/data/docs/sticky.md +55 -0
  60. package/data/docs/switch-slider.md +82 -0
  61. package/data/docs/switch.md +68 -0
  62. package/data/docs/tabbar.md +83 -0
  63. package/data/docs/tabs.md +84 -0
  64. package/data/docs/tag.md +78 -0
  65. package/data/docs/text.md +69 -0
  66. package/data/docs/upload-photo.md +86 -0
  67. package/data/docs/upload-video.md +86 -0
  68. package/data/docs//346/250/241/346/235/277.md +47 -0
  69. package/data/examples/alert.vue +39 -0
  70. package/data/examples/avatar-group.vue +97 -0
  71. package/data/examples/badge.vue +87 -0
  72. package/data/examples/between-time.vue +39 -0
  73. package/data/examples/button.vue +70 -0
  74. package/data/examples/calendar-multiple.vue +57 -0
  75. package/data/examples/cell.vue +39 -0
  76. package/data/examples/checkbox.vue +71 -0
  77. package/data/examples/circle-progress.vue +69 -0
  78. package/data/examples/code-input.vue +36 -0
  79. package/data/examples/collapse.vue +76 -0
  80. package/data/examples/countdown.vue +39 -0
  81. package/data/examples/drawer.vue +138 -0
  82. package/data/examples/dropdown-menu.vue +59 -0
  83. package/data/examples/echart.vue +91 -0
  84. package/data/examples/float-drawer.vue +45 -0
  85. package/data/examples/form.vue +147 -0
  86. package/data/examples/html.vue +53 -0
  87. package/data/examples/icon.vue +65 -0
  88. package/data/examples/image.vue +38 -0
  89. package/data/examples/input.vue +66 -0
  90. package/data/examples/modal.vue +122 -0
  91. package/data/examples/money.vue +60 -0
  92. package/data/examples/more.vue +47 -0
  93. package/data/examples/navbar.vue +68 -0
  94. package/data/examples/picker-date.vue +53 -0
  95. package/data/examples/picker-selected.vue +35 -0
  96. package/data/examples/picker-time.vue +46 -0
  97. package/data/examples/picker-view.vue +35 -0
  98. package/data/examples/picker.vue +101 -0
  99. package/data/examples/popover.vue +130 -0
  100. package/data/examples/progress.vue +57 -0
  101. package/data/examples/pull-refresh.vue +41 -0
  102. package/data/examples/radio.vue +61 -0
  103. package/data/examples/rate.vue +35 -0
  104. package/data/examples/row.vue +52 -0
  105. package/data/examples/sheet.vue +36 -0
  106. package/data/examples/sign-board.vue +43 -0
  107. package/data/examples/skeleton.vue +45 -0
  108. package/data/examples/sku.vue +106 -0
  109. package/data/examples/slider-menu.vue +65 -0
  110. package/data/examples/slider.vue +51 -0
  111. package/data/examples/stepper.vue +44 -0
  112. package/data/examples/steps.vue +77 -0
  113. package/data/examples/sticky.vue +46 -0
  114. package/data/examples/switch-slider.vue +113 -0
  115. package/data/examples/switch.vue +62 -0
  116. package/data/examples/tabbar.vue +41 -0
  117. package/data/examples/tabs.vue +46 -0
  118. package/data/examples/tag.vue +69 -0
  119. package/data/examples/text.vue +38 -0
  120. package/data/examples/upload-photo.vue +39 -0
  121. package/data/examples/upload-video.vue +29 -0
  122. package/data/guides/cli.md +110 -0
  123. package/data/guides//344/273/213/347/273/215.md +34 -0
  124. package/data/guides//345/205/274/345/256/271/346/200/247.md +41 -0
  125. package/data/guides//345/215/225/344/275/215/346/240/207/347/255/276/350/257/264/346/230/216.md +22 -0
  126. package/data/guides//345/233/275/351/231/205/345/214/226.md +454 -0
  127. package/data/guides//345/256/211/350/243/205.md +103 -0
  128. package/data/guides//345/260/217/347/250/213/345/272/217/345/210/206/344/272/253.md +34 -0
  129. package/data/guides//345/270/270/350/247/201/351/227/256/351/242/230.md +102 -0
  130. package/data/guides//345/277/253/351/200/237/344/270/212/346/211/213.md +191 -0
  131. package/data/guides//346/233/264/346/226/260/346/227/245/345/277/227.md +155 -0
  132. package/data/guides//350/264/241/347/214/256/350/200/205.md +97 -0
  133. package/dist/main.mjs +93 -0
  134. package/package.json +54 -50
  135. package/bin/cmdTool.js +0 -229
  136. package/bin/createTmui.js +0 -383
  137. package/bin/dirTool.js +0 -152
  138. package/bin/hooks.js +0 -233
  139. package/bin/net.js +0 -139
  140. package/bin/selectedDir.js +0 -28
  141. package/bin/tmui.js +0 -28
  142. package/dist/tmui.js +0 -1
  143. package/webpack.config.js +0 -17
  144. package/website/css/app.fa961c8f.css +0 -1
  145. package/website/css/chunk-vendors.4ad1cdb5.css +0 -2
  146. package/website/favicon.ico +0 -0
  147. package/website/index.html +0 -1
  148. package/website/js/app.b68ad484.js +0 -2
  149. package/website/js/app.b68ad484.js.map +0 -1
  150. package/website/js/chunk-vendors.d9ea5cfa.js +0 -15
  151. 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": "1.3.0",
4
- "description": "tmui2.0,3.0,4.0x,3.2",
5
- "main": "./bin/tmui.js",
6
- "scripts": {
7
- "dev": "node ./bin/tmui.js",
8
- "test": "node ./dist/tmui.js",
9
- "build": "webpack --mode production"
10
- },
11
- "keywords": [
12
- "tmui"
13
- ],
14
- "author": {
15
- "name": "tmzdy"
16
- },
17
- "bin": {
18
- "tmui": "bin/tmui.js"
19
- },
20
- "license": "MIT",
21
- "dependencies": {
22
- "@babel/runtime": "^7.25.7",
23
- "babel-polyfill": "^6.26.0",
24
- "body-parser": "^1.20.3",
25
- "bufferhelper": "^0.2.1",
26
- "chalk": "^5.3.0",
27
- "codecs": "^3.1.0",
28
- "compressing": "^1.10.1",
29
- "express": "^4.21.1",
30
- "figlet": "^1.8.0",
31
- "global-dirs": "^4.0.0",
32
- "inquirer": "^12.0.0",
33
- "node-fetch": "^3.3.2",
34
- "node-os-utils": "^1.3.7",
35
- "open": "^10.1.0",
36
- "ps-tree": "^1.2.0",
37
- "ws": "^8.18.0"
38
- },
39
- "devDependencies": {
40
- "@babel/core": "^7.25.8",
41
- "@babel/plugin-transform-modules-commonjs": "^7.25.7",
42
- "@babel/plugin-transform-runtime": "^7.25.7",
43
- "@babel/preset-env": "^7.25.8",
44
- "babel-core": "^6.26.3",
45
- "babel-loader": "^9.2.1",
46
- "webpack": "^5.95.0",
47
- "webpack-cli": "^5.1.4",
48
- "webpack-node-externals": "^3.0.0"
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
-