@taole/deploy-helper 1.1.2 → 1.1.3
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/lib/lightDeploy.mjs +9 -3
- package/package.json +1 -1
package/lib/lightDeploy.mjs
CHANGED
|
@@ -18,11 +18,17 @@ function getErrorMessage(resJson, fallback) {
|
|
|
18
18
|
return fallback;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
async function apiCdnUpload({ distZipPath, prefix, mode, includeHtml, entryHtmlMap }, userCache) {
|
|
21
|
+
async function apiCdnUpload({ distZipPath, prefix, mode, includeHtml, entryHtmlMap, type, version }, userCache) {
|
|
22
22
|
const formData = new FormData();
|
|
23
23
|
formData.append("prefix", prefix);
|
|
24
24
|
formData.append("mode", mode);
|
|
25
25
|
formData.append("includeHtml", includeHtml ? "true" : "false");
|
|
26
|
+
if (type) {
|
|
27
|
+
formData.append("type", type);
|
|
28
|
+
}
|
|
29
|
+
if (version) {
|
|
30
|
+
formData.append("version", version);
|
|
31
|
+
}
|
|
26
32
|
if (entryHtmlMap) {
|
|
27
33
|
const entryHtmlMapStr =
|
|
28
34
|
typeof entryHtmlMap === "string" ? entryHtmlMap : JSON.stringify(entryHtmlMap);
|
|
@@ -56,7 +62,7 @@ async function apiCdnUpload({ distZipPath, prefix, mode, includeHtml, entryHtmlM
|
|
|
56
62
|
export async function lightDeploy(config, mode) {
|
|
57
63
|
const projectJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), "package.json"), "utf-8"));
|
|
58
64
|
const version = projectJson.version;
|
|
59
|
-
log(`light模式, 开始部署`, { mode, prefix: config.prefix, includeHtml: config.includeHtml, version });
|
|
65
|
+
log(`light模式, 开始部署`, { mode, prefix: config.prefix, includeHtml: config.includeHtml, type: config.cdnType, version });
|
|
60
66
|
|
|
61
67
|
if (!mode || (mode !== "test" && mode !== "prod")) {
|
|
62
68
|
throw new Error("部署环境无效,仅支持 test 或 prod");
|
|
@@ -89,7 +95,7 @@ export async function lightDeploy(config, mode) {
|
|
|
89
95
|
log(`打包完成: ${distZipPath}`);
|
|
90
96
|
|
|
91
97
|
const includeHtml = config.includeHtml === true;
|
|
92
|
-
log(`开始上传至 CDN,mode=${mode}, prefix=${prefix}, includeHtml=${includeHtml}`);
|
|
98
|
+
log(`开始上传至 CDN,mode=${mode}, prefix=${prefix}, type=${config.cdnType || "project"}, version=${version}, includeHtml=${includeHtml}`);
|
|
93
99
|
const result = await apiCdnUpload(
|
|
94
100
|
{
|
|
95
101
|
distZipPath,
|