Skip to content

Commit 6cca9a4

Browse files
Merge pull request #2749 from nestjs/docs/cli-builders
docs: add docs on cli builders (swc)
2 parents 7fe2049 + 4530635 commit 6cca9a4

File tree

8 files changed

+230
-69
lines changed

8 files changed

+230
-69
lines changed

content/cli/overview.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ $ npm run start:dev
3838

3939
In your browser, open [http://localhost:3000](http://localhost:3000) to see the new application running. The app will automatically recompile and reload when you change any of the source files.
4040

41+
> info **Hint** We recommend using the [SWC builder](/recipes/swc) for faster builds (10x more performant than the default TypeScript compiler).
42+
4143
#### Project structure
4244

4345
When you run `nest new`, Nest generates a boilerplate application structure by creating a new folder and populating an initial set of files. You can continue working in this default structure, adding new components, as described throughout this documentation. We refer to the project structure generated by `nest new` as **standard mode**. Nest also supports an alternate structure for managing multiple projects and libraries called **monorepo mode**.

content/cli/scripts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The `nest` command is an OS level binary (i.e., runs from the OS command line).
1616

1717
#### Build
1818

19-
`nest build` is a wrapper on top of the standard `tsc` compiler (for [standard projects](https://docs.nestjs.com/cli/overview#project-structure)) or the webpack bundler using the `ts-loader` (for [monorepos](https://docs.nestjs.com/cli/overview#project-structure)). It does not add any other compilation features or steps except for handling `tsconfig-paths` out of the box. The reason it exists is that most developers, especially when starting out with Nest, do not need to adjust compiler options (e.g., `tsconfig.json` file) which can sometimes be tricky.
19+
`nest build` is a wrapper on top of the standard `tsc` compiler or `swc` compiler (for [standard projects](https://docs.nestjs.com/cli/overview#project-structure)) or the webpack bundler using the `ts-loader` (for [monorepos](https://docs.nestjs.com/cli/overview#project-structure)). It does not add any other compilation features or steps except for handling `tsconfig-paths` out of the box. The reason it exists is that most developers, especially when starting out with Nest, do not need to adjust compiler options (e.g., `tsconfig.json` file) which can sometimes be tricky.
2020

2121
See the [nest build](https://docs.nestjs.com/cli/usages#nest-build) documentation for more details.
2222

content/cli/usages.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ Creates and initializes a new Nest project. Prompts for package manager.
2626

2727
##### Options
2828

29-
| Option | Description |
30-
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
31-
| `--dry-run` | Reports changes that would be made, but does not change the filesystem.<br/> Alias: `-d` |
32-
| `--skip-git` | Skip git repository initialization.<br/> Alias: `-g` |
33-
| `--skip-install` | Skip package installation.<br/> Alias: `-s` |
34-
| `--package-manager [package-manager]` | Specify package manager. Use `npm`, `yarn`, or `pnpm`. Package manager must be installed globally.<br/> Alias: `-p` |
35-
| `--language [language]` | Specify programming language (`TS` or `JS`).<br/> Alias: `-l` |
36-
| `--collection [collectionName]` | Specify schematics collection. Use package name of installed npm package containing schematic.<br/> Alias: `-c` |
29+
| Option | Description |
30+
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
31+
| `--dry-run` | Reports changes that would be made, but does not change the filesystem.<br/> Alias: `-d` |
32+
| `--skip-git` | Skip git repository initialization.<br/> Alias: `-g` |
33+
| `--skip-install` | Skip package installation.<br/> Alias: `-s` |
34+
| `--package-manager [package-manager]` | Specify package manager. Use `npm`, `yarn`, or `pnpm`. Package manager must be installed globally.<br/> Alias: `-p` |
35+
| `--language [language]` | Specify programming language (`TS` or `JS`).<br/> Alias: `-l` |
36+
| `--collection [collectionName]` | Specify schematics collection. Use package name of installed npm package containing schematic.<br/> Alias: `-c` |
3737
| `--strict` | Start the project with the following TypeScript compiler flags enabled: `strictNullChecks`, `noImplicitAny`, `strictBindCallApply`, `forceConsistentCasingInFileNames`, `noFallthroughCasesInSwitch` |
3838

3939
#### nest generate
@@ -107,14 +107,15 @@ $ nest build <name> [options]
107107

108108
##### Options
109109

110-
| Option | Description |
111-
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
112-
| `--path [path]` | Path to `tsconfig` file. <br/>Alias `-p` |
113-
| `--config [path]` | Path to `nest-cli` configuration file. <br/>Alias `-c` |
114-
| `--watch` | Run in watch mode (live-reload). If you're using `tsc` for compilation, you can type `rs` to restart the application. <br/>Alias `-w` |
115-
| `--webpack` | Use webpack for compilation. |
116-
| `--webpackPath` | Path to webpack configuration. |
117-
| `--tsc` | Force use `tsc` for compilation. |
110+
| Option | Description |
111+
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
112+
| `--path [path]` | Path to `tsconfig` file. <br/>Alias `-p` |
113+
| `--config [path]` | Path to `nest-cli` configuration file. <br/>Alias `-c` |
114+
| `--watch` | Run in watch mode (live-reload).<br /> If you're using `tsc` for compilation, you can type `rs` to restart the application (when `manualRestart` option is set to `true`). <br/>Alias `-w` |
115+
| `--builder [name]` | Specify the builder to use for compilation (`tsc`, `swc`, or `webpack`). <br/>Alias `-b` |
116+
| `--webpack` | Use webpack for compilation (deprecated: use `--builder webpack` instead). |
117+
| `--webpackPath` | Path to webpack configuration. |
118+
| `--tsc` | Force use `tsc` for compilation. |
118119

119120
#### nest start
120121

@@ -137,10 +138,11 @@ $ nest start <name> [options]
137138
| `--path [path]` | Path to `tsconfig` file. <br/>Alias `-p` |
138139
| `--config [path]` | Path to `nest-cli` configuration file. <br/>Alias `-c` |
139140
| `--watch` | Run in watch mode (live-reload) <br/>Alias `-w` |
141+
| `--builder [name]` | Specify the builder to use for compilation (`tsc`, `swc`, or `webpack`). <br/>Alias `-b` |
140142
| `--preserveWatchOutput` | Keep outdated console output in watch mode instead of clearing the screen. (`tsc` watch mode only) |
141143
| `--watchAssets` | Run in watch mode (live-reload), watching non-TS files (assets). See [Assets](cli/monorepo#assets) for more details. |
142144
| `--debug [hostport]` | Run in debug mode (with --inspect flag) <br/>Alias `-d` |
143-
| `--webpack` | Use webpack for compilation. |
145+
| `--webpack` | Use webpack for compilation. (deprecated: use `--builder webpack` instead) |
144146
| `--webpackPath` | Path to webpack configuration. |
145147
| `--tsc` | Force use `tsc` for compilation. |
146148
| `--exec [binary]` | Binary to run (default: `node`). <br/>Alias `-e` |
@@ -177,12 +179,11 @@ $ nest info
177179
178180
[System Information]
179181
OS Version : macOS High Sierra
180-
NodeJS Version : v8.9.0
181-
YARN Version : 1.5.1
182+
NodeJS Version : v16.18.0
182183
[Nest Information]
183-
microservices version : 6.0.0
184-
websockets version : 6.0.0
185-
testing version : 6.0.0
186-
common version : 6.0.0
187-
core version : 6.0.0
184+
microservices version : 10.0.0
185+
websockets version : 10.0.0
186+
testing version : 10.0.0
187+
common version : 10.0.0
188+
core version : 10.0.0
188189
```

0 commit comments

Comments
 (0)