easy-soft-develop 2.0.152 → 2.0.154
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/package.json +1 -2
- package/src/tools/clean.js +40 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easy-soft-develop",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.154",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://github.com/kityandhero/easy-soft-develop#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -59,7 +59,6 @@
|
|
|
59
59
|
"fs-extra": "^11.1.0",
|
|
60
60
|
"hpagent": "^1.2.0",
|
|
61
61
|
"ping": "^0.4.2",
|
|
62
|
-
"rimraf": "^4.1.2",
|
|
63
62
|
"shelljs": "^0.8.5",
|
|
64
63
|
"terminal-kit": "^3.0.0"
|
|
65
64
|
},
|
package/src/tools/clean.js
CHANGED
|
@@ -7,17 +7,51 @@ const {
|
|
|
7
7
|
} = require('./meta');
|
|
8
8
|
const { loopPackage } = require('./package.tools');
|
|
9
9
|
|
|
10
|
+
function tryClean(cmd, tryTimes) {
|
|
11
|
+
if (tryTimes > 5) {
|
|
12
|
+
promptInfo(`clean fail, ignore`);
|
|
13
|
+
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (tryTimes > 1) {
|
|
18
|
+
promptInfo(`retry time ${tryTimes}`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
exec(cmd);
|
|
23
|
+
} catch (error) {
|
|
24
|
+
tryTimes = tryTimes + 1;
|
|
25
|
+
|
|
26
|
+
tryClean(cmd, tryTimes);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
10
30
|
function adjustMainPackageJson(command) {
|
|
11
|
-
|
|
31
|
+
promptInfo(`clean main: ${command}`);
|
|
32
|
+
|
|
33
|
+
let tryTimes = 1;
|
|
34
|
+
|
|
35
|
+
tryClean(command, tryTimes);
|
|
12
36
|
}
|
|
13
37
|
|
|
14
38
|
function adjustChildrenPackageJson(command) {
|
|
15
|
-
loopPackage(({ name }) => {
|
|
16
|
-
|
|
39
|
+
loopPackage(({ name, relativePath }) => {
|
|
40
|
+
const cmd = `cd ${relativePath} && ${command}`;
|
|
41
|
+
|
|
42
|
+
promptInfo(`clean package ${name}: ${cmd}`);
|
|
43
|
+
|
|
44
|
+
let tryTimes = 1;
|
|
45
|
+
|
|
46
|
+
tryClean(cmd, tryTimes);
|
|
17
47
|
});
|
|
18
48
|
}
|
|
19
49
|
|
|
20
50
|
function clean(preCmd, ...targets) {
|
|
51
|
+
promptInfo(
|
|
52
|
+
'clean use rimraf, ensure rimraf is installed, install it use "npm install -g rimraf"',
|
|
53
|
+
);
|
|
54
|
+
|
|
21
55
|
try {
|
|
22
56
|
const list = [...targets];
|
|
23
57
|
|
|
@@ -26,7 +60,7 @@ function clean(preCmd, ...targets) {
|
|
|
26
60
|
const command = list
|
|
27
61
|
.map((o) => {
|
|
28
62
|
if (o) {
|
|
29
|
-
return `
|
|
63
|
+
return `rimraf ./${o}`;
|
|
30
64
|
}
|
|
31
65
|
return '';
|
|
32
66
|
})
|
|
@@ -36,6 +70,8 @@ function clean(preCmd, ...targets) {
|
|
|
36
70
|
promptEmptyLine();
|
|
37
71
|
|
|
38
72
|
if (preCmd) {
|
|
73
|
+
promptInfo(`clean by command: ${preCmd}`);
|
|
74
|
+
|
|
39
75
|
exec(preCmd);
|
|
40
76
|
}
|
|
41
77
|
|