cloudcc-cli 1.7.3 → 1.7.4
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/README.md +8 -0
- package/package.json +1 -1
- package/utils/checkVersion.js +19 -23
package/README.md
CHANGED
package/package.json
CHANGED
package/utils/checkVersion.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
const config = require("../package.json")
|
|
3
2
|
const inquirer = require("inquirer")
|
|
4
3
|
const exec = require('child_process').execSync;
|
|
@@ -10,33 +9,29 @@ function checkNpmVersion() {
|
|
|
10
9
|
let onlineVersionNum
|
|
11
10
|
let onlineVersion = '0.0.1'
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
// 获取在线版本
|
|
14
13
|
onlineVersion = exec(`npm view cloudcc-cli version --registry http://registry.npmmirror.com`)
|
|
15
14
|
onlineVersion = onlineVersion.toString("utf8").trim();
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
// 获取发布时间信息
|
|
17
|
+
const timeInfo = exec(`npm view cloudcc-cli time --json --registry http://registry.npmmirror.com`)
|
|
18
|
+
const timeData = JSON.parse(timeInfo.toString().trim());
|
|
19
|
+
const formattedTime = new Date(timeData[onlineVersion]).toLocaleString('zh-CN', {
|
|
20
|
+
year: 'numeric',
|
|
21
|
+
month: '2-digit',
|
|
22
|
+
day: '2-digit'
|
|
23
|
+
});
|
|
24
|
+
|
|
23
25
|
onlineVersionNum = Number(onlineVersion.replace(/\./g, ""));
|
|
24
26
|
|
|
25
|
-
console.log(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* *
|
|
34
|
-
* *
|
|
35
|
-
********************************************************************************
|
|
36
|
-
`
|
|
37
|
-
))
|
|
38
|
-
|
|
39
|
-
|
|
27
|
+
console.log('\n');
|
|
28
|
+
console.log(chalk.bold.cyan(' CloudCC CLI Version\n'));
|
|
29
|
+
console.log(' ' + chalk.gray('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
|
|
30
|
+
console.log(' ' + chalk.green('★') + ' Current Version : ' + chalk.bold.green('v' + config.version));
|
|
31
|
+
console.log(' ' + chalk.blue('★') + ' Latest Version : ' + chalk.bold.blue('v' + onlineVersion));
|
|
32
|
+
console.log(' ' + chalk.yellow('★') + ' Published At : ' + chalk.gray(formattedTime));
|
|
33
|
+
console.log(' ' + chalk.gray('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
34
|
+
|
|
40
35
|
if (onlineVersionNum - currentVersion > 0) {
|
|
41
36
|
return onlineVersion;
|
|
42
37
|
}
|
|
@@ -85,6 +80,7 @@ async function checkUpdate() {
|
|
|
85
80
|
return true;
|
|
86
81
|
} else {
|
|
87
82
|
return false
|
|
83
|
+
|
|
88
84
|
}
|
|
89
85
|
}
|
|
90
86
|
return false
|