qdmp-cli 0.0.10 → 0.1.0
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/actions.js +1 -1
- package/package.json +1 -1
- package/utils/common.js +5 -5
package/actions.js
CHANGED
|
@@ -113,7 +113,7 @@ export async function uploadAction(option) {
|
|
|
113
113
|
const loader = remoteApp.loader;
|
|
114
114
|
// 预上传
|
|
115
115
|
const targetName = `${appId}_${code}`;
|
|
116
|
-
const localPath = await preUpload(loader, targetName);
|
|
116
|
+
const localPath = await preUpload(loader, targetName, appId);
|
|
117
117
|
if (!localPath) {
|
|
118
118
|
error("预上传失败");
|
|
119
119
|
}
|
package/package.json
CHANGED
package/utils/common.js
CHANGED
|
@@ -75,7 +75,7 @@ export async function createWorkSpaceFolder(dirname = "") {
|
|
|
75
75
|
* @param {*} dirname 文件夹名
|
|
76
76
|
*/
|
|
77
77
|
// 压缩项目
|
|
78
|
-
async function compressProject(output, dirname = "", loader) {
|
|
78
|
+
async function compressProject(output, dirname = "", loader, appId) {
|
|
79
79
|
try {
|
|
80
80
|
if (loader !== "EMP") {
|
|
81
81
|
const zip = new AdmZip();
|
|
@@ -91,7 +91,7 @@ async function compressProject(output, dirname = "", loader) {
|
|
|
91
91
|
} else {
|
|
92
92
|
// 直接压缩dist
|
|
93
93
|
const zip = new AdmZip();
|
|
94
|
-
zip.addLocalFolder(path.join(dirname, "dist"),
|
|
94
|
+
zip.addLocalFolder(path.join(dirname, "dist"), `${appId}`);
|
|
95
95
|
zip.writeZip(path.join(dirname, `${output}.zip`));
|
|
96
96
|
}
|
|
97
97
|
return true;
|
|
@@ -163,7 +163,7 @@ async function copyEmpDistFolder() {
|
|
|
163
163
|
* @param {string} targetName - 目标文件名
|
|
164
164
|
* @returns {Promise<string|boolean>} 压缩文件路径或操作失败返回false
|
|
165
165
|
*/
|
|
166
|
-
export async function preUpload(loader, targetName) {
|
|
166
|
+
export async function preUpload(loader, targetName, appId) {
|
|
167
167
|
try {
|
|
168
168
|
// 1. 创建工作空间文件夹
|
|
169
169
|
if (!(await createWorkSpaceFolder(WORKSPACE_DIR))) {
|
|
@@ -183,14 +183,14 @@ export async function preUpload(loader, targetName) {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
// 3. 压缩项目
|
|
186
|
-
if (!(await compressProject(targetName, WORKSPACE_DIR, loader))) {
|
|
186
|
+
if (!(await compressProject(targetName, WORKSPACE_DIR, loader, appId))) {
|
|
187
187
|
error("压缩项目失败");
|
|
188
188
|
return false;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
// 4. 返回压缩文件路径
|
|
192
192
|
const zipFilePath = `./${WORKSPACE_DIR}/${targetName}.zip`;
|
|
193
|
-
success(
|
|
193
|
+
success(`预上传准备完成`);
|
|
194
194
|
return zipFilePath;
|
|
195
195
|
} catch (error) {
|
|
196
196
|
error(`预上传过程出错: ${error.message}`);
|