NestCli

Download

Execute through npx:

1
npx nest new <project name>

It can also be installed globally and executed:

1
2
npm i @nestjs/cli -g
nest new <project name>

Regularly updating versions:

1
npm update @nestjs/cli -g

Created App

  • Create your NestJS Application using nest new <project name>

  • You can use nest new -h to view help

Nest new

Run nest -h to view cli options

Options

There are Nest new for creating new projects, Nest generate for creating certain code, Nest build for compiling and building, Nest start for development modes, etc.

  • nest new <project name>: Create NestJs Application.
  • nest new ... --skip-git: Skip create git workspace
  • nest new ... --package-manager(-p): Specify Package Manager
  • etc

In addition to generating the entire project, the nest command can also generate other code, such as controllers, services, modules, etc.

Summary

Nest provides the Nest command in the @nestjs/cli package, which can be used to do many things:

  • Generate project structure and various codes
  • Compile Code
  • Automatic compilation for monitoring file changes
  • Print project dependency information

These are the subcommands:

  • nest new: To quickly create a project
  • nest generate: To quickly generate various codes
  • nest build: Uses tsc or webpack to build code
  • nest start: starts the development service, supporting watch and debugging
  • nest info: Prints dependent versions of node, npm, and Nest packages

Moreover, many options can be configured in nest cli.json, such as generateOptions, compilerOptions, etc.

Comments