crabatool 1.0.42 → 1.0.48
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/index.js +11 -4
- package/package.json +1 -1
- package/test/test.js +1 -1
package/index.js
CHANGED
|
@@ -23,6 +23,8 @@ module.exports.run = function(options) {
|
|
|
23
23
|
return start();
|
|
24
24
|
} else if (arr.includes('-mergeinitjs')) {
|
|
25
25
|
return mergeInit();
|
|
26
|
+
} else if (arr.includes('-update')) {
|
|
27
|
+
return upgrade.updateCraba();
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
|
|
@@ -66,6 +68,11 @@ function checkConfig() {
|
|
|
66
68
|
throw new Error('请检查craba.js,必须告诉工具当前项目前端服务器端口地址哦');
|
|
67
69
|
}
|
|
68
70
|
|
|
71
|
+
// 支持相对路径
|
|
72
|
+
if (!path.isAbsolute(config.webPath)) {
|
|
73
|
+
config.webPath = path.join(process.cwd(), config.webPath);
|
|
74
|
+
}
|
|
75
|
+
|
|
69
76
|
if (!fs.existsSync(config.webPath)) {
|
|
70
77
|
throw new Error(`请检查craba.js,配置的webPath路径不存在,请检查拼写是否正确:${config.webPath}`);;
|
|
71
78
|
}
|
|
@@ -81,16 +88,16 @@ function checkConfig() {
|
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
|
|
84
|
-
async function waitFolder() {
|
|
91
|
+
async function waitFolder(question) {
|
|
85
92
|
const projectPath = await question('请输入项目生成路径(必须为空路径):');
|
|
86
93
|
if (!path.isAbsolute(projectPath)) {
|
|
87
94
|
console.log('路径不合法,请输入绝对路径,如:f:\\craba_web');
|
|
88
|
-
return waitFolder();
|
|
95
|
+
return waitFolder(question);
|
|
89
96
|
}
|
|
90
97
|
if (fs.existsSync(projectPath)) {
|
|
91
98
|
if (fs.readdirSync(projectPath).length > 0) {
|
|
92
99
|
console.log(':::输入的项目路径不为空,避免文件覆盖或冲突,请重新输入一个空路径或不存在的路径:::');
|
|
93
|
-
return waitFolder();
|
|
100
|
+
return waitFolder(question);
|
|
94
101
|
}
|
|
95
102
|
}
|
|
96
103
|
return projectPath;
|
|
@@ -148,7 +155,7 @@ function waitInput() {
|
|
|
148
155
|
installvscode();
|
|
149
156
|
} else if (num == 8) {
|
|
150
157
|
var options = {};
|
|
151
|
-
options.projectPath = await waitFolder();
|
|
158
|
+
options.projectPath = await waitFolder(question);
|
|
152
159
|
options.type = await question('选择项目类型:1. 普通craba项目; 2. ngp微前端项目; 输入编号:');
|
|
153
160
|
if (options.type != 1 && options.type != 2) options.type = 1;
|
|
154
161
|
if (options.type == 2) {
|
package/package.json
CHANGED
package/test/test.js
CHANGED
|
@@ -9,7 +9,7 @@ var crabaTool = require('../index.js'); // 引入craba脚手架工具包
|
|
|
9
9
|
var config = {
|
|
10
10
|
//【必填】
|
|
11
11
|
// 告诉工具当前项目的端路径地址,填绝对路径哦
|
|
12
|
-
webPath: "
|
|
12
|
+
webPath: "../web/src/main/resources/static/shell",
|
|
13
13
|
|
|
14
14
|
//【必填】
|
|
15
15
|
// 告诉工具当前项目前端服务器端口地址
|