fix(scripts): 修复 publish-packs 统计地图关卡数量逻辑

This commit is contained in:
troytt 2026-09-14 09:30:55 +00:00
parent 72731bb143
commit 9475886bc8
1 changed files with 2 additions and 2 deletions

View File

@ -72,7 +72,7 @@ function measure(): { files: number; bytes: number; maps: number; indexSha: stri
if (!existsSync(indexPath)) {
throw new PublishError(`no packs at ${PACKS_DIR} — run: npm run pack:data`)
}
const index = JSON.parse(readFileSync(indexPath, 'utf8')) as { entries?: unknown[] }
const index = JSON.parse(readFileSync(indexPath, 'utf8')) as { entries?: unknown[]; levels?: unknown[] }
const indexSha = createHash('sha256').update(readFileSync(indexPath)).digest('hex')
let files = 0
let bytes = 0
@ -87,7 +87,7 @@ function measure(): { files: number; bytes: number; maps: number; indexSha: stri
}
}
walk(PACKS_DIR)
return { files, bytes, maps: index.entries?.length ?? 0, indexSha }
return { files, bytes, maps: index.levels?.length ?? index.entries?.length ?? 0, indexSha }
}
/**