-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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. Backport notes: skipped all templates introduced for `--empty` in #65532 Redirects: #68899
- Loading branch information
1 parent
d932a5d
commit 96d6083
Showing
22 changed files
with
374 additions
and
600 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
--- | ||
title: create-next-app | ||
description: Create Next.js apps using one command with the create-next-app CLI. | ||
--- | ||
|
||
{/* 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. */} | ||
|
||
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. | ||
|
||
Basic usage: | ||
|
||
```bash filename="Terminal" | ||
npx create-next-app@latest [project-name] [options] | ||
``` | ||
|
||
## Reference | ||
|
||
The following options are available: | ||
|
||
| Options | Description | | ||
| --------------------------------------- | --------------------------------------------------------------- | | ||
| `-h` or `--help` | Show all available options | | ||
| `-v` or `--version` | Output the version number | | ||
| `--no-*` | Negate default options. E.g. `--no-eslint` | | ||
| `--ts` or `--typescript` | Initialize as a TypeScript project (default) | | ||
| `--js` or `--javascript` | Initialize as a JavaScript project | | ||
| `--tailwind` | Initialize with Tailwind CSS config (default) | | ||
| `--eslint` | Initialize with ESLint config | | ||
| `--app` | Initialize as an App Router project | | ||
| `--src-dir` | Initialize inside a `src/` directory | | ||
| `--turbo` | Enable Turbopack by default for development | | ||
| `--import-alias <alias-to-configure>` | Specify import alias to use (default "@/\*") | | ||
| `--empty` | Initialize an empty project | | ||
| `--use-npm` | Explicitly tell the CLI to bootstrap the application using npm | | ||
| `--use-pnpm` | Explicitly tell the CLI to bootstrap the application using pnpm | | ||
| `--use-yarn` | Explicitly tell the CLI to bootstrap the application using Yarn | | ||
| `--use-bun` | Explicitly tell the CLI to bootstrap the application using Bun | | ||
| `-e` or `--example [name] [github-url]` | An example to bootstrap the app with | | ||
| `--example-path <path-to-example>` | Specify the path to the example separately | | ||
| `--reset-preferences` | Explicitly tell the CLI to reset any stored preferences | | ||
| `--skip-install` | Explicitly tell the CLI to skip installing packages | | ||
| `--yes` | Use previous preferences or defaults for all options | | ||
|
||
## Examples | ||
|
||
## With the default template | ||
|
||
To create a new app using the default template, run the following command in your terminal: | ||
|
||
```bash filename="Terminal" | ||
npx create-next-app@latest | ||
``` | ||
|
||
You will then be asked the following prompts: | ||
|
||
```txt filename="Terminal" | ||
What is your project named? my-app | ||
Would you like to use TypeScript? No / Yes | ||
Would you like to use ESLint? No / Yes | ||
Would you like to use Tailwind CSS? No / Yes | ||
Would you like your code inside a `src/` directory? No / Yes | ||
Would you like to use App Router? (recommended) No / Yes | ||
Would you like to use Turbopack for `next dev`? No / Yes | ||
Would you like to customize the import alias (`@/*` by default)? No / Yes | ||
``` | ||
|
||
Once you've answered the prompts, a new project will be created with your chosen configuration. | ||
|
||
## With an official Next.js example | ||
|
||
To create a new app using an official Next.js example, use the `--example` flag with the following command: | ||
|
||
```bash filename="Terminal" | ||
npx create-next-app@latest --example [your-project-name] [example-name] | ||
``` | ||
|
||
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). | ||
|
||
## With any public Github example | ||
|
||
To create a new app using any public Github example, use the `--example` option with the Github repo's URL. For example: | ||
|
||
```bash filename="Terminal" | ||
npx create-next-app@latest --example [your-project-name] "https://github.com/.../" | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
title: CLI | ||
description: API Reference for the Next.js Command Line Interface (CLI) tools. | ||
--- | ||
|
||
{/* 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. */} | ||
|
||
Next.js comes with **two** Command Line Interface (CLI) tools: | ||
|
||
- **`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. | ||
- **`next`**: Run the Next.js development server, build your application, and more. |
Oops, something went wrong.