Skip to content

Commit 55abd80

Browse files
committed
Automatically generate latest formats
1 parent 631055d commit 55abd80

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { VersionName, SnapshotName, PackType, FormatResult, VersionsResult } fro
22

33
// Data sets //
44

5-
const LATEST = { resource: 16, data: 16 }
6-
75
const START_RELEASES: Record<VersionName, Record<PackType, FormatResult>> = {
86
'1.6.x': { resource: 1, data: undefined },
97
'1.9.x': { resource: 2, data: undefined },
@@ -22,6 +20,9 @@ const START_RELEASES: Record<VersionName, Record<PackType, FormatResult>> = {
2220
'1.21.x': { resource: undefined, data: undefined },
2321
}
2422

23+
const maxFormat = (type: 'resource' | 'data') => Math.max(...Object.values(START_RELEASES).map(release => release[type] ?? 0));
24+
const LATEST = { resource: maxFormat('resource'), data: maxFormat('data') };
25+
2526
const d = new Date(), year = d.getFullYear() - 2000, maxWeek = (d.getMonth() + 1) * 5
2627
const fauxCurrentSnapshot: SnapshotName = `${year}w${maxWeek.toString().padStart(2, '0')}a`
2728
const START_SNAPSHOTS: Record<string, Record<PackType, FormatResult>> = {

0 commit comments

Comments
 (0)