refactor: flatten monorepo to single web package (#12)

Flatten the pnpm monorepo (apps/web + packages/*) into a single web package at the repo root.

- Move app/lib/components/scripts/public to root; drop apps/web and packages/* wrappers
- Rewrite tsconfig paths (@infiplot/*) to ./lib/*; turbopack.root = __dirname
- Update Vercel (no root-directory) and Cloudflare (pnpm build:cf at root) deploy paths
- Regenerate pnpm-lock.yaml to drop stale workspace importers
- Bump engines.node to >=22 to match wrangler

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Zonghao Yuan
2026-06-03 00:55:45 +08:00
committed by GitHub
parent 9543c3dba1
commit dc5ecd60f6
221 changed files with 241 additions and 379 deletions
+36
View File
@@ -0,0 +1,36 @@
import { requestBeatAudio } from "@infiplot/engine";
import type { BeatAudioRequest } from "@infiplot/types";
import { NextResponse } from "next/server";
import { loadEngineConfig } from "@/lib/config";
export const runtime = "nodejs";
// The synth itself has a 15s per-call ceiling in the engine. 30s here just
// covers JSON parsing + outbound network buffer.
export const maxDuration = 30;
export async function POST(req: Request) {
let body: BeatAudioRequest;
try {
body = (await req.json()) as BeatAudioRequest;
} catch {
return NextResponse.json({ error: "Invalid JSON" }, { status: 400 });
}
if (!body.beat?.id || !body.beat?.line || !body.voice?.referenceAudioBase64) {
return NextResponse.json(
{ error: "beat.id, beat.line and voice.referenceAudioBase64 are required" },
{ status: 400 },
);
}
try {
const config = loadEngineConfig();
const result = await requestBeatAudio(config, body);
return NextResponse.json(result);
} catch (err) {
// Engine already swallows synth errors and returns audio:null. Anything
// that reaches here is config-level — surface so the client can log it.
const message = err instanceof Error ? err.message : "Unknown error";
return NextResponse.json({ error: message }, { status: 500 });
}
}