diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-01 17:06:49 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-01 17:06:49 +0900 |
| commit | adf5e96542ebd65c7d13ca5e9825071183b3ef13 (patch) | |
| tree | 699800730cc9f68ab775bea5722ba55cf08b304a /.claude/commands/migrate-to-app-router.md | |
| parent | b8dc7344ff99eb23d5f003795f17cdba3b89c40b (diff) | |
fix: lint fixes for integration tests and backtester noqa annotations
Diffstat (limited to '.claude/commands/migrate-to-app-router.md')
| -rw-r--r-- | .claude/commands/migrate-to-app-router.md | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/.claude/commands/migrate-to-app-router.md b/.claude/commands/migrate-to-app-router.md new file mode 100644 index 0000000..8801147 --- /dev/null +++ b/.claude/commands/migrate-to-app-router.md @@ -0,0 +1,48 @@ +--- +allowed-tools: Read, Write, MultiEdit, Glob, Grep, TodoWrite +argument-hint: "[page-path|all]" +description: Migrate Pages Router components to App Router +--- + +Migrate Pages Router to App Router for: $ARGUMENTS + +## Migration Steps + +1. **Analyze Current Structure** + - Identify pages to migrate + - Check for getServerSideProps, getStaticProps, getStaticPaths + - Find _app.tsx and_document.tsx customizations + +2. **Create App Router Structure** + - Create corresponding app/ directory structure + - Convert pages to page.tsx files + - Extract layouts from _app.tsx + +3. **Migrate Data Fetching** + - getStaticProps → Direct fetch in Server Component + - getServerSideProps → Direct fetch in Server Component + - getStaticPaths → generateStaticParams + - API calls in useEffect → Keep in Client Component or move to Server + +4. **Update Routing Hooks** + - useRouter from next/router → next/navigation + - Update router.push() calls + - Handle query params with useSearchParams + +5. **Migrate Metadata** + - Head component → metadata export or generateMetadata + - Update SEO configuration + +6. **Handle Special Files** + - _app.tsx → app/layout.tsx + - _document.tsx → app/layout.tsx (html/body tags) + - _error.tsx → app/error.tsx + - 404.tsx → app/not-found.tsx + +7. **Test and Validate** + - Ensure all routes work + - Verify data fetching + - Check that layouts render correctly + - Test client-side navigation + +Create a migration log documenting all changes and any issues that need manual review. |
