feat: add Next.js 16 frontend for Secure App#2
Conversation
Co-authored-by: SX1109 <109422266+SX110903@users.noreply.github.com>
Update Next.js config format and touch app files for re-detection. Co-authored-by: SX1109 <109422266+SX110903@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds a Next.js 16 frontend configuration to the Secure App repo and introduces a small diagnostics script intended to help debug directory discovery/integration issues when colocated with the existing PHP project.
Changes:
- Added a Node diagnostics script to print cwd and directory contents for troubleshooting.
- Updated
next.config.tsto use TypeScript typing (NextConfig) instead of JSDoc typing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/check-dirs.mjs | New diagnostics script that inspects working directory and app/ presence/contents. |
| next.config.ts | Converts config typing to TypeScript import/type annotation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| console.log("[v0] Current working directory:", cwd); | ||
| console.log("[v0] app dir exists:", existsSync(resolve(cwd, 'app'))); | ||
| console.log("[v0] app is directory:", existsSync(resolve(cwd, 'app')) && statSync(resolve(cwd, 'app')).isDirectory()); | ||
|
|
||
| if (existsSync(resolve(cwd, 'app'))) { | ||
| console.log("[v0] app dir contents:", readdirSync(resolve(cwd, 'app'))); | ||
| } | ||
|
|
There was a problem hiding this comment.
statSync() can throw (e.g., permission issues or a race where the path disappears between existsSync and statSync). Consider storing the resolved path once and wrapping the statSync call in a try/catch (or use a single try { ... } block) so this diagnostic script doesn’t fail unexpectedly.
| console.log("[v0] Current working directory:", cwd); | |
| console.log("[v0] app dir exists:", existsSync(resolve(cwd, 'app'))); | |
| console.log("[v0] app is directory:", existsSync(resolve(cwd, 'app')) && statSync(resolve(cwd, 'app')).isDirectory()); | |
| if (existsSync(resolve(cwd, 'app'))) { | |
| console.log("[v0] app dir contents:", readdirSync(resolve(cwd, 'app'))); | |
| } | |
| const appDir = resolve(cwd, 'app'); | |
| const appDirExists = existsSync(appDir); | |
| console.log("[v0] Current working directory:", cwd); | |
| console.log("[v0] app dir exists:", appDirExists); | |
| let appIsDirectory = false; | |
| if (appDirExists) { | |
| try { | |
| appIsDirectory = statSync(appDir).isDirectory(); | |
| } catch (err) { | |
| console.error("[v0] Error checking if app is directory:", err); | |
| } | |
| } | |
| console.log("[v0] app is directory:", appIsDirectory); | |
| if (appDirExists) { | |
| console.log("[v0] app dir contents:", readdirSync(appDir)); | |
| } |
| if (existsSync(resolve(cwd, 'app'))) { | ||
| console.log("[v0] app dir contents:", readdirSync(resolve(cwd, 'app'))); | ||
| } | ||
|
|
||
| console.log("[v0] Root dir contents:", readdirSync(cwd).filter(f => !f.startsWith('.'))); |
There was a problem hiding this comment.
readdirSync() can throw (missing permissions, transient filesystem issues). Since this appears to be a diagnostics script, it would be more robust to catch and log errors instead of crashing, especially if it’s ever run in CI.
This PR introduces a Next.js 16 frontend for the Secure App and resolves environment-specific integration issues.
Problem/Issue/Goal:
Fix/Solution:
Chat link: https://v0.app/chat/G0fL0JaJ1cf