fix(scripts): 修复 publish-packs 统计地图关卡数量逻辑
This commit is contained in:
parent
72731bb143
commit
9475886bc8
|
|
@ -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 }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue