tmui-cli 1.0.2 → 1.0.5
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 +87 -0
- package/bin/tmui.js +120 -61
- package/package.json +41 -13
- package/src/create.js +25 -16
- package/src/createHbx.js +16 -13
- package/src/rcli.js +16 -13
- package/src/rhbx.js +16 -13
- package/src/tmui2.js +60 -0
- package/READE.md +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
# TMUI 3.0
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
### tmui-cli使用介绍
|
|
8
|
+
|
|
9
|
+
#### 全局安装
|
|
10
|
+
|
|
11
|
+
```npm
|
|
12
|
+
npm -g install tmui-cli
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
#### 使用
|
|
16
|
+
请在项目文件的根目录下执行命令
|
|
17
|
+
输入 ```tmui```
|
|
18
|
+
即可取得所有可控的命令行
|
|
19
|
+
|
|
20
|
+
#### 命令解释
|
|
21
|
+
1. tmui cli 或者 tmui -c cli 为创建uniapp 平台的cli初始项目,内部已经包含了tmui最新框架(自动更新)
|
|
22
|
+
2. tmui hbx 或者 tmui -c hbx 为创建uniapp 平台的HBX初始项目,内部已经包含了tmui最新框架(自动更新)
|
|
23
|
+
3. tmui rcli 或者 tmui -c rcli 为【已有】uniapp 平台的cli项目,更新和下载tmui最新框架(自动更新)
|
|
24
|
+
4. tmui rhbx 或者 tmui -c rhbx 为【已有】uniapp 平台的HBX项目,更新和下载tmui最新框架(自动更新)
|
|
25
|
+
5. tmui use 为保姆级引导式下载安装上述功能项目。
|
|
26
|
+
|
|
27
|
+
#### 注意事项
|
|
28
|
+
如果你是需要创建tmui新项目可以使用命令行创建全新的项目。<br>
|
|
29
|
+
如果你是为老项目添加本tmui框架,你下载安装后,还需要按照文档步骤配置 [配置](https://tmui.design/doc/start/%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B.html)<br>
|
|
30
|
+
如果是全新的使用本cli创建项目,则是一键配置到位,安装完立即就可以编译出一个tmui 程序的demo
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
[](https://gitee.com/LYTB/tmui-design/stargazers) [](https://gitee.com/LYTB/tmui-design/members)
|
|
35
|
+
|
|
36
|
+
### [tmui3.0开发文档](https://tmui.design/)
|
|
37
|
+
|
|
38
|
+
TMUI 3.0有以下可见的优势方案执行未来的发展:
|
|
39
|
+
- 暗黑模式更为可靠
|
|
40
|
+
- 主题配置更为简单
|
|
41
|
+
- 组件库精细化打磨
|
|
42
|
+
- 依托UNIAPP全平台兼容性,以原生渲染为基础的全平台兼容。
|
|
43
|
+
- 常用功能组件不断迭代更新发布
|
|
44
|
+
- 各组件样式设置丰富,不局限,尽量能做到千人千面。
|
|
45
|
+
- 各组件经过微信开发工具的性能测试>=96分以上
|
|
46
|
+
|
|
47
|
+
[](https://gitee.com/LYTB/tmui-design)
|
|
48
|
+
|
|
49
|
+
[tmui2.0文档](https://ext.dcloud.net.cn/plugin?id=5949)
|
|
50
|
+
|
|
51
|
+
### [注意事项](https://ext.dcloud.net.cn/plugin?name=tm-ui)
|
|
52
|
+
|
|
53
|
+
- 提出建议和bug,请访问码云代码库:[点击打开](https://gitee.com/LYTB/tmui-design)
|
|
54
|
+
,并反馈相关bug或者建议.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
### [贡献者](https://tmui.design/doc/start/%E8%B4%A1%E7%8C%AE%E8%80%85.html#%E8%B4%A1%E7%8C%AE%E4%BA%BA%E5%91%98)
|
|
58
|
+
在伟大的无私贡献人员帮助下,使得此开源项目的可持续性发展更加的持久。他/她们理应得到展示,并为大家所知。不管是如何的贡献,哪怕很小的一部分也值得称赞!!<br>
|
|
59
|
+
点击图片查看更多
|
|
60
|
+
|
|
61
|
+
[](https://tmui.design/doc/start/%E8%B4%A1%E7%8C%AE%E8%80%85.html)
|
|
62
|
+
|
|
63
|
+
**微信用户群2** <br>
|
|
64
|
+

|
|
65
|
+
|
|
66
|
+
----
|
|
67
|
+
|
|
68
|
+
### 版本预览
|
|
69
|
+
|
|
70
|
+

|
|
71
|
+
|
|
72
|
+
----
|
|
73
|
+
|
|
74
|
+
### 赞助项目,以持续更新
|
|
75
|
+
|
|
76
|
+
如果帮到了你,适当的赞助有助力作者成果上的回报,报以项目的持续更新。
|
|
77
|
+
|
|
78
|
+

|
|
79
|
+
|
|
80
|
+
----
|
|
81
|
+
|
|
82
|
+
### 3.0.4新功能特性快速了解
|
|
83
|
+
|
|
84
|
+

|
|
85
|
+

|
|
86
|
+
|
|
87
|
+

|
package/bin/tmui.js
CHANGED
|
@@ -1,74 +1,133 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
process.title = 'tmui3.0-cli';
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
process.title = 'tmui3.0-cli';
|
|
4
4
|
const chalk = import("chalk")
|
|
5
|
-
const { Command } = require('commander');
|
|
5
|
+
const { Command } = require('commander');
|
|
6
6
|
const program = new Command();
|
|
7
7
|
const create = require("../src/create")
|
|
8
8
|
const createHbx = require("../src/createHbx")
|
|
9
9
|
const rhbx = require("../src/rhbx")
|
|
10
10
|
const rcli = require("../src/rcli")
|
|
11
11
|
const viewTmuiVer = require("../src/viewTmuiVer")
|
|
12
|
-
|
|
12
|
+
const tm2 = require("../src/tmui2")
|
|
13
|
+
const inquirer = import('inquirer');
|
|
14
|
+
const ft = import("node-fetch")
|
|
13
15
|
chalk.then(v=>{
|
|
14
16
|
const ck = new v.Chalk();
|
|
15
|
-
console.log(ck.
|
|
16
|
-
console.log(ck.
|
|
17
|
-
console.log(ck.
|
|
18
|
-
console.log(ck.
|
|
19
|
-
console.log(ck.
|
|
20
|
-
console.log(ck.green(`文档地址:https://tmui.design
|
|
21
|
-
console.log(ck.
|
|
22
|
-
console.log(ck.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
17
|
+
console.log(ck.white(`---------------------------------------------------`))
|
|
18
|
+
console.log(ck.white(`---------------------------------------------------`))
|
|
19
|
+
console.log(ck.white(`tmui3.0`))
|
|
20
|
+
console.log(ck.white(`欢迎使用tmui3.0 cli 命令行工具`))
|
|
21
|
+
console.log(ck.white(`将引导你创建一个tmui3.0组件框架的UNIAPP项目`))
|
|
22
|
+
console.log(ck.green(`文档地址:https://tmui.design`))
|
|
23
|
+
console.log(ck.white(`---------------------------------------------------`))
|
|
24
|
+
console.log(ck.white(`---------------------------------------------------`))
|
|
25
|
+
inquirer.then(ivk=>{
|
|
26
|
+
program
|
|
27
|
+
.version(require('../package').version)
|
|
28
|
+
program.command('cli')
|
|
29
|
+
.description('[可选指定版本号] 创建cli uniapp tmui3.0 项目[推荐]')
|
|
30
|
+
.action(function(type, name){
|
|
31
|
+
create.run(type,name)
|
|
32
|
+
})
|
|
33
|
+
program.command('hbx')
|
|
34
|
+
.description('[可选指定版本号] 创建hbx uniapp tmui3.0 项目[不推荐]')
|
|
35
|
+
.action(function(type, name){
|
|
36
|
+
createHbx.run(type,name)
|
|
37
|
+
})
|
|
38
|
+
program.command('rcli')
|
|
39
|
+
.description('[可选指定版本号] 已有cli项目下载/更新tmui3.0')
|
|
40
|
+
.action(function(type, name){
|
|
41
|
+
rcli.run(type,name)
|
|
42
|
+
})
|
|
43
|
+
program.command('rhbx')
|
|
44
|
+
.description('[可选指定版本号] 已有hbx项目下载/更新tmui3.0')
|
|
45
|
+
.action(function(type, name){
|
|
46
|
+
rhbx.run(type,name)
|
|
47
|
+
})
|
|
48
|
+
program.command('ver')
|
|
49
|
+
.description('查看tmui可用版本号')
|
|
50
|
+
.action(function(type, name){
|
|
51
|
+
viewTmuiVer.run(type,name)
|
|
52
|
+
})
|
|
53
|
+
program.command('use')
|
|
54
|
+
.description('引导式安装tmui组件!!!')
|
|
55
|
+
.action(function(type, name){
|
|
56
|
+
const { prompt,Separator} = ivk.default;
|
|
57
|
+
prompt([
|
|
58
|
+
{
|
|
59
|
+
type: 'list',
|
|
60
|
+
name: 'tmuiVerName',
|
|
61
|
+
message: '请选择你的uniApp项目的vue版本',
|
|
62
|
+
choices: [
|
|
63
|
+
'vue2',
|
|
64
|
+
'vue3'
|
|
65
|
+
],
|
|
66
|
+
}
|
|
67
|
+
])
|
|
68
|
+
.then((answers) => {
|
|
69
|
+
if(answers.tmuiVerName=="vue2"){
|
|
70
|
+
console.log("tmui2.0版本只支持uniApp HBX项目,请务必当前目录在你的项目文件夹下/或者一个空文件都可以。")
|
|
71
|
+
console.log("正在为你的项目下载/更新tmui2.0的最新版本。")
|
|
72
|
+
tm2.run()
|
|
73
|
+
}else if(answers.tmuiVerName=='vue3'){
|
|
61
74
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
ft.then((fah)=>{
|
|
76
|
+
const fetch = fah.default
|
|
77
|
+
fetch('https://cdn.tmui.design/tmuiVer.txt').then(async (res)=>{
|
|
78
|
+
let verText = await res.text();
|
|
79
|
+
let lastVer = verText.split('\n').slice(0,10)
|
|
80
|
+
prompt([
|
|
81
|
+
{
|
|
82
|
+
type: 'list',
|
|
83
|
+
name: 'moshi',
|
|
84
|
+
message: '选择安装方式:',
|
|
85
|
+
choices: [
|
|
86
|
+
'cli',
|
|
87
|
+
'rcli',
|
|
88
|
+
'hbx',
|
|
89
|
+
'rhbx',
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
type: 'list',
|
|
94
|
+
name: 'ver',
|
|
95
|
+
message: '选择最近的版本号',
|
|
96
|
+
choices: lastVer,
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
])
|
|
100
|
+
.then((answers) => {
|
|
101
|
+
let ms = answers.moshi;
|
|
102
|
+
let ver = answers.ver.trim()
|
|
103
|
+
if(!ver||typeof ver=="undefined"){
|
|
104
|
+
console.log(ck.red("请正确输入版本号"))
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if(ms=="cli"){
|
|
108
|
+
create.run(null,null,ver)
|
|
109
|
+
}else if(ms=="rcli"){
|
|
110
|
+
rcli.run(null,null,ver)
|
|
111
|
+
}else if(ms=="hbx"){
|
|
112
|
+
createHbx.run(null,null,ver)
|
|
113
|
+
}else if(ms=="rhbx"){
|
|
114
|
+
rhbx.run(null,null,ver)
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
})
|
|
126
|
+
program.parse();
|
|
127
|
+
|
|
128
|
+
})
|
|
129
|
+
|
|
71
130
|
|
|
72
131
|
})
|
|
73
132
|
|
|
74
|
-
|
|
133
|
+
|
package/package.json
CHANGED
|
@@ -1,22 +1,50 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
2
|
+
"_from": "tmui-cli",
|
|
3
|
+
"_id": "tmui-cli@1.0.3",
|
|
4
|
+
"_inBundle": false,
|
|
5
|
+
"_integrity": "sha512-mnddgPs3eUjTuxQGv6hxlc0b98d53YXtjd0tvrlzWvrAnf0IS0qQMo4bZHi+ImwOEYqbNLX9jhd9pq1cVb9tjw==",
|
|
6
|
+
"_location": "/tmui-cli",
|
|
7
|
+
"_phantomChildren": {},
|
|
8
|
+
"_requested": {
|
|
9
|
+
"type": "tag",
|
|
10
|
+
"registry": true,
|
|
11
|
+
"raw": "tmui-cli",
|
|
12
|
+
"name": "tmui-cli",
|
|
13
|
+
"escapedName": "tmui-cli",
|
|
14
|
+
"rawSpec": "",
|
|
15
|
+
"saveSpec": null,
|
|
16
|
+
"fetchSpec": "latest"
|
|
9
17
|
},
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"tm-vuetify"
|
|
18
|
+
"_requiredBy": [
|
|
19
|
+
"#USER"
|
|
13
20
|
],
|
|
14
|
-
"
|
|
15
|
-
"
|
|
21
|
+
"_resolved": "https://registry.npmjs.org/tmui-cli/-/tmui-cli-1.0.3.tgz",
|
|
22
|
+
"_shasum": "162803da7d6cc696e3f4a908b223a15f0b33d245",
|
|
23
|
+
"_spec": "tmui-cli",
|
|
24
|
+
"_where": "C:\\Users\\zsylp",
|
|
25
|
+
"author": {
|
|
26
|
+
"name": "tmzdy tmui"
|
|
27
|
+
},
|
|
28
|
+
"bin": {
|
|
29
|
+
"tmui": "bin/tmui.js"
|
|
30
|
+
},
|
|
31
|
+
"bundleDependencies": false,
|
|
16
32
|
"dependencies": {
|
|
17
33
|
"chalk": "^5.0.1",
|
|
18
34
|
"commander": "^9.4.0",
|
|
19
35
|
"compressing": "^1.6.2",
|
|
36
|
+
"inquirer": "^9.1.0",
|
|
20
37
|
"node-fetch": "^3.2.10"
|
|
21
|
-
}
|
|
38
|
+
},
|
|
39
|
+
"deprecated": false,
|
|
40
|
+
"description": "tmui3.0",
|
|
41
|
+
"keywords": [
|
|
42
|
+
"tmui",
|
|
43
|
+
"tm-vuetify"
|
|
44
|
+
],
|
|
45
|
+
"license": "ISC",
|
|
46
|
+
"main": "./bin/tmui.js",
|
|
47
|
+
"name": "tmui-cli",
|
|
48
|
+
"scripts": {},
|
|
49
|
+
"version": "1.0.5"
|
|
22
50
|
}
|
package/src/create.js
CHANGED
|
@@ -4,32 +4,34 @@ const fs = require("fs")
|
|
|
4
4
|
const ft = import("node-fetch")
|
|
5
5
|
const compressing = require("compressing")
|
|
6
6
|
const chilPro = require("child_process")
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
exports.run = function(type, name,vr) {
|
|
8
9
|
chalk.then(v=>{
|
|
9
10
|
const ck = new v.Chalk();
|
|
10
11
|
const nowPath = path.resolve('./');
|
|
11
12
|
console.log(ck.bgBlue('不 要 关闭窗体,正在创建中....'))
|
|
12
13
|
let userInputVer = "";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
if(vr!=null){
|
|
15
|
+
userInputVer = vr;
|
|
16
|
+
}else{
|
|
17
|
+
let args = name.parent.rawArgs.filter(el=>{
|
|
18
|
+
return el
|
|
19
|
+
})
|
|
20
|
+
if(args.includes('-c')){
|
|
21
|
+
if(args.length==5){
|
|
22
|
+
userInputVer = args.pop()||""
|
|
23
|
+
userInputVer = typeof userInputVer=='undefined'?"":userInputVer
|
|
24
|
+
}
|
|
25
|
+
}else if(args.length==4){
|
|
19
26
|
userInputVer = args.pop()||""
|
|
20
27
|
userInputVer = typeof userInputVer=='undefined'?"":userInputVer
|
|
21
28
|
}
|
|
22
|
-
}else if(args.length==4){
|
|
23
|
-
userInputVer = args.pop()||""
|
|
24
|
-
userInputVer = typeof userInputVer=='undefined'?"":userInputVer
|
|
25
29
|
}
|
|
26
30
|
|
|
27
|
-
|
|
28
31
|
// 检查是否有router目录?
|
|
29
32
|
// fs.existsSync(path.join(nowPath,'router','index.ts'))
|
|
30
33
|
ft.then((fah)=>{
|
|
31
34
|
const fetch = fah.default
|
|
32
|
-
|
|
33
35
|
fetch('https://cdn.tmui.design/tmuiVer.txt').then(async (res)=>{
|
|
34
36
|
let verText = await res.text();
|
|
35
37
|
let ver = verText.split('\n')[0]
|
|
@@ -43,9 +45,9 @@ exports.run = function(type, name) {
|
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
const fileName = `cli${ver}.zip`
|
|
46
|
-
console.log(ck.green(
|
|
47
|
-
console.log(
|
|
48
|
-
console.log(ck.green(
|
|
48
|
+
console.log(ck.green(`---------------------------------------------------`))
|
|
49
|
+
console.log(ck.green('正在使用版本号:'+ver))
|
|
50
|
+
console.log(ck.green(`---------------------------------------------------`))
|
|
49
51
|
console.log(ck.bgBlue('不 要 关闭窗体,正在创建中....'))
|
|
50
52
|
fetch(`https://cdn.tmui.design/public/static/cli.zip`).then(async (rf)=>{
|
|
51
53
|
let d = await rf.buffer()
|
|
@@ -76,7 +78,9 @@ exports.run = function(type, name) {
|
|
|
76
78
|
fs.unlinkSync(path.join(nowPath,'cli.zip'))
|
|
77
79
|
}
|
|
78
80
|
console.log(ck.bgGreen('清理成功,正在安装依赖时间稍长~'))
|
|
79
|
-
|
|
81
|
+
|
|
82
|
+
const installNpm = chilPro.exec('npm install',(error, stdout, stderr)=>{
|
|
83
|
+
|
|
80
84
|
if(error){
|
|
81
85
|
console.log('安装失败,请在当前目录手动安装依赖文件执行:',ck.bgRed(error))
|
|
82
86
|
console.log(ck.green('npm install'))
|
|
@@ -89,6 +93,11 @@ exports.run = function(type, name) {
|
|
|
89
93
|
console.log(ck.green('npm run dev:h5'))
|
|
90
94
|
console.log(ck.green('在本窗口输入上述命令,按回车键编译。'))
|
|
91
95
|
})
|
|
96
|
+
|
|
97
|
+
installNpm.stdout?.on("data",(msg)=>{
|
|
98
|
+
console.log(msg.toString('utf8'))
|
|
99
|
+
})
|
|
100
|
+
|
|
92
101
|
}).catch(err=>{
|
|
93
102
|
console.log(ck.bgRed(err))
|
|
94
103
|
})
|
package/src/createHbx.js
CHANGED
|
@@ -4,24 +4,27 @@ const fs = require("fs")
|
|
|
4
4
|
const ft = import("node-fetch")
|
|
5
5
|
const compressing = require("compressing")
|
|
6
6
|
const chilPro = require("child_process")
|
|
7
|
-
exports.run = function(type, name) {
|
|
7
|
+
exports.run = function(type, name,vr) {
|
|
8
8
|
chalk.then(v=>{
|
|
9
9
|
const ck = new v.Chalk();
|
|
10
10
|
const nowPath = path.resolve('./');
|
|
11
11
|
console.log(ck.bgBlue('不 要 关闭窗体,正在创建中....'))
|
|
12
12
|
let userInputVer = "";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
if(vr!=null){
|
|
14
|
+
userInputVer = vr;
|
|
15
|
+
}else{
|
|
16
|
+
let args = name.parent.rawArgs.filter(el=>{
|
|
17
|
+
return el
|
|
18
|
+
})
|
|
19
|
+
if(args.includes('-c')){
|
|
20
|
+
if(args.length==5){
|
|
21
|
+
userInputVer = args.pop()||""
|
|
22
|
+
userInputVer = typeof userInputVer=='undefined'?"":userInputVer
|
|
23
|
+
}
|
|
24
|
+
}else if(args.length==4){
|
|
19
25
|
userInputVer = args.pop()||""
|
|
20
26
|
userInputVer = typeof userInputVer=='undefined'?"":userInputVer
|
|
21
27
|
}
|
|
22
|
-
}else if(args.length==4){
|
|
23
|
-
userInputVer = args.pop()||""
|
|
24
|
-
userInputVer = typeof userInputVer=='undefined'?"":userInputVer
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
ft.then((fah)=>{
|
|
@@ -38,9 +41,9 @@ exports.run = function(type, name) {
|
|
|
38
41
|
console.log(ck.red('不存在版本号:'+ver))
|
|
39
42
|
return;
|
|
40
43
|
}
|
|
41
|
-
console.log(ck.green(
|
|
42
|
-
console.log(
|
|
43
|
-
console.log(ck.green(
|
|
44
|
+
console.log(ck.green(`---------------------------------------------------`))
|
|
45
|
+
console.log(ck.green('正在使用版本号:'+ver))
|
|
46
|
+
console.log(ck.green(`---------------------------------------------------`))
|
|
44
47
|
console.log(ck.bgBlue('不 要 关闭窗体,正在创建中....'))
|
|
45
48
|
fetch(`https://cdn.tmui.design/public/static/tmuiHBX.zip`).then(async (rf)=>{
|
|
46
49
|
let d = await rf.buffer()
|
package/src/rcli.js
CHANGED
|
@@ -4,24 +4,27 @@ const fs = require("fs")
|
|
|
4
4
|
const ft = import("node-fetch")
|
|
5
5
|
const compressing = require("compressing")
|
|
6
6
|
const chilPro = require("child_process")
|
|
7
|
-
exports.run = function(type, name) {
|
|
7
|
+
exports.run = function(type, name,vr) {
|
|
8
8
|
chalk.then(v=>{
|
|
9
9
|
const ck = new v.Chalk();
|
|
10
10
|
const nowPath = path.resolve('./');
|
|
11
11
|
console.log(ck.bgBlue('不 要 关闭窗体,正在创建中....'))
|
|
12
12
|
let userInputVer = "";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
if(vr!=null){
|
|
14
|
+
userInputVer = vr;
|
|
15
|
+
}else{
|
|
16
|
+
let args = name.parent.rawArgs.filter(el=>{
|
|
17
|
+
return el
|
|
18
|
+
})
|
|
19
|
+
if(args.includes('-c')){
|
|
20
|
+
if(args.length==5){
|
|
21
|
+
userInputVer = args.pop()||""
|
|
22
|
+
userInputVer = typeof userInputVer=='undefined'?"":userInputVer
|
|
23
|
+
}
|
|
24
|
+
}else if(args.length==4){
|
|
19
25
|
userInputVer = args.pop()||""
|
|
20
26
|
userInputVer = typeof userInputVer=='undefined'?"":userInputVer
|
|
21
27
|
}
|
|
22
|
-
}else if(args.length==4){
|
|
23
|
-
userInputVer = args.pop()||""
|
|
24
|
-
userInputVer = typeof userInputVer=='undefined'?"":userInputVer
|
|
25
28
|
}
|
|
26
29
|
ft.then((fah)=>{
|
|
27
30
|
const fetch = fah.default
|
|
@@ -38,9 +41,9 @@ exports.run = function(type, name) {
|
|
|
38
41
|
return;
|
|
39
42
|
}
|
|
40
43
|
const fileName = `cli${ver}.zip`
|
|
41
|
-
console.log(ck.green(
|
|
42
|
-
console.log(
|
|
43
|
-
console.log(ck.green(
|
|
44
|
+
console.log(ck.green(`---------------------------------------------------`))
|
|
45
|
+
console.log(ck.green('正在使用版本号:'+ver))
|
|
46
|
+
console.log(ck.green(`---------------------------------------------------`))
|
|
44
47
|
console.log(ck.bgBlue('不 要 关闭窗体,正在创建中....'))
|
|
45
48
|
//创建tmui目录
|
|
46
49
|
if( !fs.existsSync(path.join(nowPath,'src'))){
|
package/src/rhbx.js
CHANGED
|
@@ -4,24 +4,27 @@ const fs = require("fs")
|
|
|
4
4
|
const ft = import("node-fetch")
|
|
5
5
|
const compressing = require("compressing")
|
|
6
6
|
const chilPro = require("child_process")
|
|
7
|
-
exports.run = function(type, name) {
|
|
7
|
+
exports.run = function(type, name,vr) {
|
|
8
8
|
chalk.then(v=>{
|
|
9
9
|
const ck = new v.Chalk();
|
|
10
10
|
const nowPath = path.resolve('./');
|
|
11
11
|
console.log(ck.bgBlue('不 要 关闭窗体,正在创建中....'))
|
|
12
12
|
let userInputVer = "";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
if(vr!=null){
|
|
14
|
+
userInputVer = vr;
|
|
15
|
+
}else{
|
|
16
|
+
let args = name.parent.rawArgs.filter(el=>{
|
|
17
|
+
return el
|
|
18
|
+
})
|
|
19
|
+
if(args.includes('-c')){
|
|
20
|
+
if(args.length==5){
|
|
21
|
+
userInputVer = args.pop()||""
|
|
22
|
+
userInputVer = typeof userInputVer=='undefined'?"":userInputVer
|
|
23
|
+
}
|
|
24
|
+
}else if(args.length==4){
|
|
19
25
|
userInputVer = args.pop()||""
|
|
20
26
|
userInputVer = typeof userInputVer=='undefined'?"":userInputVer
|
|
21
27
|
}
|
|
22
|
-
}else if(args.length==4){
|
|
23
|
-
userInputVer = args.pop()||""
|
|
24
|
-
userInputVer = typeof userInputVer=='undefined'?"":userInputVer
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
if(fs.existsSync(path.join(nowPath,'router','index.ts'))){
|
|
@@ -61,9 +64,9 @@ exports.run = function(type, name) {
|
|
|
61
64
|
console.log(ck.red('不存在版本号:'+ver))
|
|
62
65
|
return;
|
|
63
66
|
}
|
|
64
|
-
console.log(ck.green(
|
|
65
|
-
console.log(
|
|
66
|
-
console.log(ck.green(
|
|
67
|
+
console.log(ck.green(`---------------------------------------------------`))
|
|
68
|
+
console.log(ck.green('正在使用版本号:'+ver))
|
|
69
|
+
console.log(ck.green(`---------------------------------------------------`))
|
|
67
70
|
console.log(ck.bgBlue('不 要 关闭窗体,正在创建中....'))
|
|
68
71
|
//下载tmui
|
|
69
72
|
let donloadTmui = `https://cdn.tmui.design/public/static/tmui${ver}.zip`
|
package/src/tmui2.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const chalk = import("chalk")
|
|
2
|
+
const path = require("path")
|
|
3
|
+
const fs = require("fs")
|
|
4
|
+
const ft = import("node-fetch")
|
|
5
|
+
const compressing = require("compressing")
|
|
6
|
+
const chilPro = require("child_process")
|
|
7
|
+
exports.run = function() {
|
|
8
|
+
chalk.then(v=>{
|
|
9
|
+
const ck = new v.Chalk();
|
|
10
|
+
const nowPath = path.resolve('./');
|
|
11
|
+
console.log(ck.bgBlue('不 要 关闭窗体,正在创建中....'))
|
|
12
|
+
|
|
13
|
+
ft.then((fah)=>{
|
|
14
|
+
const fetch = fah.default
|
|
15
|
+
//创建tmui目录
|
|
16
|
+
let tmuipath = path.join(nowPath,'tm-vuetify');
|
|
17
|
+
if(!fs.existsSync(tmuipath)){
|
|
18
|
+
fs.mkdirSync(tmuipath);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
fetch('https://cdn.tmui.design/tmui2.0Ver.txt').then(async (res)=>{
|
|
22
|
+
let verText = await res.text();
|
|
23
|
+
let ver = verText.split('\n')[0]
|
|
24
|
+
|
|
25
|
+
let isVer = verText.includes(ver)
|
|
26
|
+
if(!isVer){
|
|
27
|
+
console.log(ck.red('不存在版本号:'+ver))
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
console.log(ck.green(`---------------------------------------------------`))
|
|
31
|
+
console.log(ck.green('正在使用版本号:'+ver))
|
|
32
|
+
console.log(ck.green(`---------------------------------------------------`))
|
|
33
|
+
console.log(ck.bgBlue('不 要 关闭窗体,正在创建中....'))
|
|
34
|
+
//下载tmui
|
|
35
|
+
let donloadTmui = `https://cdn.tmui.design/public/static/tmui${ver}.zip`
|
|
36
|
+
fetch(donloadTmui).then(async (tmuires)=>{
|
|
37
|
+
fs.writeFileSync(path.join(nowPath,'tmui.zip'),await tmuires.buffer())
|
|
38
|
+
compressing.zip.uncompress(path.join(nowPath,'tmui.zip'),tmuipath)
|
|
39
|
+
.then(comtmui=>{
|
|
40
|
+
|
|
41
|
+
if(fs.existsSync(path.join(nowPath,'tmui.zip'))){
|
|
42
|
+
fs.unlinkSync(path.join(nowPath,'tmui.zip'))
|
|
43
|
+
}
|
|
44
|
+
console.log(ck.bgGreen('已成功将tmui2.0下载至你的项目根目录下!'))
|
|
45
|
+
console.log(ck.bgGreen('具体安装配置流程见文档:https://jx2d.cn'))
|
|
46
|
+
|
|
47
|
+
}).catch(err=>{
|
|
48
|
+
console.log(ck.bgRed(err))
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
.catch(e=>{
|
|
52
|
+
console.log(ck.bgRed(e))
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
})
|
|
58
|
+
// fetch()tmuiVer.txt
|
|
59
|
+
})
|
|
60
|
+
}
|
package/READE.md
DELETED
|
File without changes
|