Skip to content

Commit

Permalink
Automatically generate latest formats
Browse files Browse the repository at this point in the history
  • Loading branch information
Nixinova committed Aug 10, 2023
1 parent 631055d commit 55abd80
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { VersionName, SnapshotName, PackType, FormatResult, VersionsResult } fro

// Data sets //

const LATEST = { resource: 16, data: 16 }

const START_RELEASES: Record<VersionName, Record<PackType, FormatResult>> = {
'1.6.x': { resource: 1, data: undefined },
'1.9.x': { resource: 2, data: undefined },
Expand All @@ -22,6 +20,9 @@ const START_RELEASES: Record<VersionName, Record<PackType, FormatResult>> = {
'1.21.x': { resource: undefined, data: undefined },
}

const maxFormat = (type: 'resource' | 'data') => Math.max(...Object.values(START_RELEASES).map(release => release[type] ?? 0));
const LATEST = { resource: maxFormat('resource'), data: maxFormat('data') };

const d = new Date(), year = d.getFullYear() - 2000, maxWeek = (d.getMonth() + 1) * 5
const fauxCurrentSnapshot: SnapshotName = `${year}w${maxWeek.toString().padStart(2, '0')}a`
const START_SNAPSHOTS: Record<string, Record<PackType, FormatResult>> = {
Expand Down

0 comments on commit 55abd80

Please sign in to comment.