update tags page + sort project types consistently (#7044)

This commit is contained in:
Prospector
2026-08-07 13:19:36 -07:00
committed by GitHub
parent a71a361e0f
commit 75335647ee
24 changed files with 452 additions and 470 deletions
+1
View File
@@ -6,6 +6,7 @@ export * from './file-extensions'
export * from './game-modes'
export * from './loaders'
export * from './notices'
export * from './project-types'
export * from './savable'
export * from './search'
export * from './server-content-installing'
+31
View File
@@ -0,0 +1,31 @@
export const PROJECT_TYPE_ORDER = [
'mod',
'resourcepack',
'datapack',
'shader',
'modpack',
'plugin',
'server',
'collection',
] as const
export type OrderedProjectType = (typeof PROJECT_TYPE_ORDER)[number]
const PROJECT_TYPE_SORT_ALIASES: Record<string, string> = {
minecraft_java_server: 'server',
shaderpack: 'shader',
}
export function getProjectTypeSortIndex(type: string): number {
const normalized = PROJECT_TYPE_SORT_ALIASES[type] ?? type
const index = (PROJECT_TYPE_ORDER as readonly string[]).indexOf(normalized)
return index === -1 ? PROJECT_TYPE_ORDER.length : index
}
export function compareProjectTypes(a: string, b: string): number {
return getProjectTypeSortIndex(a) - getProjectTypeSortIndex(b)
}
export function sortProjectTypes<T extends string>(types: Iterable<T>): T[] {
return [...types].sort(compareProjectTypes)
}
+2 -2
View File
@@ -93,10 +93,10 @@ export type ProjectType =
const ALL_PROJECT_TYPES: ProjectType[] = [
'mod',
'modpack',
'resourcepack',
'shader',
'datapack',
'shader',
'modpack',
'plugin',
'server',
]