feat: Migrate to Next.js 15 App Router with React 19#477
Open
colbyfayock wants to merge 35 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Remove @apollo/client and graphql dependencies - Delete src/lib/apollo-client.js - Migrate src/lib/menus.js to use native fetch via gql() helper - Add graceful error handling for menu queries - Standardize all import paths to use @/ alias - Clean up request.js to use simple POST-only implementation - Update various files with trailing comma fixes - Switch from pnpm to npm (add package-lock.json)
- Update next from ^13.4.10 to ^14.2.0 - Update eslint-config-next to ^14.2.0 - Remove experimental.appDir (now stable in Next.js 14) - Remove swcMinify (now default) - Remove deprecated 'next export' script - Fix env config types (POSTS_PRERENDER_COUNT and WORDPRESS_PLUGIN_SEO must be strings)
Replace full GraphQL query strings with short djb2 hashed tags for Next.js fetch cache. Tags now include variables for proper cache key differentiation.
- Update next from ^14.2.0 to ^15.0.0 - Update eslint-config-next to ^15.0.0 - Migrate to async params/searchParams (breaking change in Next.js 15) - Move ImageResponse import from 'next/server' to 'next/og'
- Update react and react-dom from ^18.2.0 to ^19.0.0 - Update @types/react to ^19.0.0 Note: Next.js 16 is still in canary, staying on Next.js 15 for now
Dependencies upgraded: - fuse.js: ^6.6.2 -> ^7.1.0 - swr: ^2.2.0 -> ^2.4.0 - sass: ^1.63.6 -> ^1.97.0 - react-icons: ^4.10.1 -> ^5.0.0 - eslint: ^8.45.0 -> ^9.0.0 - prettier: ^3.0.0 -> ^3.8.0 - husky: ^8.0.3 -> ^9.0.0 - lint-staged: ^13.2.3 -> ^16.0.0 ESLint 9 uses flat config by default; added ESLINT_USE_FLAT_CONFIG=false to npm scripts to support legacy .eslintrc.js until migration to flat config.
Add optional chaining to prevent error when WordPress user roles are not publicly accessible or return null.
- Add /posts archive page with pagination - Add /posts/page/[page] for paginated posts - Add /categories index page listing all categories - Add /search page with client-side Fuse.js search - Add Archive.module.scss for shared archive styling
- Fetch node data to get actual page/post title - Use 'title' for posts/pages, 'name' for categories/users - Return proper 'Not Found' title when node doesn't exist - Set proper OpenGraph title and alt text
- Add getAllUsers function and QUERY_ALL_USERS query - Pre-generate all posts, pages, categories, and author routes at build time - Convert URIs to path segment arrays for Next.js params format
- Replace legacy .eslintrc.js with eslint.config.mjs - Remove .eslintignore (ignores now in flat config) - Use @eslint/eslintrc FlatCompat for compatibility with Next.js 15 - Remove eslint-plugin-prettier and eslint-plugin-react (bundled in eslint-config-next) - Remove ESLINT_USE_FLAT_CONFIG=false workaround from scripts
- Create /authors route listing all site authors - Display author avatar, name, and bio snippet - Add Authors.module.scss with grid layout and hover styles - Update QUERY_ALL_USERS to include avatar and description
- Create /tags index page listing all site tags - Create tag archive template for individual tag pages - Add src/data/tags.js with GraphQL query for all tags - Add src/lib/tags.js with getAllTags() and getTags() functions - Update catch-all route to handle Tag typename - Add tags to generateStaticParams for SSG
- Add loading.js with skeleton UI for root and catch-all routes - Redesign error.js with larger error code, cleaner layout, and retry button - Redesign not-found.js with consistent styling - Add shimmer animation for loading skeletons - Create Loading.module.scss with reusable skeleton components
- Remove src/pages.original/ directory (legacy Pages Router reference) - Remove unused Image and Title components - Remove unused usePageMetadata hook - Remove legacy constructPageMetadata and helmetSettingsFromMetadata functions - Remove unused removeExtraSpaces utility function - Clean up commented code from templates (author, category, page, post) - Clean up commented code from layout.js
- Remove redundant site name suffix from archive page titles (posts, categories, tags, authors) - Add Tag fragment to nodeByUri query to properly fetch tag names for metadata
- Upgrade actions to v4 (checkout, setup-node, pnpm/action-setup) - Update pnpm to v9 - Use Node 18.x and 20.x (Next.js 15 requires Node 18.17+) - Remove deprecated 'pnpm export' command - Add pnpm-lock.yaml for CI caching
- Add revalidate = 3600 (1 hour) to all static pages - Create /api/revalidate webhook endpoint for on-demand updates - Pages now cached and served instantly - Rebuilds automatically after 1 hour or via WordPress webhook
|
Nice migration — the catch-all
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Complete migration from Next.js 13 Pages Router to Next.js 15.5 App Router with React 19, including package upgrades, new features, and code cleanup.
Major Changes
fetch()viasrc/lib/request.jseslint.config.mjs)@use/@forwardmigration (no deprecation warnings)New Features
/postsand/posts/page/[page]- Paginated posts archive with SSG/categories- Categories index page/tags- Tags index page with full tag archive support/authors- Authors index page with avatars/search- Client-side search results pagegenerateMetadata- Dynamic SEO metadata for all routesgenerateStaticParams- SSG pre-rendering for posts/pagesArchitecture
[...uriNodes]routenodeByUriqueries for content resolutionpost.js,page.js,category.js,tag.js,author.jsPackage Upgrades
Code Cleanup
src/pages.original/directoryImage,Titleuse-page-metadata.jsTesting Results
All routes tested and passing:
Breaking Changes
Closes previous App Router work from #397