tmui-cli 1.1.4 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/create.js +39 -26
package/package.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "scripts": {
67
67
  "run": "node ./bin/tmui.js"
68
68
  },
69
- "version": "1.1.4"
69
+ "version": "1.1.5"
70
70
  }
package/src/create.js CHANGED
@@ -100,36 +100,49 @@ exports.run = function(type, name,vr,packname="npm",filename="") {
100
100
  fs.unlinkSync(path.join(nowPath,'cli.zip'))
101
101
  }
102
102
  countdown.message(ck.green('正在安装依赖'))
103
- const installNpm = chilPro.exec(packname+' install',(error, stdout, stderr)=>{
104
-
105
- if(error){
106
- countdown.stop()
107
- console.log('安装失败,请在当前目录手动安装依赖文件执行:',ck.bgRed(error))
108
- console.log(ck.green(packname+' install'))
109
- return
110
- }
111
- countdown.stop()
112
- clear()
113
- figlet('TMUI OK!!', function(err, data) {
114
- if (err) {
115
- console.log('Something went wrong...');
116
- console.dir(err);
117
- return;
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
118
120
  }
119
- console.log(ck.bgGreen(data))
120
- console.log(ck.green(`---------------------------------------------------`))
121
- console.log(ck.green(`---------------------------------------------------`))
122
- console.log(ck.green('安装成功请执行uni cli命令,编译一个H5项目试:'))
123
- console.log(ck.green(`请切换到你的项目目录: cd ${filename}`))
124
- console.log(ck.green('再执行: '+packname+' run dev:h5'))
125
-
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'))
126
140
  })
127
141
 
128
- })
142
+ }
143
+
129
144
 
130
- installNpm.stdout?.on("data",(msg)=>{
131
- console.log(msg.toString('utf8'))
132
- })
145
+
133
146
 
134
147
  }).catch(err=>{
135
148
  countdown.stop()