@cloudbase/cli 2.9.7 → 2.9.9
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/cloudbase-cli-2.7.8.tgz +0 -0
- package/lib/utils/template-manager.js +33 -0
- package/package.json +2 -2
- package/types/utils/template-manager.d.ts +2 -0
- package/dist/standalone/ccr.js +0 -78668
- package/dist/standalone/cli.js +0 -625935
|
Binary file
|
|
@@ -78,6 +78,9 @@ class TemplateManager {
|
|
|
78
78
|
if (this.isBuiltinTemplate(source)) {
|
|
79
79
|
yield this.downloadBuiltinTemplateToTemp(source, tempDir, log);
|
|
80
80
|
}
|
|
81
|
+
else if (this.isZipUrl(source)) {
|
|
82
|
+
yield this.downloadZipTemplateToTemp(source, tempDir, log);
|
|
83
|
+
}
|
|
81
84
|
else if (this.isGitUrl(source)) {
|
|
82
85
|
const gitInfo = this.parseGitUrl(source);
|
|
83
86
|
yield this.downloadGitTemplateToTemp(gitInfo, tempDir, log);
|
|
@@ -96,6 +99,23 @@ class TemplateManager {
|
|
|
96
99
|
isBuiltinTemplate(source) {
|
|
97
100
|
return Object.keys(BUILTIN_TEMPLATES).includes(source);
|
|
98
101
|
}
|
|
102
|
+
isZipUrl(source) {
|
|
103
|
+
console.log("zip source", source);
|
|
104
|
+
if (!source || typeof source !== 'string') {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
if (!(source.startsWith('http://') || source.startsWith('https://'))) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
try {
|
|
111
|
+
const url = new URL(source);
|
|
112
|
+
const pathname = url.pathname.toLowerCase();
|
|
113
|
+
return pathname.endsWith('.zip');
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
return source.toLowerCase().endsWith('.zip');
|
|
117
|
+
}
|
|
118
|
+
}
|
|
99
119
|
isGitUrl(source) {
|
|
100
120
|
if (!source || typeof source !== 'string') {
|
|
101
121
|
return false;
|
|
@@ -251,6 +271,19 @@ class TemplateManager {
|
|
|
251
271
|
}
|
|
252
272
|
});
|
|
253
273
|
}
|
|
274
|
+
downloadZipTemplateToTemp(zipUrl, tempDir, log) {
|
|
275
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
276
|
+
log.info(`📦 正在下载 zip 文件模板到临时目录: ${zipUrl}`);
|
|
277
|
+
try {
|
|
278
|
+
const { downloadAndExtractRemoteZip } = yield Promise.resolve().then(() => __importStar(require('./tools/common')));
|
|
279
|
+
yield downloadAndExtractRemoteZip(zipUrl, tempDir);
|
|
280
|
+
log.info(`✅ zip 文件模板下载完成到临时目录`);
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
throw new error_1.CloudBaseError(`下载 zip 文件模板失败: ${error.message}`, { original: error });
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
}
|
|
254
287
|
downloadGitTemplateToTemp(gitInfo, tempDir, log) {
|
|
255
288
|
return __awaiter(this, void 0, void 0, function* () {
|
|
256
289
|
const gitUrl = this.buildGitUrl(gitInfo);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cli",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.9",
|
|
4
4
|
"description": "cli tool for cloudbase",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@cloudbase/functions-framework": "1.16.0",
|
|
54
54
|
"@cloudbase/iac-core": "0.0.3-alpha.11",
|
|
55
55
|
"@cloudbase/lowcode-cli": "^0.22.2",
|
|
56
|
-
"@cloudbase/manager-node": "4.6.
|
|
56
|
+
"@cloudbase/manager-node": "4.6.4",
|
|
57
57
|
"@cloudbase/toolbox": "^0.7.9",
|
|
58
58
|
"@dotenvx/dotenvx": "^1.48.3",
|
|
59
59
|
"@musistudio/claude-code-router": "1.0.36",
|
|
@@ -9,12 +9,14 @@ export declare class TemplateManager {
|
|
|
9
9
|
constructor();
|
|
10
10
|
pullTemplate(source: string, options: PullOptions, log: Logger): Promise<void>;
|
|
11
11
|
private isBuiltinTemplate;
|
|
12
|
+
private isZipUrl;
|
|
12
13
|
private isGitUrl;
|
|
13
14
|
private parseGitUrl;
|
|
14
15
|
private buildGitUrl;
|
|
15
16
|
private cloneWithSubpathOptimized;
|
|
16
17
|
private cloneWithSubpath;
|
|
17
18
|
private downloadBuiltinTemplateToTemp;
|
|
19
|
+
private downloadZipTemplateToTemp;
|
|
18
20
|
private downloadGitTemplateToTemp;
|
|
19
21
|
private copyFromTempToTarget;
|
|
20
22
|
private copyFilesWithOverwrite;
|