chore: 添加压缩包过大时的可能解决方案

This commit is contained in:
unanmed 2025-09-25 11:29:03 +08:00
parent 9a175e9afe
commit a89bf40e50
2 changed files with 14 additions and 3 deletions

View File

@ -399,7 +399,7 @@ async function buildGame() {
if (level === ClientDataLevel.Error) { if (level === ClientDataLevel.Error) {
logProgress(2, ProgressStatus.Fail); logProgress(2, ProgressStatus.Fail);
process.stderr.write( process.stderr.write(
`客户端似乎引用了数据端内容,请仔细检查后再构建!` `数据端似乎引用了客户端内容,请仔细检查后再构建!`
); );
process.exit(1); process.exit(1);
} }
@ -647,6 +647,19 @@ async function buildGame() {
process.stdout.write( process.stdout.write(
`⚠️ 压缩包大于 100M可能导致发塔困难请考虑降低塔的大小\r\n` `⚠️ 压缩包大于 100M可能导致发塔困难请考虑降低塔的大小\r\n`
); );
const suggections: string[] = [];
if (dataObject.main.bgms.some(v => !v.endsWith('opuw'))) {
suggections.push(`将 BGM 和音效换用 opus 格式`);
}
if (dataObject.main.images.some(v => !v.endsWith('webp'))) {
suggections.push(`将图片换用无损 webp 格式`);
}
if (suggections.length > 0) {
process.stdout.write(`降低压缩包体积的可能方案:\r\n`);
suggections.forEach((v, i) => {
process.stdout.write(`${i + 1}. ${v}\r\n`);
});
}
} }
process.stdout.write(`压缩包大小:${formatSize(zipSize)}\r\n`); process.stdout.write(`压缩包大小:${formatSize(zipSize)}\r\n`);
process.stdout.write(`源码大小:${formatSize(sourceSize)}\r\n`); process.stdout.write(`源码大小:${formatSize(sourceSize)}\r\n`);

View File

@ -5,8 +5,6 @@ import path from 'path';
import postcssPresetEnv from 'postcss-preset-env'; import postcssPresetEnv from 'postcss-preset-env';
import * as glob from 'glob'; import * as glob from 'glob';
const FSHOST = 'http://127.0.0.1:3000/';
const custom = [ const custom = [
'container', 'image', 'sprite', 'shader', 'text', 'comment', 'custom', 'container', 'image', 'sprite', 'shader', 'text', 'comment', 'custom',
'layer', 'layer-group', 'animate', 'damage', 'graphics', 'icon', 'winskin', 'layer', 'layer-group', 'animate', 'damage', 'graphics', 'icon', 'winskin',