Skip to content

Commit 1e6d204

Browse files
docs: Refactor next and create-next-app CLI pages (vercel#68899)
Closes: https://linear.app/vercel/issue/DOC-3249/cli-reference-pages Updates the `next` and `create-next-app` CLI pages to follow the reference page template. Moves these pages under "CLI" to match new IA. Redirects: vercel#68899
1 parent f252795 commit 1e6d204

File tree

26 files changed

+369
-613
lines changed

26 files changed

+369
-613
lines changed

docs/01-getting-started/01-installation.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ System Requirements:
1515

1616
## Automatic Installation
1717

18-
We recommend starting a new Next.js app using [`create-next-app`](/docs/app/api-reference/create-next-app), which sets up everything automatically for you. To create a project, run:
18+
We recommend starting a new Next.js app using [`create-next-app`](/docs/app/api-reference/cli/create-next-app), which sets up everything automatically for you. To create a project, run:
1919

2020
```bash filename="Terminal"
2121
npx create-next-app@latest
@@ -35,7 +35,7 @@ Would you like to customize the import alias (`@/*` by default)? No / Yes
3535
What import alias would you like configured? @/*
3636
```
3737

38-
After the prompts, [`create-next-app`](/docs/app/api-reference/create-next-app) will create a folder with your project name and install the required dependencies.
38+
After the prompts, [`create-next-app`](/docs/app/api-reference/cli/create-next-app) will create a folder with your project name and install the required dependencies.
3939

4040
If you're new to Next.js, see the [project structure](/docs/getting-started/project-structure) docs for an overview of all the possible files and folders in your application.
4141

@@ -67,10 +67,10 @@ Open your `package.json` file and add the following `scripts`:
6767

6868
These scripts refer to the different stages of developing an application:
6969

70-
- `dev`: runs [`next dev`](/docs/app/api-reference/next-cli#development) to start Next.js in development mode.
71-
- `build`: runs [`next build`](/docs/app/api-reference/next-cli#build) to build the application for production usage.
72-
- `start`: runs [`next start`](/docs/app/api-reference/next-cli#production) to start a Next.js production server.
73-
- `lint`: runs [`next lint`](/docs/app/api-reference/next-cli#lint) to set up Next.js' built-in ESLint configuration.
70+
- `dev`: runs [`next dev`](/docs/app/api-reference/cli/next#next-dev-options) to start Next.js in development mode.
71+
- `build`: runs [`next build`](/docs/app/api-reference/cli/next#next-build-options) to build the application for production usage.
72+
- `start`: runs [`next start`](/docs/app/api-reference/cli/next#next-start-options) to start a Next.js production server.
73+
- `lint`: runs [`next lint`](/docs/app/api-reference/cli/next#next-lint-options) to set up Next.js' built-in ESLint configuration.
7474

7575
### Creating directories
7676

docs/02-app/01-building-your-application/06-optimizing/11-static-assets.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ For static metadata files, such as `robots.txt`, `favicon.ico`, etc, you should
4747
> Good to know:
4848
>
4949
> - The directory must be named `public`. The name cannot be changed and it's the only directory used to serve static assets.
50-
> - Only assets that are in the `public` directory at [build time](/docs/app/api-reference/next-cli#build) will be served by Next.js. Files added at request time won't be available. We recommend using a third-party service like [Vercel Blob](https://vercel.com/docs/storage/vercel-blob?utm_source=next-site&utm_medium=docs&utm_campaign=next-website) for persistent file storage.
50+
> - Only assets that are in the `public` directory at [build time](/docs/app/api-reference/cli/next#next-build-options) will be served by Next.js. Files added at request time won't be available. We recommend using a third-party service like [Vercel Blob](https://vercel.com/docs/storage/vercel-blob?utm_source=next-site&utm_medium=docs&utm_campaign=next-website) for persistent file storage.

docs/02-app/01-building-your-application/07-configuring/02-eslint.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ The `next/core-web-vitals` rule set is enabled when `next lint` is run for the f
200200

201201
`next/core-web-vitals` updates `eslint-plugin-next` to error on a number of rules that are warnings by default if they affect [Core Web Vitals](https://web.dev/vitals/).
202202

203-
> The `next/core-web-vitals` entry point is automatically included for new applications built with [Create Next App](/docs/app/api-reference/create-next-app).
203+
> The `next/core-web-vitals` entry point is automatically included for new applications built with [Create Next App](/docs/app/api-reference/cli/create-next-app).
204204
205205
### TypeScript
206206

docs/02-app/02-api-reference/05-next-config-js/exportPathMap.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ description: Customize the pages that will be exported as HTML files when using
1515

1616
</details>
1717

18-
`exportPathMap` allows you to specify a mapping of request paths to page destinations, to be used during export. Paths defined in `exportPathMap` will also be available when using [`next dev`](/docs/app/api-reference/next-cli#development).
18+
`exportPathMap` allows you to specify a mapping of request paths to page destinations, to be used during export. Paths defined in `exportPathMap` will also be available when using [`next dev`](/docs/app/api-reference/cli/next#next-dev-options).
1919

2020
Let's start with an example, to create a custom `exportPathMap` for an app with the following pages:
2121

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
title: create-next-app
3+
description: Create Next.js apps using one command with the create-next-app CLI.
4+
---
5+
6+
{/* The content of this doc is shared between the app and pages router. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}
7+
8+
The `create-next-app` CLI allow you to quickly create a new Next.js application using the default template or an [example](https://github.com/vercel/next.js/tree/canary/examples) from a public Github repository. It is the easiest way to get started with Next.js.
9+
10+
Basic usage:
11+
12+
```bash filename="Terminal"
13+
npx create-next-app@latest [project-name] [options]
14+
```
15+
16+
## Reference
17+
18+
The following options are available:
19+
20+
| Options | Description |
21+
| --------------------------------------- | --------------------------------------------------------------- |
22+
| `-h` or `--help` | Show all available options |
23+
| `-v` or `--version` | Output the version number |
24+
| `--no-*` | Negate default options. E.g. `--no-eslint` |
25+
| `--ts` or `--typescript` | Initialize as a TypeScript project (default) |
26+
| `--js` or `--javascript` | Initialize as a JavaScript project |
27+
| `--tailwind` | Initialize with Tailwind CSS config (default) |
28+
| `--eslint` | Initialize with ESLint config |
29+
| `--app` | Initialize as an App Router project |
30+
| `--src-dir` | Initialize inside a `src/` directory |
31+
| `--turbo` | Enable Turbopack by default for development |
32+
| `--import-alias <alias-to-configure>` | Specify import alias to use (default "@/\*") |
33+
| `--empty` | Initialize an empty project |
34+
| `--use-npm` | Explicitly tell the CLI to bootstrap the application using npm |
35+
| `--use-pnpm` | Explicitly tell the CLI to bootstrap the application using pnpm |
36+
| `--use-yarn` | Explicitly tell the CLI to bootstrap the application using Yarn |
37+
| `--use-bun` | Explicitly tell the CLI to bootstrap the application using Bun |
38+
| `-e` or `--example [name] [github-url]` | An example to bootstrap the app with |
39+
| `--example-path <path-to-example>` | Specify the path to the example separately |
40+
| `--reset-preferences` | Explicitly tell the CLI to reset any stored preferences |
41+
| `--skip-install` | Explicitly tell the CLI to skip installing packages |
42+
| `--yes` | Use previous preferences or defaults for all options |
43+
44+
## Examples
45+
46+
## With the default template
47+
48+
To create a new app using the default template, run the following command in your terminal:
49+
50+
```bash filename="Terminal"
51+
npx create-next-app@latest
52+
```
53+
54+
You will then be asked the following prompts:
55+
56+
```txt filename="Terminal"
57+
What is your project named? my-app
58+
Would you like to use TypeScript? No / Yes
59+
Would you like to use ESLint? No / Yes
60+
Would you like to use Tailwind CSS? No / Yes
61+
Would you like your code inside a `src/` directory? No / Yes
62+
Would you like to use App Router? (recommended) No / Yes
63+
Would you like to use Turbopack for `next dev`? No / Yes
64+
Would you like to customize the import alias (`@/*` by default)? No / Yes
65+
```
66+
67+
Once you've answered the prompts, a new project will be created with your chosen configuration.
68+
69+
## With an official Next.js example
70+
71+
To create a new app using an official Next.js example, use the `--example` flag with the following command:
72+
73+
```bash filename="Terminal"
74+
npx create-next-app@latest --example [your-project-name] [example-name]
75+
```
76+
77+
You can view a list of all available examples along with setup instructions in the [Next.js repository](https://github.com/vercel/next.js/tree/canary/examples).
78+
79+
## With any public Github example
80+
81+
To create a new app using any public Github example, use the `--example` option with the Github repo's URL. For example:
82+
83+
```bash filename="Terminal"
84+
npx create-next-app@latest --example [your-project-name] "https://github.com/.../"
85+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: CLI
3+
description: API Reference for the Next.js Command Line Interface (CLI) tools.
4+
---
5+
6+
{/* The content of this doc is shared between the app and pages router. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}
7+
8+
Next.js comes with **two** Command Line Interface (CLI) tools:
9+
10+
- **`create-next-app`**: Quickly create a new Next.js application using the default template or an [example](https://github.com/vercel/next.js/tree/canary/examples) from a public Github repository.
11+
- **`next`**: Run the Next.js development server, build your application, and more.

0 commit comments

Comments
 (0)