@fastcar/cli 0.0.3 → 0.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/bin/cli.js +1 -1
- package/package.json +1 -1
- package/src/init.js +14 -7
package/bin/cli.js
CHANGED
package/package.json
CHANGED
package/src/init.js
CHANGED
|
@@ -9,7 +9,10 @@ const WEBTEMPLATEURL =
|
|
|
9
9
|
"https://e.coding.net/william_zhong/fast-car/fastcar-boot-web.git"; //web模板
|
|
10
10
|
const RPCTEMPLATEURL =
|
|
11
11
|
"https://e.coding.net/william_zhong/fast-car/fastcar-boot-rpc.git"; //rpc模板
|
|
12
|
-
|
|
12
|
+
const COSTEMPLATEURL =
|
|
13
|
+
"https://e.coding.net/william_zhong/fast-car/fastcar-cos.git"; //cos模板
|
|
14
|
+
const MICROTEMPLATE =
|
|
15
|
+
"https://e.coding.net/william_zhong/fast-car/fastcar-microservices.git"; //微服务模板
|
|
13
16
|
const optionComponent = ["mysql", "redis", "mongo"];
|
|
14
17
|
|
|
15
18
|
const Questions = async (defaultName) => {
|
|
@@ -148,6 +151,14 @@ async function init(args = ["web"]) {
|
|
|
148
151
|
downloadUrl = RPCTEMPLATEURL;
|
|
149
152
|
break;
|
|
150
153
|
}
|
|
154
|
+
case "cos": {
|
|
155
|
+
downloadUrl = COSTEMPLATEURL;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
case "micro": {
|
|
159
|
+
downloadUrl = MICROTEMPLATE;
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
151
162
|
default: {
|
|
152
163
|
downloadUrl = WEBTEMPLATEURL;
|
|
153
164
|
break;
|
|
@@ -176,11 +187,6 @@ async function init(args = ["web"]) {
|
|
|
176
187
|
//复制至项目文件下
|
|
177
188
|
utils.copyDirectory(templateDir, currDir);
|
|
178
189
|
|
|
179
|
-
//解压node_modules
|
|
180
|
-
// console.log("unzip node_modules");
|
|
181
|
-
// let nodeModulesPath = path.join(currDir, "node_modules.zip");
|
|
182
|
-
// await utils.unzipFile(nodeModulesPath, currDir);
|
|
183
|
-
|
|
184
190
|
//合并package.json文件
|
|
185
191
|
let templatePackagePath = path.join(templateDir, "package.json");
|
|
186
192
|
if (fs.existsSync(templatePackagePath)) {
|
|
@@ -255,8 +261,8 @@ async function init(args = ["web"]) {
|
|
|
255
261
|
|
|
256
262
|
//更改配置的文件名
|
|
257
263
|
let projectName = packageInfo.name;
|
|
258
|
-
|
|
259
264
|
let pm2RunPath = path.join(currDir, "ecosystem.config.yml");
|
|
265
|
+
|
|
260
266
|
if (fs.existsSync(pm2RunPath)) {
|
|
261
267
|
let pm2Config = utils.readYaml(pm2RunPath);
|
|
262
268
|
pm2Config.apps.name = projectName;
|
|
@@ -266,6 +272,7 @@ async function init(args = ["web"]) {
|
|
|
266
272
|
console.log("clean files");
|
|
267
273
|
setTimeout(() => {
|
|
268
274
|
utils.delDirEctory(templateDir);
|
|
275
|
+
console.log("Please execute npm install before starting");
|
|
269
276
|
}, 1000);
|
|
270
277
|
}
|
|
271
278
|
}
|