chore: prepare v1.0.0 release
This commit is contained in:
@@ -7,6 +7,7 @@ import { getModelFolderPath } from '@/lib/model-paths'
|
||||
import { cleanupStagingUpload, ensurePreparedStagingAssets, readStagedManifest } from '@/lib/upload-staging'
|
||||
import { acquireUploadLock, releaseUploadLock } from '@/lib/upload-lock'
|
||||
import { parseStagingRequestBody } from '@/lib/upload-request'
|
||||
import { getErrorMessage } from '@/lib/guards'
|
||||
|
||||
export const runtime = 'nodejs'
|
||||
export const dynamic = 'force-dynamic'
|
||||
@@ -16,7 +17,6 @@ export const dynamic = 'force-dynamic'
|
||||
* Upload prepared files and push to GitHub via Octokit.
|
||||
*/
|
||||
export async function POST(req: NextRequest) {
|
||||
// --- Auth ---
|
||||
const authError = validateUploadSecret(req)
|
||||
if (authError) return authError
|
||||
|
||||
@@ -29,7 +29,7 @@ export async function POST(req: NextRequest) {
|
||||
const manifest = await readStagedManifest(stagingId)
|
||||
folderName = manifest.folderName
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : 'Erreur inconnue'
|
||||
const message = getErrorMessage(err)
|
||||
return NextResponse.json({ success: false, error: message }, { status: 400 })
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ export async function POST(req: NextRequest) {
|
||||
}
|
||||
|
||||
try {
|
||||
// --- Process files (preserve model + buffers, compress textures for Git) ---
|
||||
const {
|
||||
filesToPush,
|
||||
modelFilename,
|
||||
@@ -50,7 +49,6 @@ export async function POST(req: NextRequest) {
|
||||
assetSummaries,
|
||||
} = await ensurePreparedStagingAssets(stagingId)
|
||||
|
||||
// --- Detect existing files and classify changes ---
|
||||
const folderPath = getModelFolderPath(folderName)
|
||||
const remote = await getRemoteFolder(folderPath)
|
||||
const remoteFileMap = new Map(remote.files.map((f) => [f.name.toLowerCase(), f.size]))
|
||||
@@ -60,7 +58,6 @@ export async function POST(req: NextRequest) {
|
||||
const { fileChanges, changedFilesToPush, deletedFileNames, deletePaths } =
|
||||
classifyFileChanges(filesToPush, remoteFileMap, folderPath)
|
||||
|
||||
// If nothing changed, don't create an empty commit
|
||||
if (changedFilesToPush.length === 0 && deletePaths.length === 0) {
|
||||
await cleanupStagingUpload(stagingId).catch(() => {})
|
||||
return NextResponse.json({
|
||||
@@ -73,7 +70,6 @@ export async function POST(req: NextRequest) {
|
||||
})
|
||||
}
|
||||
|
||||
// --- Build commit message ---
|
||||
const commitMessage = buildCommitMessage(
|
||||
folderName,
|
||||
modelFilename,
|
||||
@@ -83,7 +79,6 @@ export async function POST(req: NextRequest) {
|
||||
deletedFileNames,
|
||||
)
|
||||
|
||||
// --- Push all in one commit ---
|
||||
try {
|
||||
const { commitUrl } = await pushAllToGitHub(changedFilesToPush, deletePaths, commitMessage)
|
||||
await cleanupStagingUpload(stagingId).catch(() => {})
|
||||
@@ -98,7 +93,7 @@ export async function POST(req: NextRequest) {
|
||||
commitUrl,
|
||||
})
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : 'Erreur GitHub inconnue'
|
||||
const message = getErrorMessage(err, 'Erreur GitHub inconnue')
|
||||
return NextResponse.json(
|
||||
{ success: false, error: `Push GitHub echoue: ${message}` },
|
||||
{ status: 500 },
|
||||
|
||||
Reference in New Issue
Block a user