Unverified Commit fa8d5581 authored by Delba de Oliveira's avatar Delba de Oliveira Committed by GitHub

Docs: Split Getting Started between App and Pages, improve `Installation` page (#72178)

Prepare **Getting Started** Section for upcoming changes, and work on
the first page: `Installation`.

Closes: 
-
https://linear.app/vercel/issue/DOC-3703/update-how-getting-started-is-handled-in-next-site
-
https://linear.app/vercel/issue/DOC-3694/page-how-to-set-up-a-new-nextjs-project-installation
- https://linear.app/vercel/issue/DOC-3707/create-subsection-for-plugins
- https://linear.app/vercel/issue/DOC-3709/eslint-plugin-api-reference
- https://linear.app/vercel/issue/DOC-3710/typescript-reference-page

### Key Changes: 

- Duplicate Getting Started Section between App and Pages Router docs 
- Since getting started will vary between the routers, each docs needs
to have their own Getting Started section
- Reorganize folder numbers
   
**Installation Page**: 
- Split app and pages router specific information
- Rename "Installation" to "How to set up a Next.js application" for SEO
- Add setup instructions for **TypeScript**
- Add setup instructions for **ESLint**
- Add setup instructions for **Absolute Imports and Module Path
Aliases**

**Side effects from moving content around**:
- Create a subsection in API Reference called **Configuration**. 
   - Add ESLint Plugin page, and update it to follow template
   - Add TypeScript page, and update it to follow template
- Remove the **Absolute Imports and Module Path Aliases** page, it's
small enough to live under the set up instructions.

---------
Co-authored-by: 's avatarRich Haines <hello@richardhaines.dev>
parent 8f99ab20
......@@ -35,14 +35,14 @@ Top-level files are used to configure your application, manage dependencies, run
| ------------------------------------------------------------------------------------------- | --------------------------------------- |
| **Next.js** | |
| [`next.config.js`](/docs/app/api-reference/next-config-js) | Configuration file for Next.js |
| [`package.json`](/docs/getting-started/installation#manual-installation) | Project dependencies and scripts |
| [`package.json`](/docs/app/getting-started/installation#manual-installation) | Project dependencies and scripts |
| [`instrumentation.ts`](/docs/app/building-your-application/optimizing/instrumentation) | OpenTelemetry and Instrumentation file |
| [`middleware.ts`](/docs/app/building-your-application/routing/middleware) | Next.js request middleware |
| [`.env`](/docs/app/building-your-application/configuring/environment-variables) | Environment variables |
| [`.env.local`](/docs/app/building-your-application/configuring/environment-variables) | Local environment variables |
| [`.env.production`](/docs/app/building-your-application/configuring/environment-variables) | Production environment variables |
| [`.env.development`](/docs/app/building-your-application/configuring/environment-variables) | Development environment variables |
| [`.eslintrc.json`](/docs/app/building-your-application/configuring/eslint) | Configuration file for ESLint |
| [`.eslintrc.json`](/docs/app/api-reference/config/eslint) | Configuration file for ESLint |
| `.gitignore` | Git files and folders to ignore |
| `next-env.d.ts` | TypeScript declaration file for Next.js |
| `tsconfig.json` | Configuration file for TypeScript |
......
......@@ -4,7 +4,7 @@ description: Learn how navigation works in Next.js, and how to use the Link Comp
related:
links:
- app/building-your-application/caching
- app/building-your-application/configuring/typescript
- app/api-reference/config/typescript
---
There are four ways to navigate between routes in Next.js:
......
......@@ -7,10 +7,9 @@ related:
- app/building-your-application/routing/defining-routes
- app/building-your-application/routing/route-groups
- app/building-your-application/configuring/src-directory
- app/building-your-application/configuring/absolute-imports-and-module-aliases
---
Apart from [routing folder and file conventions](/docs/getting-started/project-structure#app-routing-conventions), Next.js is **unopinionated** about how you organize and colocate your project files.
Apart from [folder and file conventions](/docs/app/getting-started/project-structure), Next.js is **unopinionated** about how you organize and colocate your project files.
This page shares default behavior and features you can use to organize your project.
......@@ -88,7 +87,7 @@ Since files in the `app` directory can be [safely colocated by default](#safe-co
>
> - While not a framework convention, you might also consider marking files outside private folders as "private" using the same underscore pattern.
> - You can create URL segments that start with an underscore by prefixing the folder name with `%5F` (the URL-encoded form of an underscore): `%5FfolderName`.
> - If you don't use private folders, it would be helpful to know Next.js [special file conventions](/docs/getting-started/project-structure#routing-files) to prevent unexpected naming conflicts.
> - If you don't use private folders, it would be helpful to know Next.js [special file conventions](/docs/app/getting-started/project-structure#routing-files) to prevent unexpected naming conflicts.
### Route Groups
......@@ -125,7 +124,7 @@ Next.js supports storing application code (including `app`) inside an optional [
### Module Path Aliases
Next.js supports [Module Path Aliases](/docs/app/building-your-application/configuring/absolute-imports-and-module-aliases) which make it easier to read and maintain imports across deeply nested project files.
Next.js supports [Module Path Aliases](/docs/app/getting-started/installation#set-up-absolute-imports-and-module-path-aliases) which make it easier to read and maintain imports across deeply nested project files.
```jsx filename="app/dashboard/settings/analytics/page.js"
// before
......
......@@ -137,4 +137,4 @@ export default async function Page({ params }) {
| `app/shop/[[...slug]]/page.js` | `{ slug?: string[] }` |
| `app/[categoryId]/[itemId]/page.js` | `{ categoryId: string, itemId: string }` |
> **Good to know**: This may be done automatically by the [TypeScript plugin](/docs/app/building-your-application/configuring/typescript#typescript-plugin) in the future.
> **Good to know**: This may be done automatically by the [TypeScript plugin](/docs/app/api-reference/config/typescript#ide-plugin) in the future.
......@@ -117,7 +117,7 @@ const nextConfig = {
export default nextConfig
```
- [Ignoring TypeScript Errors](/docs/pages/building-your-application/configuring/typescript#ignoring-typescript-errors)
- [Ignoring TypeScript Errors](/docs/app/api-reference/config/typescript#disabling-typescript-errors-in-production)
- [ESLint in Next.js config](/docs/pages/api-reference/next-config-js/eslint)
Keep in mind that this may produce faulty deploys due to type errors or linting issues.
......
......@@ -200,7 +200,7 @@ module.exports = new Proxy(
## Optional: Handling Absolute Imports and Module Path Aliases
If your project is using [Module Path Aliases](/docs/app/building-your-application/configuring/absolute-imports-and-module-aliases), you will need to configure Jest to resolve the imports by matching the paths option in the `jsconfig.json` file with the `moduleNameMapper` option in the `jest.config.js` file. For example:
If your project is using [Module Path Aliases](/docs/app/getting-started/installation#set-up-absolute-imports-and-module-path-aliases), you will need to configure Jest to resolve the imports by matching the paths option in the `jsconfig.json` file with the `moduleNameMapper` option in the `jest.config.js` file. For example:
```json filename="tsconfig.json or jsconfig.json"
{
......
......@@ -121,7 +121,7 @@ While building your application, we recommend using the following features to en
### Type safety
- **TypeScript and [TS Plugin](/docs/app/building-your-application/configuring/typescript):** Use TypeScript and the TypeScript plugin for better type-safety, and to help you catch errors early.
- **TypeScript and [TS Plugin](/docs/app/api-reference/config/typescript):** Use TypeScript and the TypeScript plugin for better type-safety, and to help you catch errors early.
## Before going to production
......
......@@ -493,6 +493,6 @@ If everything went according to plan, you now have a functioning Next.js applica
- [Optimize images with the `<Image>` component](/docs/app/building-your-application/optimizing/images)
- [Optimize fonts with `next/font`](/docs/app/building-your-application/optimizing/fonts)
- [Optimize third-party scripts with the `<Script>` component](/docs/app/building-your-application/optimizing/scripts)
- [Update your ESLint configuration to support Next.js rules](/docs/app/building-your-application/configuring/eslint)
- [Update your ESLint configuration to support Next.js rules](/docs/app/api-reference/config/eslint)
> **Good to know:** Using a static export [does not currently support](https://github.com/vercel/next.js/issues/54393) using the `useParams` hook.
......@@ -123,7 +123,7 @@ Here's an example of a working `tsconfig.json` with those changes:
```
You can find more information about configuring TypeScript on the
[Next.js docs](/docs/app/building-your-application/configuring/typescript#typescript-plugin).
[Next.js docs](/docs/app/api-reference/config/typescript#ide-plugin).
### Step 4: Create the Root Layout
......@@ -605,4 +605,4 @@ do next:
- [Optimize images with the `<Image>` component](/docs/app/building-your-application/optimizing/images)
- [Optimize fonts with `next/font`](/docs/app/building-your-application/optimizing/fonts)
- [Optimize third-party scripts with the `<Script>` component](/docs/app/building-your-application/optimizing/scripts)
- [Update your ESLint configuration to support Next.js rules](/docs/app/building-your-application/configuring/eslint)
- [Update your ESLint configuration to support Next.js rules](/docs/app/api-reference/config/eslint)
......@@ -685,13 +685,13 @@ export default function Page({ posts }) {
<AppOnly>
If the child of `Link` is a custom component that wraps an `<a>` tag, you must add `passHref` to `Link`. This is necessary if you’re using libraries like [styled-components](https://styled-components.com/). Without this, the `<a>` tag will not have the `href` attribute, which hurts your site's accessibility and might affect SEO. If you're using [ESLint](/docs/app/building-your-application/configuring/eslint#eslint-plugin), there is a built-in rule `next/link-passhref` to ensure correct usage of `passHref`.
If the child of `Link` is a custom component that wraps an `<a>` tag, you must add `passHref` to `Link`. This is necessary if you’re using libraries like [styled-components](https://styled-components.com/). Without this, the `<a>` tag will not have the `href` attribute, which hurts your site's accessibility and might affect SEO. If you're using [ESLint](/docs/pages/api-reference/config/eslint), there is a built-in rule `next/link-passhref` to ensure correct usage of `passHref`.
</AppOnly>
<PagesOnly>
If the child of `Link` is a custom component that wraps an `<a>` tag, you must add `passHref` to `Link`. This is necessary if you’re using libraries like [styled-components](https://styled-components.com/). Without this, the `<a>` tag will not have the `href` attribute, which hurts your site's accessibility and might affect SEO. If you're using [ESLint](/docs/pages/building-your-application/configuring/eslint#eslint-plugin), there is a built-in rule `next/link-passhref` to ensure correct usage of `passHref`.
If the child of `Link` is a custom component that wraps an `<a>` tag, you must add `passHref` to `Link`. This is necessary if you’re using libraries like [styled-components](https://styled-components.com/). Without this, the `<a>` tag will not have the `href` attribute, which hurts your site's accessibility and might affect SEO. If you're using [ESLint](/docs/pages/api-reference/config/eslint), there is a built-in rule `next/link-passhref` to ensure correct usage of `passHref`.
</PagesOnly>
......
......@@ -69,4 +69,4 @@ export default function manifest() {
### Manifest Object
The manifest object contains an extensive list of options that may be updated due to new web standards. For information on all the current options, refer to the `MetadataRoute.Manifest` type in your code editor if using [TypeScript](https://nextjs.org/docs/app/building-your-application/configuring/typescript#typescript-plugin) or see the [MDN](https://developer.mozilla.org/docs/Web/Manifest) docs.
The manifest object contains an extensive list of options that may be updated due to new web standards. For information on all the current options, refer to the `MetadataRoute.Manifest` type in your code editor if using [TypeScript](https://nextjs.org/docs/app/api-reference/config/typescript#ide-plugin) or see the [MDN](https://developer.mozilla.org/docs/Web/Manifest) docs.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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