Skip to content

feat(cli): auto-detect Next.js and suggest correct default install paths#101

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/enhancement-default-folder-location
Draft

feat(cli): auto-detect Next.js and suggest correct default install paths#101
Copilot wants to merge 2 commits intomainfrom
copilot/enhancement-default-folder-location

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

pdfx init always suggested ./src/components/pdfx regardless of project type, forcing users in Next.js projects without a src/ directory to manually correct every path prompt.

Changes

  • environment-validator.ts — adds detectNextJs(cwd): inspects package.json dependencies/devDependencies for next
  • init.ts — adds getSmartDefaults(cwd): combines detectNextJs + src/ directory presence to pick paths; used by both interactive prompts (initial:) and --yes mode
Condition componentDir blockDir theme
Next.js, no src/ ./components/pdfx ./blocks/pdfx ./lib/pdfx-theme.ts
Everything else ./src/components/pdfx ./src/blocks/pdfx ./src/lib/pdfx-theme.ts
  • environment-validator.test.ts (new) — unit tests for detectNextJs and the existing validatePackageJson/validateReactProject (previously untested)

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pdfx Ready Ready Preview, Comment Apr 2, 2026 4:26pm

Copilot AI changed the title [WIP] Add default folder location support for Next.js projects feat(cli): auto-detect Next.js and suggest correct default install paths Apr 2, 2026
Copilot AI requested a review from akii09 April 2, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT]: CLI - Default folder location support for next.js projects

2 participants