UNPKG

adam-java-analytics

Version:

Java code analyzer for detecting package dependencies and circular references

28 lines (24 loc) 1 kB
import { NextResponse } from "next/server" import fs from "fs" import path from "path" export async function GET() { try { // First try to get the project path from environment variable const envProjectPath = process.env.PROJECT_PATH || process.cwd() if (envProjectPath) { return NextResponse.json({ projectPath: envProjectPath }) } // Then try to read from the config file that the CLI might have created const configPath = path.join(process.cwd(), ".project-config.json") if (fs.existsSync(configPath)) { const configData = fs.readFileSync(configPath, "utf8") const config = JSON.parse(configData) return NextResponse.json(config) } // If no config file exists, return default return NextResponse.json({ projectPath: "./examples/sample-java-project" }) } catch (error) { console.error("Error reading project config:", error) return NextResponse.json({ error: "Failed to read project configuration" }, { status: 500 }) } }