easy-soft-develop 2.0.151 → 2.0.153
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.153",
|
|
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
|
@@ -8,23 +8,57 @@ const {
|
|
|
8
8
|
const { loopPackage } = require('./package.tools');
|
|
9
9
|
|
|
10
10
|
function adjustMainPackageJson(command) {
|
|
11
|
+
promptInfo(`clean main: ${command}`);
|
|
12
|
+
|
|
11
13
|
exec(command);
|
|
12
14
|
}
|
|
13
15
|
|
|
16
|
+
function tryCleanChildrenPackage(cmd, tryTimes) {
|
|
17
|
+
if (tryTimes > 5) {
|
|
18
|
+
promptInfo(`clean package fail, ignore`);
|
|
19
|
+
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (tryTimes > 1) {
|
|
24
|
+
promptInfo(`retry time ${tryTimes}`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
exec(cmd);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
tryTimes = tryTimes + 1;
|
|
31
|
+
|
|
32
|
+
tryCleanChildrenPackage(cmd, tryTimes);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
14
36
|
function adjustChildrenPackageJson(command) {
|
|
15
|
-
loopPackage(({ name }) => {
|
|
16
|
-
|
|
37
|
+
loopPackage(({ name, relativePath }) => {
|
|
38
|
+
const cmd = `cd ${relativePath} && ${command}`;
|
|
39
|
+
|
|
40
|
+
promptInfo(`clean package ${name}: ${cmd}`);
|
|
41
|
+
|
|
42
|
+
let tryTimes = 1;
|
|
43
|
+
|
|
44
|
+
tryCleanChildrenPackage(cmd, tryTimes);
|
|
17
45
|
});
|
|
18
46
|
}
|
|
19
47
|
|
|
20
48
|
function clean(preCmd, ...targets) {
|
|
49
|
+
promptInfo(
|
|
50
|
+
'clean use rimraf, ensure rimraf is installed, install it use "npm install -g rimraf"',
|
|
51
|
+
);
|
|
52
|
+
|
|
21
53
|
try {
|
|
22
|
-
const list = targets
|
|
54
|
+
const list = [...targets];
|
|
55
|
+
|
|
56
|
+
list.push('node_modules');
|
|
23
57
|
|
|
24
58
|
const command = list
|
|
25
59
|
.map((o) => {
|
|
26
60
|
if (o) {
|
|
27
|
-
return `
|
|
61
|
+
return `rimraf ./${o}`;
|
|
28
62
|
}
|
|
29
63
|
return '';
|
|
30
64
|
})
|
|
@@ -34,6 +68,8 @@ function clean(preCmd, ...targets) {
|
|
|
34
68
|
promptEmptyLine();
|
|
35
69
|
|
|
36
70
|
if (preCmd) {
|
|
71
|
+
promptInfo(`clean by command: ${preCmd}`);
|
|
72
|
+
|
|
37
73
|
exec(preCmd);
|
|
38
74
|
}
|
|
39
75
|
|