cloudcc-cli 1.5.1 → 1.5.2
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/src/builderPlugin.js +0 -16
- package/src/creatorTemProject.js +5 -5
- package/utils/checkVersion.js +8 -8
package/README.md
CHANGED
package/package.json
CHANGED
package/src/builderPlugin.js
CHANGED
|
@@ -26,7 +26,6 @@ class Builder {
|
|
|
26
26
|
if (!res) {
|
|
27
27
|
this.options.devConsoleConfig = this.getPackageJson();
|
|
28
28
|
let config = this.options.devConsoleConfig
|
|
29
|
-
// await this.getSecretKey(config.username)
|
|
30
29
|
// 如果不是私有化部署,那么需要获取token
|
|
31
30
|
if ("private" != this.options.devConsoleConfig.version) { // private私有化
|
|
32
31
|
config = { "accessToken": await this.getToken(config) };
|
|
@@ -75,21 +74,6 @@ class Builder {
|
|
|
75
74
|
const packageJson = JSON.parse(fs.readFileSync("package.json", 'utf8'));
|
|
76
75
|
return packageJson.devConsoleConfig; // cloudcc-plugin 中的 devConsoleConfig
|
|
77
76
|
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* 通过用户名获取密钥
|
|
81
|
-
* @param {string} username 用户名
|
|
82
|
-
*/
|
|
83
|
-
async getSecretKey(username) {
|
|
84
|
-
let res = await axios.post(this.options.devConsoleConfig.baseUrl || BaseUrl + "/sysconfig/auth/secretkey/get", { username }, {
|
|
85
|
-
timeout: 60000,
|
|
86
|
-
headers: {
|
|
87
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
88
|
-
},
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
console.log("res", JSON.stringify(res))
|
|
92
|
-
}
|
|
93
77
|
/**
|
|
94
78
|
* 请求用户token
|
|
95
79
|
* @param {用户信息} devConsoleConfig
|
package/src/creatorTemProject.js
CHANGED
|
@@ -68,12 +68,12 @@ class Creator {
|
|
|
68
68
|
console.log(chalk.green("开始构建,请稍后"));
|
|
69
69
|
const tplBuilder = require("../template/index");
|
|
70
70
|
tplBuilder(this, this.options, () => {
|
|
71
|
+
// console.log();
|
|
72
|
+
// console.log(chalk.green('安装依赖'));
|
|
73
|
+
// let os = process.platform
|
|
74
|
+
// exec(`cd ${this.options.name} && ${'darwin' == os ? 'sudo' : ''} npm install --registry http://registry.npmmirror.com && code . `)
|
|
71
75
|
console.log();
|
|
72
|
-
console.log(chalk.green('
|
|
73
|
-
let os = process.platform
|
|
74
|
-
exec(`cd ${this.options.name} && ${'darwin' == os ? 'sudo' : ''} npm install --registry http://registry.npmmirror.com && code . `)
|
|
75
|
-
console.log();
|
|
76
|
-
console.log(chalk.green('构建完成'))
|
|
76
|
+
console.log(chalk.green('构建完成,运行前请安装依赖'))
|
|
77
77
|
})
|
|
78
78
|
}
|
|
79
79
|
|
package/utils/checkVersion.js
CHANGED
|
@@ -12,16 +12,16 @@ function checkNpmVersion() {
|
|
|
12
12
|
let onlineVersionNum
|
|
13
13
|
let onlineVersion = '0.0.1'
|
|
14
14
|
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
// 从阿里源获取版本号
|
|
16
|
+
onlineVersion = exec(`npm view cloudcc-cli version --registry http://registry.npmmirror.com`)
|
|
17
|
+
onlineVersion = onlineVersion.toString("utf8").trim();
|
|
18
18
|
|
|
19
19
|
// 从阿里源获取版本号
|
|
20
|
-
try {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} catch (e) {
|
|
24
|
-
}
|
|
20
|
+
// try {
|
|
21
|
+
// onlineVersion = exec(`curl -s https://npmmirror.com/api/info?pkgName=cloudcc-cli`)
|
|
22
|
+
// onlineVersion = JSON.parse(onlineVersion.toString("utf8").trim()).data['dist-tags'].latest
|
|
23
|
+
// } catch (e) {
|
|
24
|
+
// }
|
|
25
25
|
onlineVersionNum = Number(onlineVersion.replace(/\./g, ""));
|
|
26
26
|
|
|
27
27
|
console.log(chalk.green(
|