mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 16:43:55 +00:00
105 lines
3.6 KiB
Markdown
105 lines
3.6 KiB
Markdown
# Nuxi CLI
|
|
|
|
Nuxi is the new Command-line interface (CLI) for Nuxt 3. This page references the commands and options of Nuxi.
|
|
|
|
## Init
|
|
|
|
```{bash}
|
|
npx nuxi init|create [--verbose|-v] [--template,-t] [dir]
|
|
```
|
|
|
|
The `init` command initializes a fresh Nuxt project.
|
|
|
|
Option | Default | Description
|
|
-------------------------|-----------------|------------------
|
|
`--verbose, -v` | `false` | Log informations about the installation process.
|
|
`--template, -t` | `nuxt/starter#v3` | Specify a Git repository to use as a template.
|
|
`dir` | `nuxt-app` | Name of the install directory.
|
|
|
|
## Dev
|
|
|
|
```{bash}
|
|
npx nuxi dev [rootDir] [--clipboard] [--open, -o] [--port, -p] [--host, -h] [--https] [--ssl-cert] [--ssl-key]
|
|
```
|
|
|
|
The `dev` command starts a development server with hot module replacement at [http://localhost:3000](https://localhost:3000)
|
|
|
|
Option | Default | Description
|
|
-------------------------|-----------------|------------------
|
|
`rootDir` | `.` | The root directory of the application to serve.
|
|
`--clipboard` | `false` | Copy URL to clipboard.
|
|
`--open, -o` | `false` | Open URL in browser.
|
|
`--port, -p` | `3000` | Port to listen.
|
|
`--host, -h` | `localhost` | Hostname of the server.
|
|
`--https` | `false` | Listen with `https` protocol with a self-signed certificate by default.
|
|
`--ssl-cert` |`null` | Specify a certificate for https.
|
|
`--ssl-key` |`null` | Specify the key for the https certificate.
|
|
|
|
This command sets `process.env.NODE_ENV` to `development`. To override, define `NODE_ENV` in a `.env` file or as command-line argument.
|
|
|
|
## Build
|
|
|
|
```{bash}
|
|
npx nuxi build [rootDir]
|
|
```
|
|
|
|
The `build` command creates a `.output` directory with all your application, server and dependencies ready for production.
|
|
|
|
Option | Default | Description
|
|
-------------------------|-----------------|------------------
|
|
`rootDir` | `.` | The root directory of the application to bundle.
|
|
|
|
This command sets `process.env.NODE_ENV` to `production`. To override, define `NODE_ENV` in a `.env` file or as command-line argument.
|
|
|
|
## Preview
|
|
|
|
```{bash}
|
|
npx nuxi preview [rootDir]
|
|
```
|
|
|
|
The `preview` command starts a server to preview your Nuxt application after running the `build` command.
|
|
|
|
Option | Default | Description
|
|
-------------------------|-----------------|------------------
|
|
`rootDir` | `.` | The root directory of the application to preview.
|
|
|
|
This command sets `process.env.NODE_ENV` to `production`. To override, define `NODE_ENV` in a `.env` file or as command-line argument.
|
|
|
|
## Info
|
|
|
|
```{bash}
|
|
npx nuxi info [rootDir]
|
|
```
|
|
|
|
The `info` command logs informations about the current or specified Nuxt project.
|
|
|
|
Option | Default | Description
|
|
-------------------------|-----------------|------------------
|
|
`rootDir` | `.` | The directory of the target application.
|
|
|
|
## Typecheck
|
|
|
|
```{bash}
|
|
npx nuxi typecheck [rootDir]
|
|
```
|
|
|
|
The `typecheck` command runs [`vue-tsc`](https://github.com/johnsoncodehk/volar/tree/master/packages/vue-tsc) to check types throughout your app.
|
|
|
|
Option | Default | Description
|
|
-------------------------|-----------------|------------------
|
|
`rootDir` | `.` | The directory of the target application.
|
|
|
|
This command sets `process.env.NODE_ENV` to `production`. To override, define `NODE_ENV` in a `.env` file or as command-line argument.
|
|
|
|
## Upgrade
|
|
|
|
```{bash}
|
|
npx nuxi upgrade [--force|-f]
|
|
```
|
|
|
|
The `upgrade` command upgrades Nuxt 3 to the latest version.
|
|
|
|
Option | Default | Description
|
|
-------------------------|-----------------|------------------
|
|
`--force, -f` | `false` | Removes `node_modules` and lock files before upgrade.
|