feat: 将 HumanBreak 新内容移植入该样板

This commit is contained in:
AncTe committed 2026-02-28 22:56:59 +08:00
1 parent 6bf32174d8
commit bea2725d6a
128 files changed
+11984 -573

No files matched your search

+22 -6
View File
@@ -13,6 +13,9 @@ import { RequiredData, RequiredIconsData, ResourceType } from './types';
import { splitResource, SplittedResource } from './build-resource';
import { formatSize } from './utils';
/** 打包调试 */
const DEBUG_BUILD = false;
/** 录像验证调试 */
const DEBUG_REPLAY = false;
const ansi = {
@@ -52,6 +55,7 @@ async function buildClient(outDir: string) {
build: {
outDir,
copyPublicDir: true,
minify: !DEBUG_BUILD,
rollupOptions: {
external: ['@wasm-audio-decoders/opus-ml'],
output: {
@@ -568,13 +572,21 @@ async function buildGame() {
)
);
const scripts = archiver('zip');
scripts.directory('packages/', resolve(process.cwd(), 'packages'));
const scripts = archiver('zip', {
store: false,
zlib: {
level: 9
}
});
scripts.directory(resolve(process.cwd(), 'packages'), 'packages/');
scripts.directory(
'packages-user/',
resolve(process.cwd(), 'packages-user')
resolve(process.cwd(), 'packages-user'),
'packages-user/'
);
scripts.directory('src/', resolve(process.cwd(), 'src'));
scripts.directory(resolve(process.cwd(), 'src'), '/src');
scripts.file(resolve(process.cwd(), 'public', 'main.js'), {
name: 'main.js'
});
const output = createWriteStream(resolve(distDir, 'source-code.zip'));
scripts.pipe(output);
@@ -622,7 +634,11 @@ async function buildGame() {
try {
await zip.compressDir(
resolve(distDir),
resolve(process.cwd(), 'dist.zip')
resolve(process.cwd(), 'dist.zip'),
{
compress: true,
compressionLevel: 9
}
);
await emptyDir(tempDir);
+7 -1
View File
@@ -67,7 +67,13 @@ async function compressFiles(files: ResourceContent[]) {
const dir = `${v.type}/${v.name}`;
zip.file(dir, v.content);
});
const buffer = await zip.generateAsync({ type: 'uint8array' });
const buffer = await zip.generateAsync({
type: 'uint8array',
compression: 'DEFLATE',
compressionOptions: {
level: 9
}
});
const hash = fileHash(buffer);
const name = `resource.${hash}.h5data`;
+3 -3
View File
@@ -468,9 +468,9 @@ const apiWriteMultiFiles = async (req: Request, res: Response) => {
} else {
const strArray = status.map((v, i) => {
if (v === APIStatus.PermissionDeny) {
return `Index: ${i}; Permission Error: Cannot access file outside current working directory`;
} else if (v === APIStatus.Success) {
return `Index: ${i}: Internal Error: Write file error.`;
return `Path: ${pathList[i]}: Permission Error: Cannot access file outside current working directory.`;
} else if (v === APIStatus.WriteError) {
return `Path: ${pathList[i]}: Internal Error: Write file error.`;
} else {
return 'Success';
}
+11 -4
View File
@@ -25,9 +25,16 @@ import { formatSize } from './utils.js';
'.vue',
'.less',
'.css',
'.html'
'.html',
'.vert',
'.frag'
];
const mapExt = (ext: string) => {
if (ext === '.vert' || ext === '.frag') return '.shader';
else return ext;
};
const check = async (dir: string) => {
if (ignoreDir.some(v => dir.includes(v))) return;
const d = await fs.readdir(dir);
@@ -38,7 +45,7 @@ import { formatSize } from './utils.js';
if (exts.some(v => one.endsWith(v))) {
const file = await fs.readFile(resolve(dir, one), 'utf-8');
const lines = file.split('\n').length;
const ext = extname(one);
const ext = mapExt(extname(one));
list[ext] ??= [0, 0, 0];
list[ext][0]++;
list[ext][1] += lines;
@@ -59,7 +66,7 @@ import { formatSize } from './utils.js';
});
for (const [ext, [file, lines, size]] of sorted) {
console.log(
`${ext.slice(1).padEnd(7, ' ')}files: ${file
`${ext.slice(1).padEnd(9, ' ')}files: ${file
.toString()
.padEnd(6, ' ')}lines: ${lines
.toString()
@@ -67,7 +74,7 @@ import { formatSize } from './utils.js';
);
}
console.log(
`\x1b[33mtotal files: ${totalFiles
`\x1b[33mtotal files: ${totalFiles
.toString()
.padEnd(6, ' ')}lines: ${totalLines
.toString()