Commit d67b5dae authored by Cursor Agent's avatar Cursor Agent

Fix outdated documentation links in examples and packages

Update all references from deprecated /docs/advanced-features/* and /docs/api-routes/* paths to their current locations:
- Codemods, multi-zones, compiler, opentelemetry
- Custom app/document, automatic static optimization
- Output file tracing, module path aliases
- Internationalization, API routes
Co-authored-by: 's avatarismael <ismael@vercel.com>
parent 4ca0393c
# Consume local Apollo GraphQL schema to create Static Generation export # Consume local Apollo GraphQL schema to create Static Generation export
Next.js ships with two forms of pre-rendering: [Static Generation](https://nextjs.org/docs/basic-features/pages#static-generation-recommended) and [Server-side Rendering](https://nextjs.org/docs/basic-features/pages#server-side-rendering). This example shows how to perform Static Generation using a local [Apollo GraphQL Server ](https://www.apollographql.com/docs/apollo-server/) schema within [getStaticProps](https://nextjs.org/docs/basic-features/data-fetching/get-static-props) and [getStaticPaths](https://nextjs.org/docs/pages/building-your-application/data-fetching/get-static-paths). The end result is a Next.js application that uses one Apollo GraphQL schema to generate static pages at build time and also serve a GraphQL [API Route](https://nextjs.org/docs/api-routes/introduction) at runtime. The integration with Next and Apollo Server is implemented using the [apollo-server-integration-next](https://github.com/apollo-server-integrations/apollo-server-integration-next) community package. Next.js ships with two forms of pre-rendering: [Static Generation](https://nextjs.org/docs/basic-features/pages#static-generation-recommended) and [Server-side Rendering](https://nextjs.org/docs/basic-features/pages#server-side-rendering). This example shows how to perform Static Generation using a local [Apollo GraphQL Server ](https://www.apollographql.com/docs/apollo-server/) schema within [getStaticProps](https://nextjs.org/docs/basic-features/data-fetching/get-static-props) and [getStaticPaths](https://nextjs.org/docs/pages/building-your-application/data-fetching/get-static-paths). The end result is a Next.js application that uses one Apollo GraphQL schema to generate static pages at build time and also serve a GraphQL [API Route](https://nextjs.org/docs/pages/building-your-application/routing/api-routes) at runtime. The integration with Next and Apollo Server is implemented using the [apollo-server-integration-next](https://github.com/apollo-server-integrations/apollo-server-integration-next) community package.
## Deploy your own ## Deploy your own
......
# API Routes Example with CORS # API Routes Example with CORS
Next.js ships with [API routes](https://nextjs.org/docs/api-routes/introduction) which provides an easy solution to build your own `API`. Next.js ships with [API routes](https://nextjs.org/docs/pages/building-your-application/routing/api-routes) which provides an easy solution to build your own `API`.
This example shows how to create an `API` endpoint with [CORS](https://developer.mozilla.org/docs/Web/HTTP/CORS) headers, using the [cors](https://github.com/expressjs/cors) package. This example shows how to create an `API` endpoint with [CORS](https://developer.mozilla.org/docs/Web/HTTP/CORS) headers, using the [cors](https://github.com/expressjs/cors) package.
......
# API routes with GraphQL server # API routes with GraphQL server
Next.js ships with [API routes](https://nextjs.org/docs/api-routes/introduction), which provide an easy solution to build your own `API`. Next.js ships with [API routes](https://nextjs.org/docs/pages/building-your-application/routing/api-routes), which provide an easy solution to build your own `API`.
This example showcases how to build a lightweight and blazing fast GraphQL API with minimum configuration using GraphQL Yoga. This example showcases how to build a lightweight and blazing fast GraphQL API with minimum configuration using GraphQL Yoga.
GraphQL Yoga comes with strong defaults: GraphQL Yoga comes with strong defaults:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
This example shows how to create internationalized pages using Next.js and the i18n routing feature. It shows a normal page, a non-dynamic `getStaticProps` page, a dynamic `getStaticProps` page, and a `getServerSideProps` page. This example shows how to create internationalized pages using Next.js and the i18n routing feature. It shows a normal page, a non-dynamic `getStaticProps` page, a dynamic `getStaticProps` page, and a `getServerSideProps` page.
For further documentation on this feature see the [Internationalized Routing docs](https://nextjs.org/docs/advanced-features/i18n-routing-pages). For further documentation on this feature see the [Internationalized Routing docs](https://nextjs.org/docs/pages/guides/internationalization).
## Deploy your own ## Deploy your own
......
# React Remove Properties Example # React Remove Properties Example
This example shows how to use the Next.js [reactRemoveProperties](https://nextjs.org/docs/advanced-features/compiler#remove-react-properties) config option to remove React properties. This example shows how to use the Next.js [reactRemoveProperties](https://nextjs.org/docs/architecture/nextjs-compiler#remove-react-properties) config option to remove React properties.
## Deploy your own ## Deploy your own
......
# Absolute Imports and Aliases # Absolute Imports and Aliases
This example shows how to configure [Absolute imports and Module path aliases](https://nextjs.org/docs/advanced-features/module-path-aliases) in `tsconfig.json` (or `jsconfig.json` for JavaScript projects). These options will allow absolute imports from `.` (the root directory), and allow you to create custom import aliases. This example shows how to configure [Absolute imports and Module path aliases](https://nextjs.org/docs/app/getting-started/installation#set-up-absolute-imports-and-module-path-aliases) in `tsconfig.json` (or `jsconfig.json` for JavaScript projects). These options will allow absolute imports from `.` (the root directory), and allow you to create custom import aliases.
If you’re working on a large project, your relative import statements might suffer from `../../../` spaghetti: If you’re working on a large project, your relative import statements might suffer from `../../../` spaghetti:
......
...@@ -7,7 +7,7 @@ This example contains everything needed to get a Next.js development and product ...@@ -7,7 +7,7 @@ This example contains everything needed to get a Next.js development and product
- Develop locally without Node.js or TypeScript installed ✨ - Develop locally without Node.js or TypeScript installed ✨
- Easy to run, consistent development environment across macOS, Windows, and Linux teams - Easy to run, consistent development environment across macOS, Windows, and Linux teams
- Run multiple Next.js apps, databases, and other microservices in a single deployment - Run multiple Next.js apps, databases, and other microservices in a single deployment
- Multistage builds combined with [Output Standalone](https://nextjs.org/docs/advanced-features/output-file-tracing#automatically-copying-traced-files) outputs up to 85% smaller apps (Approximately 110 MB compared to 1 GB with create-next-app) - Multistage builds combined with [Output Standalone](https://nextjs.org/docs/app/api-reference/config/next-config-js/output#automatically-copying-traced-files) outputs up to 85% smaller apps (Approximately 110 MB compared to 1 GB with create-next-app)
- Easy configuration with YAML files - Easy configuration with YAML files
## How to use ## How to use
...@@ -58,7 +58,7 @@ You can start editing the page by modifying `pages/index.tsx`. The page auto-upd ...@@ -58,7 +58,7 @@ You can start editing the page by modifying `pages/index.tsx`. The page auto-upd
## Production ## Production
Multistage builds are highly recommended in production. Combined with the Next [Output Standalone](https://nextjs.org/docs/advanced-features/output-file-tracing#automatically-copying-traced-files) feature, only `node_modules` files required for production are copied into the final Docker image. Multistage builds are highly recommended in production. Combined with the Next [Output Standalone](https://nextjs.org/docs/app/api-reference/config/next-config-js/output#automatically-copying-traced-files) feature, only `node_modules` files required for production are copied into the final Docker image.
First, run the production server (Final image approximately 110 MB). First, run the production server (Final image approximately 110 MB).
......
...@@ -63,6 +63,6 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the ...@@ -63,6 +63,6 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file. You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`. [API routes](https://nextjs.org/docs/pages/building-your-application/routing/api-routes) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/pages/building-your-application/routing/api-routes) instead of React pages.
...@@ -78,6 +78,6 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the ...@@ -78,6 +78,6 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file. You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`. [API routes](https://nextjs.org/docs/pages/building-your-application/routing/api-routes) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/pages/building-your-application/routing/api-routes) instead of React pages.
## Example app using Facebook Pixel ## Example app using Facebook Pixel
This example shows how to use Next.js along with Facebook Pixel. A custom [\_document](https://nextjs.org/docs/advanced-features/custom-document) is used to inject [base code](https://developers.facebook.com/docs/facebook-pixel/implementation/?locale=en_US). A [\_app](https://nextjs.org/docs/advanced-features/custom-app) is used to track route changes and send page views to Facebook Pixel. This example shows how to use Next.js along with Facebook Pixel. A custom [\_document](https://nextjs.org/docs/pages/building-your-application/routing/custom-document) is used to inject [base code](https://developers.facebook.com/docs/facebook-pixel/implementation/?locale=en_US). A [\_app](https://nextjs.org/docs/pages/building-your-application/routing/custom-app) is used to track route changes and send page views to Facebook Pixel.
## Deploy your own ## Deploy your own
......
# framer-motion example # framer-motion example
Framer [`Motion`](https://github.com/framer/motion) is a production-ready animation library. By using a custom [`<App>`](https://nextjs.org/docs/advanced-features/custom-app) along with Motion's [`AnimatePresence`](https://www.framer.com/api/motion/animate-presence/) component, transitions between Next pages becomes simple and declarative. Framer [`Motion`](https://github.com/framer/motion) is a production-ready animation library. By using a custom [`<App>`](https://nextjs.org/docs/pages/building-your-application/routing/custom-app) along with Motion's [`AnimatePresence`](https://www.framer.com/api/motion/animate-presence/) component, transitions between Next pages becomes simple and declarative.
When using Next's `<Link>` component, you will likely want to [disable the default scroll behavior](https://nextjs.org/docs/api-reference/next/link#disable-scrolling-to-the-top-of-the-page) for a more seamless navigation experience. Scrolling to the top of a page can be re-enabled by adding a `onExitComplete` callback on the `AnimatePresence` component. When using Next's `<Link>` component, you will likely want to [disable the default scroll behavior](https://nextjs.org/docs/api-reference/next/link#disable-scrolling-to-the-top-of-the-page) for a more seamless navigation experience. Scrolling to the top of a page can be re-enabled by adding a `onExitComplete` callback on the `AnimatePresence` component.
......
...@@ -27,4 +27,4 @@ Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&ut ...@@ -27,4 +27,4 @@ Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&ut
## Notes ## Notes
This example is a basic starting point for using [next-translate](https://github.com/vinissimus/next-translate) with Next.js. This example is a basic starting point for using [next-translate](https://github.com/vinissimus/next-translate) with Next.js.
It's a tool to translate Next.js applications respecting the [Automatic Static Optimization](https://nextjs.org/docs/advanced-features/automatic-static-optimization). Deploy static sites with full i18n support! It's a tool to translate Next.js applications respecting the [Automatic Static Optimization](https://nextjs.org/docs/pages/building-your-application/rendering/automatic-static-optimization). Deploy static sites with full i18n support!
...@@ -9,7 +9,7 @@ You can easily deploy this example on Vercel. It manages OpenTelemetry collector ...@@ -9,7 +9,7 @@ You can easily deploy this example on Vercel. It manages OpenTelemetry collector
But you need to run your own collector if you want to test OpenTelemetry locally. We recommend cloning pre-made [dev setup](https://github.com/vercel/opentelemetry-collector-dev-setup). It contains pre-configured docker images for Collector, ZipKin, Jaeger and Prometheus. But you need to run your own collector if you want to test OpenTelemetry locally. We recommend cloning pre-made [dev setup](https://github.com/vercel/opentelemetry-collector-dev-setup). It contains pre-configured docker images for Collector, ZipKin, Jaeger and Prometheus.
More information about OpenTelemetry can be found in [Next.js docs](https://nextjs.org/docs/advanced-features/open-telemetry). More information about OpenTelemetry can be found in [Next.js docs](https://nextjs.org/docs/app/guides/open-telemetry).
## Deploy your own ## Deploy your own
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
This example features how you use a different styling solution than [styled-jsx](https://github.com/vercel/styled-jsx) that also supports universal styles. That means we can serve the required styles for the first render within the HTML and then load the rest in the client. In this case we are using [styled-components](https://github.com/styled-components/styled-components). This example features how you use a different styling solution than [styled-jsx](https://github.com/vercel/styled-jsx) that also supports universal styles. That means we can serve the required styles for the first render within the HTML and then load the rest in the client. In this case we are using [styled-components](https://github.com/styled-components/styled-components).
This example uses the Rust-based [SWC](https://nextjs.org/docs/advanced-features/compiler#styled-components) in Next.js for better performance than Babel. This example uses the Rust-based [SWC](https://nextjs.org/docs/architecture/nextjs-compiler#styled-components) in Next.js for better performance than Babel.
Currently, only the `ssr` and `displayName` transforms have been implemented. These two transforms are the main requirement for using `styled-components` in Next.js. Currently, only the `ssr` and `displayName` transforms have been implemented. These two transforms are the main requirement for using `styled-components` in Next.js.
......
# Temporal + Next.js Example # Temporal + Next.js Example
This is a starter project for creating resilient Next.js applications with [Temporal](https://temporal.io/). Whenever our [API routes](https://nextjs.org/docs/api-routes/introduction) need to do any of the following, we can greatly increase our code's fault tolerance by using Temporal: This is a starter project for creating resilient Next.js applications with [Temporal](https://temporal.io/). Whenever our [API routes](https://nextjs.org/docs/pages/building-your-application/routing/api-routes) need to do any of the following, we can greatly increase our code's fault tolerance by using Temporal:
- Perform a series of network requests (to a database, another function, an internal service, or an external API), any of which may fail. Temporal will automatically set timeouts and retry, as well as remember the state of execution in the event of power loss. - Perform a series of network requests (to a database, another function, an internal service, or an external API), any of which may fail. Temporal will automatically set timeouts and retry, as well as remember the state of execution in the event of power loss.
- Long-running tasks - Long-running tasks
......
# Multi-Zone Next.js Applications # Multi-Zone Next.js Applications
This is an example that demonstrates how to serve multiple Next.js applications from a single domain, called [Multi Zones](https://nextjs.org/docs/advanced-features/multi-zones). This is an example that demonstrates how to serve multiple Next.js applications from a single domain, called [Multi Zones](https://nextjs.org/docs/app/guides/multi-zones).
Multi Zones are an approach to micro-frontends that separate a single large application on a domain into smaller applications that each serve a set of paths. Multi Zones are an approach to micro-frontends that separate a single large application on a domain into smaller applications that each serve a set of paths.
This is useful when there are collections of pages unrelated to the other pages in the application. By moving those pages to a separate zone, you can reduce the size of the application which improves build times and removes code that is only necessary for one of the zones. This is useful when there are collections of pages unrelated to the other pages in the application. By moving those pages to a separate zone, you can reduce the size of the application which improves build times and removes code that is only necessary for one of the zones.
......
...@@ -6,4 +6,4 @@ Codemods are transformations that run on your codebase programmatically. This al ...@@ -6,4 +6,4 @@ Codemods are transformations that run on your codebase programmatically. This al
## Documentation ## Documentation
Visit [nextjs.org/docs/advanced-features/codemods](https://nextjs.org/docs/app/guides/upgrading/codemods) to view the documentation for this package. Visit [nextjs.org/docs/app/guides/upgrading/codemods](https://nextjs.org/docs/app/guides/upgrading/codemods) to view the documentation for this package.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment