chore: prepare v1.0.0 release

This commit is contained in:
Tom Boullay
2026-04-27 23:43:16 +02:00
parent 31c05a35fc
commit dddecbb11c
18 changed files with 123 additions and 239 deletions
+18 -8
View File
@@ -1,9 +1,6 @@
// ---------------------------------------------------------------------------
// Client-side folder validation
// ---------------------------------------------------------------------------
import { ASSET_EXTENSIONS, TEXTURE_EXTENSIONS } from '@/lib/constants'
import { formatAssetFamilies, getAssetFamily, getForbiddenAssetFamilyAlias } from '@/lib/asset-naming'
import { getErrorMessage, isRecord } from '@/lib/guards'
import type { TextureFile } from '@/lib/client-types'
const SUPPORT_FILE_EXT_ARRAY = [...TEXTURE_EXTENSIONS, ...ASSET_EXTENSIONS]
@@ -22,7 +19,9 @@ export type ValidationResult =
| { ok: false; errors: string[] }
function isGltfJson(value: unknown): value is GltfJson {
return typeof value === 'object' && value !== null
if (!isRecord(value)) return false
if (value.buffers === undefined) return true
return Array.isArray(value.buffers) && value.buffers.every(isRecord)
}
function getReferencedBufferNames(gltf: GltfJson) {
@@ -83,10 +82,12 @@ async function getGltfWarnings(model: File, supportFiles: File[]) {
try {
parsed = JSON.parse(await model.text())
} catch {
return warnings
throw new Error('model.gltf contient un JSON invalide')
}
if (!isGltfJson(parsed)) return warnings
if (!isGltfJson(parsed)) {
throw new Error('model.gltf a une structure invalide')
}
const supportFilenames = new Set(supportFiles.map((file) => file.name.toLowerCase()))
const binFiles = supportFiles.filter((file) => file.name.toLowerCase().endsWith('.bin'))
@@ -144,7 +145,16 @@ export async function validateFolder(files: File[]): Promise<ValidationResult> {
return { ok: false, errors }
}
const warnings = await getGltfWarnings(modelFiles[0], supportFiles)
let warnings: string[] = []
try {
warnings = await getGltfWarnings(modelFiles[0], supportFiles)
} catch (err) {
errors.push(getErrorMessage(err, 'model.gltf invalide'))
}
if (errors.length > 0) {
return { ok: false, errors }
}
return { ok: true, model: modelFiles[0], textures, warnings }
}