- Standardized import statements and formatting in various files for better code clarity. - Enhanced error messages and logging for improved debugging and user experience. - Adjusted whitespace and line breaks in multiple components to follow best practices. - Updated environment variable handling and configuration for consistency across services.
28 lines
911 B
JavaScript
28 lines
911 B
JavaScript
#!/usr/bin/env node
|
|
// Ensure dev-time Next.js manifests exist to avoid noisy ENOENT errors
|
|
import { mkdirSync, existsSync, writeFileSync } from "fs";
|
|
import { join } from "path";
|
|
|
|
const root = new URL("..", import.meta.url).pathname; // apps/portal
|
|
const nextDir = join(root, ".next");
|
|
const routesManifestPath = join(nextDir, "routes-manifest.json");
|
|
|
|
try {
|
|
mkdirSync(nextDir, { recursive: true });
|
|
if (!existsSync(routesManifestPath)) {
|
|
const minimalManifest = {
|
|
version: 5,
|
|
pages404: true,
|
|
basePath: "",
|
|
redirects: [],
|
|
rewrites: { beforeFiles: [], afterFiles: [], fallback: [] },
|
|
headers: [],
|
|
};
|
|
writeFileSync(routesManifestPath, JSON.stringify(minimalManifest, null, 2));
|
|
|
|
console.log("[dev-prep] Created minimal .next/routes-manifest.json");
|
|
}
|
|
} catch (err) {
|
|
console.warn("[dev-prep] Failed to prepare Next dev files:", err?.message || err);
|
|
}
|