|
3 | 3 | Nest has two modes for organizing code:
|
4 | 4 |
|
5 | 5 | - **standard mode**: useful for building individual project-focused applications that have their own dependencies and settings, and don't need to optimize for sharing modules, or optimizing complex builds. This is the default mode.
|
6 |
| -- **monorepo mode**: this mode treats code artifacts as part of a lightweight **monorepo**, and may be more appropriate for teams of developers and/or multi-project environments. It automates parts of the build process to make it easy to create and compose modular components, promotes code re-use, makes integration testing easier, makes it easy to share project-wide artifacts like `tslint` rules and other configuration policies, and is easier to use than alternatives like github submodules. Monorepo mode employs the concept of a **workspace**, represented in the `nest-cli.json` file, to coordinate the relationship between the components of the monorepo. |
| 6 | +- **monorepo mode**: this mode treats code artifacts as part of a lightweight **monorepo**, and may be more appropriate for teams of developers and/or multi-project environments. It automates parts of the build process to make it easy to create and compose modular components, promotes code re-use, makes integration testing easier, makes it easy to share project-wide artifacts like `eslint` rules and other configuration policies, and is easier to use than alternatives like github submodules. Monorepo mode employs the concept of a **workspace**, represented in the `nest-cli.json` file, to coordinate the relationship between the components of the monorepo. |
7 | 7 |
|
8 | 8 | It's important to note that virtually all of Nest's features are independent of your code organization mode. The **only** affect of this choice is how your projects are composed and how build artifacts are generated. All other functionality, from the CLI to core modules to add-on modules work the same in either mode.
|
9 | 9 |
|
@@ -43,7 +43,7 @@ We've constructed a _standard mode_ structure, with a folder structure that look
|
43 | 43 | <div class="item">nest-cli.json</div>
|
44 | 44 | <div class="item">package.json</div>
|
45 | 45 | <div class="item">tsconfig.json</div>
|
46 |
| - <div class="item">tslint.json</div> |
| 46 | + <div class="item">.eslintrc.js</div> |
47 | 47 | </div>
|
48 | 48 |
|
49 | 49 | We can convert this to a monorepo mode structure as follows:
|
@@ -84,7 +84,7 @@ At this point, `nest` converts the existing structure to a **monorepo mode** str
|
84 | 84 | <div class="item">nest-cli.json</div>
|
85 | 85 | <div class="item">package.json</div>
|
86 | 86 | <div class="item">tsconfig.json</div>
|
87 |
| - <div class="item">tslint.json</div> |
| 87 | + <div class="item">.eslintrc.js</div> |
88 | 88 | </div>
|
89 | 89 |
|
90 | 90 | The `generate app` schematic has reorganized the code - moving each **application** project under the `apps` folder, and adding a project-specific `tsconfig.app.json` file in each project's root folder. Our original `my-project` app has become the **default project** for the monorepo, and is now a peer with the just-added `my-app`, located under the `apps` folder. We'll cover default projects below.
|
@@ -118,7 +118,7 @@ $ nest start my-app
|
118 | 118 |
|
119 | 119 | Application-type projects, or what we might informally refer to as just "applications", are complete Nest applications that you can run and deploy. You generate an application-type project with `nest generate app`.
|
120 | 120 |
|
121 |
| -This command automatically generates a project skeleton, including the standard `src` and `test` folders from the [typescript starter](https://github.com/nestjs/typescript-starter). Unlike standard mode, an application project in a monorepo does not have any of the package dependency (`package.json`) or other project configuration artifacts like `.prettierrc` and `tslint.json`. Instead, the monorepo-wide dependencies and config files are used. |
| 121 | +This command automatically generates a project skeleton, including the standard `src` and `test` folders from the [typescript starter](https://github.com/nestjs/typescript-starter). Unlike standard mode, an application project in a monorepo does not have any of the package dependency (`package.json`) or other project configuration artifacts like `.prettierrc` and `.eslintrc.js`. Instead, the monorepo-wide dependencies and config files are used. |
122 | 122 |
|
123 | 123 | However, the schematic does generate a project-specific `tsconfig.app.json` file in the root folder of the project. This config file automatically sets appropriate build options, including setting the compilation output folder properly. The file extends the top-level (monorepo) `tsconfig.json` file, so you can manage global settings monorepo-wide, but override them if needed at the project level.
|
124 | 124 |
|
|
0 commit comments