Skip to content

feat(install-tracker): idiomatic <Script> for Next.js + optional subdir input - #14

Merged
ralyodio merged 1 commit into
masterfrom
feat/install-tracker-next-script-and-subdir
May 22, 2026
Merged

ralyodio merged 1 commit into
masterfrom
feat/install-tracker-next-script-and-subdir

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Two improvements: (a) For .tsx/.jsx targets the snippet uses next/script's <Script> component with strategy="afterInteractive" + auto-adds the import. (b) The install modal has a collapsible 'Subdirectory' input for monorepos so users can pin apps/web when auto-detection misses.

Two upgrades to the auto-PR flow:

1. For Next.js layouts (.tsx/.jsx targets), insert the snippet as the
   <Script> component from next/script with strategy="afterInteractive"
   instead of a raw <script> tag. Avoids hydration warnings; matches
   how Next docs tell you to add third-party scripts. Auto-adds
   `import Script from "next/script";` after the last top-level import
   if the file doesn't already pull it in. Plain HTML / Hugo / Jekyll
   / Astro layouts still get a raw <script>.

2. The Stats-tab "Install via GitHub" modal now has an optional
   collapsed "Subdirectory" input. Fill in e.g. "apps/web" for
   monorepos where auto-detection picks the wrong file (or to be
   explicit). Empty = auto-detect (canonical paths first, then code
   search). API + installTracker were already plumbed for rootPath;
   this just exposes it in the UI.

PR body now also shows the actual snippet that was inserted (with the
right language fence: tsx for Next.js, html otherwise) and mentions the
auto-added import.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ralyodio
ralyodio merged commit 7426b61 into master May 22, 2026
@ralyodio
ralyodio deleted the feat/install-tracker-next-script-and-subdir branch May 22, 2026 14:15
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.

1 participant