tmui-cli 1.1.3 → 1.1.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/bin/tmui.js +67 -29
- package/package.json +2 -1
- package/src/create.js +59 -29
- package/src/create4xhbx.js +29 -29
- package/src/createHbx.js +18 -4
- package/src/rcli.js +19 -2
- package/src/rhbx.js +16 -19
package/bin/tmui.js
CHANGED
|
@@ -64,33 +64,62 @@ chalk.then(v=>{
|
|
|
64
64
|
console.log(ck.white(`---------------------------------------------------`))
|
|
65
65
|
console.log(ck.white(`命令使用方式为:tmui xxx命令 比如:tmui use`))
|
|
66
66
|
console.log(ck.white(`---------------------------------------------------`))
|
|
67
|
+
|
|
68
|
+
|
|
67
69
|
inquirer.then(ivk=>{
|
|
70
|
+
const { prompt,Separator} = ivk.default;
|
|
71
|
+
|
|
72
|
+
function createTest(type,name){
|
|
73
|
+
if(type=="rcli"){
|
|
74
|
+
rcli.run(type,name,null,'npm','')
|
|
75
|
+
}else if(type=="rhbx"){
|
|
76
|
+
createHbx.run(type,name,null,'npm','')
|
|
77
|
+
}
|
|
78
|
+
prompt([{
|
|
79
|
+
type: 'input',
|
|
80
|
+
name: 'filename',
|
|
81
|
+
message: '在当前路径下创建项目,请输入项目名称:',
|
|
82
|
+
}, ])
|
|
83
|
+
.then(answers2 => {
|
|
84
|
+
if(type=="cli"){
|
|
85
|
+
create.run(type,name,null,'npm',answers2.filename)
|
|
86
|
+
}else if(type=="rcli"){
|
|
87
|
+
rcli.run(type,name,null,'npm',answers2.filename)
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
}
|
|
68
91
|
program
|
|
69
|
-
.version(require('../package').version)
|
|
70
|
-
program.command('4x')
|
|
71
|
-
.description('创建uniapp的tmui4.0x hbx项目')
|
|
72
|
-
.action(function(type, name){
|
|
73
|
-
create4xhbx.run(type,name,null,null)
|
|
92
|
+
.version(require('../package').version)
|
|
93
|
+
program.command('4x')
|
|
94
|
+
.description('创建uniapp的tmui4.0x hbx项目')
|
|
95
|
+
.action(function(type, name){
|
|
96
|
+
create4xhbx.run(type,name,null,null)
|
|
74
97
|
})
|
|
75
98
|
program.command('cli')
|
|
76
99
|
.description('创建uniapp的cli项目包含tmui3.0[推荐]')
|
|
77
100
|
.action(function(type, name){
|
|
78
|
-
|
|
101
|
+
createTest('cli',name)
|
|
79
102
|
})
|
|
80
103
|
program.command('hbx')
|
|
81
104
|
.description('创建uniapp的hbx项目包含tmui3.0[不推荐]')
|
|
82
105
|
.action(function(type, name){
|
|
83
|
-
createHbx.run(type,name)
|
|
106
|
+
// createHbx.run(type,name)
|
|
107
|
+
createTest('hbx',name)
|
|
108
|
+
|
|
84
109
|
})
|
|
85
110
|
program.command('rcli')
|
|
86
111
|
.description('为cli项目下载/更新tmui3.0')
|
|
87
112
|
.action(function(type, name){
|
|
88
|
-
rcli.run(type,name)
|
|
113
|
+
// rcli.run(type,name)
|
|
114
|
+
createTest('rcli',name)
|
|
115
|
+
|
|
116
|
+
|
|
89
117
|
})
|
|
90
118
|
program.command('rhbx')
|
|
91
119
|
.description('为hbx项目下载/更新tmui3.0')
|
|
92
120
|
.action(function(type, name){
|
|
93
|
-
rhbx.run(type,name)
|
|
121
|
+
// rhbx.run(type,name)
|
|
122
|
+
createTest('rhbx',name)
|
|
94
123
|
})
|
|
95
124
|
program.command('ver')
|
|
96
125
|
.description('查看tmui可用版本号')
|
|
@@ -100,7 +129,6 @@ chalk.then(v=>{
|
|
|
100
129
|
program.command('use')
|
|
101
130
|
.description('引导式安装tmui3.0项目[自定义安装]')
|
|
102
131
|
.action(function(type, name){
|
|
103
|
-
const { prompt,Separator} = ivk.default;
|
|
104
132
|
prompt([
|
|
105
133
|
{
|
|
106
134
|
type: 'list',
|
|
@@ -164,30 +192,40 @@ chalk.then(v=>{
|
|
|
164
192
|
console.log(ck.red("请正确输入版本号"))
|
|
165
193
|
return;
|
|
166
194
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
195
|
+
prompt([{
|
|
196
|
+
type: 'input',
|
|
197
|
+
name: 'filename',
|
|
198
|
+
message: '在当前路径下创建项目,请输入项目名称:',
|
|
199
|
+
}, ])
|
|
200
|
+
.then(answers2 => {
|
|
201
|
+
|
|
202
|
+
if(ms=="cli"){
|
|
203
|
+
create.run(null,null,ver,packname,answers2.filename)
|
|
204
|
+
}else if(ms=="rcli"){
|
|
205
|
+
rcli.run(null,null,ver,packname,answers2.filename)
|
|
206
|
+
}else if(ms=="hbx"){
|
|
207
|
+
createHbx.run(null,null,ver,packname,answers2.filename)
|
|
208
|
+
}else if(ms=="rhbx"){
|
|
209
|
+
rhbx.run(null,null,ver,packname,answers2.filename)
|
|
210
|
+
}
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
|
|
176
214
|
})
|
|
177
215
|
})
|
|
178
216
|
|
|
179
217
|
})
|
|
180
218
|
|
|
181
|
-
}else if(answers.tmuiVerName=='tmui4.0x'){
|
|
182
|
-
|
|
183
|
-
prompt([{
|
|
184
|
-
type: 'input',
|
|
185
|
-
name: 'filename',
|
|
186
|
-
message: '在当前路径下创建项目,请输入项目名称:',
|
|
187
|
-
}, ])
|
|
188
|
-
.then(answers2 => {
|
|
189
|
-
create4xhbx.run(null,null,null,answers2.filename)
|
|
190
|
-
})
|
|
219
|
+
}else if(answers.tmuiVerName=='tmui4.0x'){
|
|
220
|
+
|
|
221
|
+
prompt([{
|
|
222
|
+
type: 'input',
|
|
223
|
+
name: 'filename',
|
|
224
|
+
message: '在当前路径下创建项目,请输入项目名称:',
|
|
225
|
+
}, ])
|
|
226
|
+
.then(answers2 => {
|
|
227
|
+
create4xhbx.run(null,null,null,answers2.filename)
|
|
228
|
+
})
|
|
191
229
|
}
|
|
192
230
|
});
|
|
193
231
|
|
package/package.json
CHANGED
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"codecs": "^3.0.0",
|
|
36
36
|
"commander": "^9.4.0",
|
|
37
37
|
"compressing": "^1.6.2",
|
|
38
|
+
"echarts": "^5.5.1",
|
|
38
39
|
"express": "^4.18.2",
|
|
39
40
|
"figlet": "^1.5.2",
|
|
40
41
|
"global-dirs": "^3.0.1",
|
|
@@ -65,5 +66,5 @@
|
|
|
65
66
|
"scripts": {
|
|
66
67
|
"run": "node ./bin/tmui.js"
|
|
67
68
|
},
|
|
68
|
-
"version": "1.1.
|
|
69
|
+
"version": "1.1.5"
|
|
69
70
|
}
|
package/src/create.js
CHANGED
|
@@ -10,11 +10,11 @@ var CLI = require('clui'),
|
|
|
10
10
|
Spinner = CLI.Spinner;
|
|
11
11
|
var countdown = new Spinner('请等待... ', ['/','\\','/','\\']);
|
|
12
12
|
const delFile = require("./util").default.delFile
|
|
13
|
-
exports.run = function(type, name,vr,packname="npm") {
|
|
13
|
+
exports.run = function(type, name,vr,packname="npm",filename="") {
|
|
14
14
|
chalk.then(v=>{
|
|
15
15
|
const ck = new v.Chalk();
|
|
16
|
-
const nowPath = path.resolve('./');
|
|
17
|
-
|
|
16
|
+
const nowPath = path.join(path.resolve('./'),filename);
|
|
17
|
+
var vrNumber = 0
|
|
18
18
|
countdown.message(ck.bgBlue('不 要 关闭窗体,正在创建中....'))
|
|
19
19
|
let userInputVer = "";
|
|
20
20
|
if(vr!=null){
|
|
@@ -33,9 +33,17 @@ exports.run = function(type, name,vr,packname="npm") {
|
|
|
33
33
|
userInputVer = typeof userInputVer=='undefined'?"":userInputVer
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
vrNumber = parseInt(userInputVer.replace(/\./g,''))
|
|
37
|
+
if(isNaN(vrNumber)){
|
|
38
|
+
console.log(ck.red("没有输入版本号"))
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
countdown.start()
|
|
37
42
|
// 检查是否有router目录?
|
|
38
43
|
// fs.existsSync(path.join(nowPath,'router','index.ts'))
|
|
44
|
+
if(!fs.existsSync(nowPath)){
|
|
45
|
+
fs.mkdirSync(nowPath);
|
|
46
|
+
}
|
|
39
47
|
ft.then((fah)=>{
|
|
40
48
|
const fetch = fah.default
|
|
41
49
|
fetch('https://cdn.tmui.design/tmuiVer.txt').then(async (res)=>{
|
|
@@ -53,7 +61,7 @@ exports.run = function(type, name,vr,packname="npm") {
|
|
|
53
61
|
|
|
54
62
|
|
|
55
63
|
countdown.message(ck.green('正在使用版本号:'+ver))
|
|
56
|
-
fetch(`https://cdn.tmui.design/public/static
|
|
64
|
+
fetch(`https://cdn.tmui.design/public/static/${vrNumber>=320?'cli32':'cli'}.zip`).then(async (rf)=>{
|
|
57
65
|
let d = await rf.buffer()
|
|
58
66
|
fs.writeFile(path.join(nowPath,'cli.zip'),d,(err)=>{
|
|
59
67
|
if(err){
|
|
@@ -65,6 +73,13 @@ exports.run = function(type, name,vr,packname="npm") {
|
|
|
65
73
|
.then(revalue=>{
|
|
66
74
|
//创建tmui目录
|
|
67
75
|
let tmuipath = path.join(nowPath,'src','tmui');
|
|
76
|
+
if(vrNumber>=320){
|
|
77
|
+
tmuipath = path.join(nowPath,'src','uni_modules');
|
|
78
|
+
if(!fs.existsSync(tmuipath)){
|
|
79
|
+
fs.mkdirSync(tmuipath);
|
|
80
|
+
}
|
|
81
|
+
tmuipath = path.join(nowPath,'src','uni_modules','tm-ui');
|
|
82
|
+
}
|
|
68
83
|
if(!fs.existsSync(tmuipath)){
|
|
69
84
|
fs.mkdirSync(tmuipath);
|
|
70
85
|
}else{
|
|
@@ -74,6 +89,7 @@ exports.run = function(type, name,vr,packname="npm") {
|
|
|
74
89
|
let donloadTmui = `https://cdn.tmui.design/public/static/tmui${ver}.zip`
|
|
75
90
|
fetch(donloadTmui).then(async (tmuires)=>{
|
|
76
91
|
fs.writeFileSync(path.join(nowPath,'tmui.zip'),await tmuires.buffer())
|
|
92
|
+
|
|
77
93
|
compressing.zip.uncompress(path.join(nowPath,'tmui.zip'),tmuipath)
|
|
78
94
|
.then(comtmui=>{
|
|
79
95
|
countdown.message(ck.green('非常nice,安装成功,正在清理'))
|
|
@@ -84,35 +100,49 @@ exports.run = function(type, name,vr,packname="npm") {
|
|
|
84
100
|
fs.unlinkSync(path.join(nowPath,'cli.zip'))
|
|
85
101
|
}
|
|
86
102
|
countdown.message(ck.green('正在安装依赖'))
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
|
|
104
|
+
if(filename){
|
|
105
|
+
chilPro.exec(`cd ${filename}`,(error1, stdout1, stderr1)=>{
|
|
106
|
+
process.chdir(nowPath)
|
|
107
|
+
installdir()
|
|
108
|
+
})
|
|
109
|
+
}else{
|
|
110
|
+
installdir()
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function installdir(){
|
|
114
|
+
const installNpm = chilPro.exec(packname+' install',(error, stdout, stderr)=>{
|
|
115
|
+
if(error){
|
|
116
|
+
countdown.stop()
|
|
117
|
+
console.log('安装失败,请在当前目录手动安装依赖文件执行:',ck.bgRed(error))
|
|
118
|
+
console.log(ck.green(packname+' install'))
|
|
119
|
+
return
|
|
102
120
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
121
|
+
countdown.stop()
|
|
122
|
+
clear()
|
|
123
|
+
figlet('TMUI OK!!', function(err, data) {
|
|
124
|
+
if (err) {
|
|
125
|
+
console.log('Something went wrong...');
|
|
126
|
+
console.dir(err);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
console.log(ck.bgGreen(data))
|
|
130
|
+
console.log(ck.green(`---------------------------------------------------`))
|
|
131
|
+
console.log(ck.green(`---------------------------------------------------`))
|
|
132
|
+
console.log(ck.green('安装成功请执行uni cli命令,编译一个H5项目试:'))
|
|
133
|
+
console.log(ck.green(`请切换到你的项目目录: cd ${filename}`))
|
|
134
|
+
console.log(ck.green('再执行: '+packname+' run dev:h5'))
|
|
135
|
+
|
|
136
|
+
})
|
|
137
|
+
})
|
|
138
|
+
installNpm.stdout?.on("data",(msg)=>{
|
|
139
|
+
console.log(msg.toString('utf8'))
|
|
109
140
|
})
|
|
110
141
|
|
|
111
|
-
}
|
|
142
|
+
}
|
|
143
|
+
|
|
112
144
|
|
|
113
|
-
|
|
114
|
-
console.log(msg.toString('utf8'))
|
|
115
|
-
})
|
|
145
|
+
|
|
116
146
|
|
|
117
147
|
}).catch(err=>{
|
|
118
148
|
countdown.stop()
|
package/src/create4xhbx.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
const chalk = import("chalk")
|
|
2
|
-
const path = require("path")
|
|
3
|
-
const {
|
|
4
|
-
Command
|
|
5
|
-
} = require('commander');
|
|
6
|
-
const fs = require("fs")
|
|
7
|
-
const ft = import("node-fetch")
|
|
8
|
-
const compressing = require("compressing")
|
|
9
|
-
const chilPro = require("child_process")
|
|
10
|
-
var clear = require('clear');
|
|
11
|
-
var figlet = require('figlet');
|
|
12
|
-
const program = new Command();
|
|
13
|
-
const inquirer = import("inquirer")
|
|
14
|
-
var CLI = require('clui'),
|
|
15
|
-
Spinner = CLI.Spinner;
|
|
16
|
-
const delFile = require("./util").default.delFile
|
|
17
|
-
|
|
18
|
-
// https://cdn.tmui.design/tmui4.0/tmui4.0xhbxModel.zip
|
|
19
|
-
exports.run = function(type, name, vr, packname) {
|
|
20
|
-
chalk.then(v => {
|
|
21
|
-
clear()
|
|
22
|
-
const ck = new v.Chalk();
|
|
23
|
-
const nowPath = path.resolve('./');
|
|
1
|
+
const chalk = import("chalk")
|
|
2
|
+
const path = require("path")
|
|
3
|
+
const {
|
|
4
|
+
Command
|
|
5
|
+
} = require('commander');
|
|
6
|
+
const fs = require("fs")
|
|
7
|
+
const ft = import("node-fetch")
|
|
8
|
+
const compressing = require("compressing")
|
|
9
|
+
const chilPro = require("child_process")
|
|
10
|
+
var clear = require('clear');
|
|
11
|
+
var figlet = require('figlet');
|
|
12
|
+
const program = new Command();
|
|
13
|
+
const inquirer = import("inquirer")
|
|
14
|
+
var CLI = require('clui'),
|
|
15
|
+
Spinner = CLI.Spinner;
|
|
16
|
+
const delFile = require("./util").default.delFile
|
|
17
|
+
|
|
18
|
+
// https://cdn.tmui.design/tmui4.0/tmui4.0xhbxModel.zip
|
|
19
|
+
exports.run = function(type, name, vr, packname,filename) {
|
|
20
|
+
chalk.then(v => {
|
|
21
|
+
clear()
|
|
22
|
+
const ck = new v.Chalk();
|
|
23
|
+
const nowPath = path.resolve('./');
|
|
24
24
|
console.log(ck.white('不 要 关闭窗体,正在创建中....'))
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
inquirer.then(ivk => {
|
|
27
27
|
function build(fname){
|
|
28
28
|
let filemul = path.join(nowPath, fname)
|
|
@@ -90,9 +90,9 @@ exports.run = function(type, name, vr, packname) {
|
|
|
90
90
|
});
|
|
91
91
|
}else{
|
|
92
92
|
build(packname)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
})
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
})
|
|
98
98
|
}
|
package/src/createHbx.js
CHANGED
|
@@ -10,11 +10,12 @@ var CLI = require('clui'),
|
|
|
10
10
|
Spinner = CLI.Spinner;
|
|
11
11
|
const delFile = require("./util").default.delFile
|
|
12
12
|
var countdown = new Spinner('请等待... ', ['/','\\','/','\\']);
|
|
13
|
-
exports.run = function(type, name,vr,packname="npm") {
|
|
13
|
+
exports.run = function(type, name,vr,packname="npm",filename) {
|
|
14
14
|
chalk.then(v=>{
|
|
15
15
|
clear()
|
|
16
16
|
const ck = new v.Chalk();
|
|
17
|
-
const nowPath = path.resolve('./');
|
|
17
|
+
const nowPath = path.join(path.resolve('./'),filename);
|
|
18
|
+
var vrNumber = 0
|
|
18
19
|
console.log(ck.bgBlue('不 要 关闭窗体,正在创建中....'))
|
|
19
20
|
let userInputVer = "";
|
|
20
21
|
if(vr!=null){
|
|
@@ -33,7 +34,13 @@ exports.run = function(type, name,vr,packname="npm") {
|
|
|
33
34
|
userInputVer = typeof userInputVer=='undefined'?"":userInputVer
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
+
vrNumber = parseInt(userInputVer.replace(/\./g,''))
|
|
38
|
+
if(isNaN(vrNumber)){
|
|
39
|
+
console.log(ck.red("没有输入版本号"))
|
|
40
|
+
}
|
|
41
|
+
if(!fs.existsSync(nowPath)){
|
|
42
|
+
fs.mkdirSync(nowPath);
|
|
43
|
+
}
|
|
37
44
|
ft.then((fah)=>{
|
|
38
45
|
const fetch = fah.default
|
|
39
46
|
|
|
@@ -63,11 +70,19 @@ exports.run = function(type, name,vr,packname="npm") {
|
|
|
63
70
|
.then(revalue=>{
|
|
64
71
|
//创建tmui目录
|
|
65
72
|
let tmuipath = path.join(nowPath,'tmui');
|
|
73
|
+
if(vrNumber>=320){
|
|
74
|
+
tmuipath = path.join(nowPath,'uni_modules');
|
|
75
|
+
if(!fs.existsSync(tmuipath)){
|
|
76
|
+
fs.mkdirSync(tmuipath);
|
|
77
|
+
}
|
|
78
|
+
tmuipath = path.join(nowPath,'uni_modules','tm-ui');
|
|
79
|
+
}
|
|
66
80
|
if(!fs.existsSync(tmuipath)){
|
|
67
81
|
fs.mkdirSync(tmuipath);
|
|
68
82
|
}else{
|
|
69
83
|
delFile(tmuipath)
|
|
70
84
|
}
|
|
85
|
+
|
|
71
86
|
countdown.start()
|
|
72
87
|
//下载tmui
|
|
73
88
|
let donloadTmui = `https://cdn.tmui.design/public/static/tmui${ver}.zip`
|
|
@@ -99,7 +114,6 @@ exports.run = function(type, name,vr,packname="npm") {
|
|
|
99
114
|
}
|
|
100
115
|
console.log(ck.bgGreen(data))
|
|
101
116
|
console.log(ck.green(`---------------------------------------------------`))
|
|
102
|
-
console.log(ck.red(`截止3.5.4 hbx版本号,运行到浏览器会报错,其它平台没问题。这是uni的bug。但cli模式不会有问题。`))
|
|
103
117
|
console.log(ck.bgGreen('安装成功,请使用hbx导入项目,运行本项目。'))
|
|
104
118
|
})
|
|
105
119
|
|
package/src/rcli.js
CHANGED
|
@@ -10,10 +10,11 @@ var CLI = require('clui'),
|
|
|
10
10
|
Spinner = CLI.Spinner;
|
|
11
11
|
var countdown = new Spinner('请等待... ', ['/','\\','/','\\']);
|
|
12
12
|
const delFile = require("./util").default.delFile
|
|
13
|
-
exports.run = function(type, name,vr,packname="npm") {
|
|
13
|
+
exports.run = function(type, name,vr,packname="npm",filename="") {
|
|
14
14
|
chalk.then(v=>{
|
|
15
15
|
const ck = new v.Chalk();
|
|
16
|
-
const nowPath = path.resolve('./');
|
|
16
|
+
const nowPath = path.join(path.resolve('./'),filename);
|
|
17
|
+
var vrNumber = 0
|
|
17
18
|
console.log(ck.bgBlue('不 要 关闭窗体,正在创建中....'))
|
|
18
19
|
let userInputVer = "";
|
|
19
20
|
if(vr!=null){
|
|
@@ -32,6 +33,13 @@ exports.run = function(type, name,vr,packname="npm") {
|
|
|
32
33
|
userInputVer = typeof userInputVer=='undefined'?"":userInputVer
|
|
33
34
|
}
|
|
34
35
|
}
|
|
36
|
+
vrNumber = parseInt(userInputVer.replace(/\./g,''))
|
|
37
|
+
if(isNaN(vrNumber)){
|
|
38
|
+
console.log(ck.red("没有输入版本号"))
|
|
39
|
+
}
|
|
40
|
+
if(!fs.existsSync(nowPath)){
|
|
41
|
+
fs.mkdirSync(nowPath);
|
|
42
|
+
}
|
|
35
43
|
ft.then((fah)=>{
|
|
36
44
|
const fetch = fah.default
|
|
37
45
|
|
|
@@ -56,7 +64,16 @@ exports.run = function(type, name,vr,packname="npm") {
|
|
|
56
64
|
console.log(ck.bgRed('非cli项目,请使用rhbx项目'))
|
|
57
65
|
return
|
|
58
66
|
}
|
|
67
|
+
//创建tmui目录
|
|
59
68
|
let tmuipath = path.join(nowPath,'src','tmui');
|
|
69
|
+
if(vrNumber>=320){
|
|
70
|
+
tmuipath = path.join(nowPath,'src','uni_modules');
|
|
71
|
+
if(!fs.existsSync(tmuipath)){
|
|
72
|
+
fs.mkdirSync(tmuipath);
|
|
73
|
+
}
|
|
74
|
+
tmuipath = path.join(nowPath,'src','uni_modules','tm-ui');
|
|
75
|
+
}
|
|
76
|
+
|
|
60
77
|
if(!fs.existsSync(tmuipath)){
|
|
61
78
|
fs.mkdirSync(tmuipath);
|
|
62
79
|
}else{
|
package/src/rhbx.js
CHANGED
|
@@ -11,11 +11,12 @@ Spinner = CLI.Spinner;
|
|
|
11
11
|
const delFile = require("./util").default.delFile
|
|
12
12
|
|
|
13
13
|
var countdown = new Spinner('请等待... ', ['/','\\','/','\\']);
|
|
14
|
-
exports.run = function(type, name,vr,packname="npm") {
|
|
14
|
+
exports.run = function(type, name,vr,packname="npm",filename) {
|
|
15
15
|
chalk.then(v=>{
|
|
16
16
|
clear()
|
|
17
17
|
const ck = new v.Chalk();
|
|
18
|
-
const nowPath = path.resolve('./');
|
|
18
|
+
const nowPath = path.join(path.resolve('./'),filename);
|
|
19
|
+
var vrNumber = 0
|
|
19
20
|
console.log(ck.bgBlue('不 要 关闭窗体,正在创建中....'))
|
|
20
21
|
let userInputVer = "";
|
|
21
22
|
if(vr!=null){
|
|
@@ -35,28 +36,25 @@ exports.run = function(type, name,vr,packname="npm") {
|
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
let txt = require('./router').txt;
|
|
43
|
-
fs.writeFileSync(path.join(nowPath,'router','index.ts'),txt)
|
|
39
|
+
vrNumber = parseInt(userInputVer.replace(/\./g,''))
|
|
40
|
+
if(isNaN(vrNumber)){
|
|
41
|
+
console.log(ck.red("没有输入版本号"))
|
|
44
42
|
}
|
|
45
|
-
if(!fs.existsSync(
|
|
46
|
-
|
|
47
|
-
fs.mkdirSync(path.join(nowPath,'theme'));
|
|
48
|
-
}
|
|
49
|
-
let txt = require('./theme').txt;
|
|
50
|
-
fs.writeFileSync(path.join(nowPath,'theme','index.ts'),txt)
|
|
43
|
+
if(!fs.existsSync(nowPath)){
|
|
44
|
+
fs.mkdirSync(nowPath);
|
|
51
45
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// 检查是否有router目录?
|
|
55
|
-
// fs.existsSync(path.join(nowPath,'router','index.ts'))
|
|
46
|
+
|
|
56
47
|
ft.then((fah)=>{
|
|
57
48
|
const fetch = fah.default
|
|
58
49
|
//创建tmui目录
|
|
59
50
|
let tmuipath = path.join(nowPath,'tmui');
|
|
51
|
+
if(vrNumber>=320){
|
|
52
|
+
tmuipath = path.join(nowPath,'uni_modules');
|
|
53
|
+
if(!fs.existsSync(tmuipath)){
|
|
54
|
+
fs.mkdirSync(tmuipath);
|
|
55
|
+
}
|
|
56
|
+
tmuipath = path.join(nowPath,'uni_modules','tm-ui');
|
|
57
|
+
}
|
|
60
58
|
if(!fs.existsSync(tmuipath)){
|
|
61
59
|
fs.mkdirSync(tmuipath);
|
|
62
60
|
}else{
|
|
@@ -111,7 +109,6 @@ exports.run = function(type, name,vr,packname="npm") {
|
|
|
111
109
|
}
|
|
112
110
|
console.log(ck.bgGreen(data))
|
|
113
111
|
console.log(ck.green(`---------------------------------------------------`))
|
|
114
|
-
console.log(ck.red(`截止3.5.4 hbx版本号,运行到浏览器会报错,其它平台没问题。这是uni的bug。但cli模式不会有问题。`))
|
|
115
112
|
console.log(ck.bgGreen('安装成功,请使用hbx导入项目,运行本项目。'))
|
|
116
113
|
})
|
|
117
114
|
|