mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-11-07 13:14:30 +08:00
加载资源初步
This commit is contained in:
1 parent
7cc7fe375b
commit
5cbd9950b9
6 files changed
+163
-16
No files matched your search
+2
-1
@@ -3,7 +3,8 @@ import { extname, resolve } from 'path';
|
||||
import { formatSize } from './utils.js';
|
||||
|
||||
(async function () {
|
||||
const dir = process.argv.slice(2) || ['./src'];
|
||||
let dir = process.argv.slice(2);
|
||||
if (dir.length === 0) dir = ['./src'];
|
||||
let totalLines = 0;
|
||||
let totalFiles = 0;
|
||||
let totalSize = 0;
|
||||
|
||||
+2
-1
@@ -33,7 +33,7 @@ type Stats = fs.Stats & { name?: string };
|
||||
export async function splitResorce(compress: boolean = false) {
|
||||
const folder = await fs.stat('./dist');
|
||||
totalSize = folder.size;
|
||||
// if (totalSize < MAX_SIZE) return;
|
||||
if (totalSize < MAX_SIZE) return;
|
||||
|
||||
await fs.ensureDir('./dist-resource');
|
||||
await doSplit(compress);
|
||||
@@ -45,6 +45,7 @@ async function sortDir(dir: string, ext?: string[]) {
|
||||
|
||||
for await (const one of path) {
|
||||
if (ext && !ext.includes(extname(one))) continue;
|
||||
if (one === 'bg.jpg') continue;
|
||||
const stat = await fs.stat(resolve(dir, one));
|
||||
if (!stat.isFile()) continue;
|
||||
const status: Stats = {
|
||||
|
||||
Reference in new issue
Block a user