17 lines
683 B
TypeScript
17 lines
683 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { packageProject } from "../../../../../lib/build";
|
|
import { errorResponse } from "../../../../../lib/http";
|
|
import { touchProject } from "../../../../../lib/storage";
|
|
|
|
export const runtime = "nodejs";
|
|
export const maxDuration = 60;
|
|
|
|
export async function POST(_: Request, context: { params: Promise<{ id: string }> }) {
|
|
try {
|
|
const { id } = await context.params;
|
|
await touchProject(id);
|
|
const result = await packageProject(id);
|
|
return NextResponse.json({ report: result.report, artifactUrl: result.zipPath ? `/api/artifacts/${id}/minitool.zip` : undefined });
|
|
} catch (error) { return errorResponse(error); }
|
|
}
|