cloudcc-cli 2.0.2 → 2.0.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 +15 -0
- package/package.json +1 -1
- package/src/plugin/publish1.js +3 -3
- package/utils/config.js +5 -6
- package/utils/utils.js +21 -13
package/README.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# ReleaseV2.0.4
|
|
2
|
+
#### Release Date: 2025-4-8
|
|
3
|
+
#### Release Scope: Full
|
|
4
|
+
#### Release Content
|
|
5
|
+
* Optimization
|
|
6
|
+
* Optimize the plugin token acquisition logic to ensure that tokens are requested only in non-private versions
|
|
7
|
+
|
|
8
|
+
# ReleaseV2.0.3
|
|
9
|
+
#### Release Date: 2025-4-8
|
|
10
|
+
#### Release Scope: Full
|
|
11
|
+
#### Release Content
|
|
12
|
+
* Optimization
|
|
13
|
+
* Added CloudCCDev field initialization for configuration files and optimized error handling for obtaining plugin tokens
|
|
14
|
+
|
|
15
|
+
|
|
1
16
|
# ReleaseV2.0.2
|
|
2
17
|
#### Release Date: 2025-4-2
|
|
3
18
|
#### Release Scope: Full
|
package/package.json
CHANGED
package/src/plugin/publish1.js
CHANGED
|
@@ -24,9 +24,9 @@ class Builder {
|
|
|
24
24
|
let res = await checkUpdate();
|
|
25
25
|
if (!res) {
|
|
26
26
|
this.options.devConsoleConfig = await getPackageJson();
|
|
27
|
+
this.options.devConsoleConfig.CloudCCDev = "";
|
|
27
28
|
this.options.pluginConfig = JSON.parse(fs.readFileSync(path.join(process.cwd(), `plugins/${name}/config.json`), 'utf8'));
|
|
28
29
|
let config = this.options.devConsoleConfig
|
|
29
|
-
|
|
30
30
|
if ("private" != this.options.devConsoleConfig.version) {
|
|
31
31
|
config = { "accessToken": this.options.devConsoleConfig.pluginToken || await this.getToken(config) };
|
|
32
32
|
}
|
|
@@ -65,7 +65,7 @@ class Builder {
|
|
|
65
65
|
return cache[cacheKey].token;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
let res = await post((this.options.devConsoleConfig.baseUrl || BaseUrl) + "/sysconfig/auth/pc/1.0/post/tokenInfo", devConsoleConfig);
|
|
68
|
+
let res = await post((this.options.devConsoleConfig.baseUrl || BaseUrl) + "/sysconfig/auth/pc/1.0/post/tokenInfo", { username: devConsoleConfig.username, secretKey: devConsoleConfig.secretKey });
|
|
69
69
|
if (res.returnCode == 200) {
|
|
70
70
|
cache[cacheKey] = {
|
|
71
71
|
token: res.data.accessToken,
|
|
@@ -274,7 +274,7 @@ class Builder {
|
|
|
274
274
|
console.error(chalk.green(`Success!`));
|
|
275
275
|
console.log();
|
|
276
276
|
} else {
|
|
277
|
-
console.error(chalk.red(`Publish Plugin Fail: ${res
|
|
277
|
+
console.error(chalk.red(`Publish Plugin Fail: ${JSON.stringify(res)}`));
|
|
278
278
|
console.log();
|
|
279
279
|
}
|
|
280
280
|
return res;
|
package/utils/config.js
CHANGED
|
@@ -21,9 +21,7 @@ function getPackageJson_old(projectPath = process.cwd()) {
|
|
|
21
21
|
async function getPackageJson2(projectPath = process.cwd()) {
|
|
22
22
|
let config = require(path.join(projectPath, "cloudcc-cli.config.js"))
|
|
23
23
|
config = config[config.use]
|
|
24
|
-
|
|
25
|
-
// config.baseUrl = config.baseUrl + "/ccdomaingateway"
|
|
26
|
-
// }
|
|
24
|
+
config.CloudCCDev = "";
|
|
27
25
|
config = await getDevConsoleConfig(projectPath, config)
|
|
28
26
|
return config
|
|
29
27
|
}
|
|
@@ -40,10 +38,11 @@ async function getPackageJson3(projectPath = process.cwd()) {
|
|
|
40
38
|
if (config && config.CloudCCDev) {
|
|
41
39
|
const decryptedInfo = decryptCloudCCDevInfo(config.CloudCCDev);
|
|
42
40
|
if (decryptedInfo) {
|
|
41
|
+
if (decryptedInfo.baseUrl && !decryptedInfo.baseUrl.includes("ccdomaingateway")) {
|
|
42
|
+
decryptedInfo.baseUrl = decryptedInfo.baseUrl + "/ccdomaingateway"
|
|
43
|
+
}
|
|
43
44
|
config = { ...decryptedInfo, ...config }
|
|
44
|
-
|
|
45
|
-
// config.baseUrl = config.baseUrl + "/ccdomaingateway"
|
|
46
|
-
// }
|
|
45
|
+
config.CloudCCDev = "";
|
|
47
46
|
config = await getDevConsoleConfig(projectPath, config)
|
|
48
47
|
}
|
|
49
48
|
} else {
|
package/utils/utils.js
CHANGED
|
@@ -43,18 +43,24 @@ async function getBaseUrl(config) {
|
|
|
43
43
|
* @returns config
|
|
44
44
|
*/
|
|
45
45
|
async function getPluginToken(config) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
const url = (config.baseUrl || BaseUrl) + "/sysconfig/auth/pc/1.0/post/tokenInfo";
|
|
47
|
+
try {
|
|
48
|
+
let res = await axios({
|
|
49
|
+
method: 'post',
|
|
50
|
+
url,
|
|
51
|
+
data: formateData({ username: config.username, secretKey: config.secretKey }),
|
|
52
|
+
headers: {
|
|
53
|
+
'Content-Type': 'application/json; charset=utf-8',
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
if (res.data.returnCode == 200) {
|
|
57
|
+
config.pluginToken = res.data.data.accessToken;
|
|
58
|
+
} else {
|
|
59
|
+
console.error(chalk.red(`Get Plugin Token Failed:`, res.data.returnInfo, "\nPrivate cloud, please check whether the baseUrl is configured correctly\n" + url));
|
|
60
|
+
process.exit(1)
|
|
61
|
+
}
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error(chalk.red(`Get Plugin Token Failed:`, error, "\nPrivate cloud, please check whether the baseUrl is configured correctly\n" + url));
|
|
58
64
|
process.exit(1)
|
|
59
65
|
}
|
|
60
66
|
return config
|
|
@@ -122,7 +128,9 @@ async function getDevConsoleConfig(projectPath = process.cwd(), config) {
|
|
|
122
128
|
config = await getBaseUrl(config);
|
|
123
129
|
config = await getBusToken(config);
|
|
124
130
|
config = await getSecretKey(config);
|
|
125
|
-
|
|
131
|
+
if ("private" != config.version) {
|
|
132
|
+
config = await getPluginToken(config);
|
|
133
|
+
}
|
|
126
134
|
config.timestamp = Date.now();
|
|
127
135
|
writeCache(projectPath, { [config.safetyMark || config.secretKey]: config })
|
|
128
136
|
return config;
|