feat: 그날 코디 — 무신사 인기 스냅에서 사람별 코디 선정, Claude 옷 목록 추출, Codex 참고 사진 첨부 생성(npm run card -- ootd --daily), 카드 이름표 목록 2줄 허용

This commit is contained in:
minaChoi committed 2026-10-26 10:40:21 +09:00
1 parent 5cde680cb6
commit 814e64931d
14 files changed
+506 -50

No files matched your search

+20 -1
View File
@@ -1,5 +1,7 @@
import { spawn } from 'node:child_process'
import { createReadStream, existsSync } from 'node:fs'
import type { IncomingMessage, ServerResponse } from 'node:http'
import { basename, resolve } from 'node:path'
import tailwindcss from '@tailwindcss/vite'
import react from '@vitejs/plugin-react'
import { defineConfig, type Plugin } from 'vite'
@@ -171,9 +173,26 @@ function postApi(): Plugin {
}
}
/** GET /daily/<날짜>-<사람>.webp → public/daily (scripts/daily-ootd.mjs 가 만든 그날 코디 그림). publicDir 는 프론트 아이콘용이라 따로 서빙 */
function dailyImages(): Plugin {
return {
name: 'daily-images',
configureServer(server) {
server.middlewares.use('/daily', (req, res, next) => {
const name = basename((req.url ?? '').split('?')[0])
const file = resolve(import.meta.dirname, 'public/daily', name)
if (!name.endsWith('.webp') || !existsSync(file)) return next()
res.setHeader('Content-Type', 'image/webp')
res.setHeader('Cache-Control', 'no-cache')
createReadStream(file).pipe(res)
})
},
}
}
// 각 아이콘·캐릭터는 서비스와 같은 파일을 쓴다 (/icons/*.png)
export default defineConfig({
plugins: [react(), tailwindcss(), planApi(), imageApi(), postApi()],
plugins: [react(), tailwindcss(), planApi(), imageApi(), postApi(), dailyImages()],
publicDir: '../frontend/public',
server: { port: 5175, strictPort: true },
})