|
@@ -310,6 +310,13 @@ export async function postWebUpdate(axiosInstance, param) {
|
|
}
|
|
}
|
|
|
|
|
|
const outputPath = __dirname + '/upload.zip';
|
|
const outputPath = __dirname + '/upload.zip';
|
|
|
|
+ const skipFiles = config?.buildWebOptions?.skipFiles ?? [];
|
|
|
|
+
|
|
|
|
+ function checkPathSkip(path) {
|
|
|
|
+ if (!skipFiles || skipFiles.length === 0)
|
|
|
|
+ return;
|
|
|
|
+ return skipFiles.find((item) => path.startsWith(item));
|
|
|
|
+ }
|
|
|
|
|
|
if (!skipBuild) {
|
|
if (!skipBuild) {
|
|
console.log('开始压缩zip...');
|
|
console.log('开始压缩zip...');
|
|
@@ -320,15 +327,21 @@ export async function postWebUpdate(axiosInstance, param) {
|
|
});
|
|
});
|
|
archive.pipe(output);
|
|
archive.pipe(output);
|
|
|
|
|
|
- const files = await readdir(distDir);
|
|
|
|
- for (const file of files) {
|
|
|
|
- const filestat = await stat(distDir + '/' + file);
|
|
|
|
- if (filestat.isDirectory()) {
|
|
|
|
- archive.directory(distDir + '/' + file, file);
|
|
|
|
- } else {
|
|
|
|
- archive.file(distDir + '/' + file, { name: file });
|
|
|
|
|
|
+ async function loopDir(path, subPrefix) {
|
|
|
|
+ const files = await readdir(path);
|
|
|
|
+ for (const file of files) {
|
|
|
|
+ const subPath = subPrefix + '/' + file;
|
|
|
|
+ if (checkPathSkip(subPath))
|
|
|
|
+ continue;
|
|
|
|
+ const filestat = await stat(path + subPath);
|
|
|
|
+ if (filestat.isDirectory()) {
|
|
|
|
+ await loopDir(distDir + subPath, subPath);
|
|
|
|
+ } else {
|
|
|
|
+ archive.file(distDir + subPath, { name: file });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ await loopDir(distDir, '')
|
|
|
|
|
|
console.log('等待压缩zip...');
|
|
console.log('等待压缩zip...');
|
|
|
|
|