refactor: simplify upload rules and remove destination flow

This commit is contained in:
Tom Boullay
2026-04-24 16:23:02 +02:00
parent 61a0146545
commit 944959fc22
20 changed files with 2033 additions and 217 deletions
+9 -23
View File
@@ -1,4 +1,3 @@
import { REQUIRED_TEXTURES } from './constants'
import type { FileChange } from './types'
/**
@@ -7,12 +6,11 @@ import type { FileChange } from './types'
* Symbols:
* - ✅ = new file
* - 🔄 = modified file
* - ❌ = missing texture (new upload) or deleted file (update)
* - ❌ = deleted file
* - Unchanged files are omitted entirely
*/
export function buildCommitMessage(
folderName: string,
destination: string,
modelFilename: string,
textureNames: string[],
compressed: boolean,
@@ -21,8 +19,8 @@ export function buildCommitMessage(
deletedFileNames: string[],
): string {
const title = isReplace
? `update: upload-gltf update -> ${destination}/${folderName}`
: `update: upload-gltf add a new model -> ${destination}/${folderName}`
? `update: upload-gltf update -> ${folderName}`
: `update: upload-gltf add a new model -> ${folderName}`
const lines: string[] = [title, '']
@@ -39,26 +37,14 @@ export function buildCommitMessage(
lines.push(` ↔️ ${modelFilename} (inchange)`)
}
// Textures section — only show lines that have changes
const foundTextures = new Set(
textureNames.map((t) => t.toLowerCase().replace(/\.[^.]+$/, '')),
)
const textureLines: string[] = []
for (const tex of REQUIRED_TEXTURES) {
if (foundTextures.has(tex)) {
const actual = textureNames.find(
(t) => t.toLowerCase().replace(/\.[^.]+$/, '') === tex,
)!
const change = fileChanges.get(actual.toLowerCase())
if (change === 'new') {
textureLines.push(`${actual}`)
} else if (change === 'changed') {
textureLines.push(` 🔄 ${actual}`)
}
} else if (!isReplace) {
textureLines.push(`${tex} (manquant)`)
for (const textureName of textureNames) {
const change = fileChanges.get(textureName.toLowerCase())
if (change === 'new') {
textureLines.push(`${textureName}`)
} else if (change === 'changed') {
textureLines.push(` 🔄 ${textureName}`)
}
}