Skip to content

Commit

Permalink
Merge pull request #2256 from johannesschobel/fix/typos
Browse files Browse the repository at this point in the history
Fix Typos and Format Code Blocks
  • Loading branch information
kamilmysliwiec committed Apr 7, 2022
2 parents f51b5c4 + 5ab2fb3 commit 219416a
Show file tree
Hide file tree
Showing 32 changed files with 114 additions and 105 deletions.
2 changes: 1 addition & 1 deletion content/application-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ async function bootstrap() {
bootstrap();
```

#### Example
#### Example

A working example is available [here](https://github.com/nestjs/nest/tree/master/sample/18-context).
62 changes: 31 additions & 31 deletions content/cli/usages.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Creates and initializes a new Nest project. Prompts for package manager.

##### Options

| Option | Description |
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| `--dry-run` | Reports changes that would be made, but does not change the filesystem.<br/> Alias: `-d` |
| `--skip-git` | Skip git repository initialization.<br/> Alias: `-g` |
| `--skip-install` | Skip package installation.<br/> Alias: `-s` |
| `--package-manager [package-manager]` | Specify package manager. Use `npm`, `yarn`, or `pnpm`. Package manager must be installed globally.<br/> Alias: `-p` |
| `--language [language]` | Specify programming language (`TS` or `JS`).<br/> Alias: `-l` |
| `--collection [collectionName]` | Specify schematics collection. Use package name of installed npm package containing schematic.<br/> Alias: `-c` |
| Option | Description |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `--dry-run` | Reports changes that would be made, but does not change the filesystem.<br/> Alias: `-d` |
| `--skip-git` | Skip git repository initialization.<br/> Alias: `-g` |
| `--skip-install` | Skip package installation.<br/> Alias: `-s` |
| `--package-manager [package-manager]` | Specify package manager. Use `npm`, `yarn`, or `pnpm`. Package manager must be installed globally.<br/> Alias: `-p` |
| `--language [language]` | Specify programming language (`TS` or `JS`).<br/> Alias: `-l` |
| `--collection [collectionName]` | Specify schematics collection. Use package name of installed npm package containing schematic.<br/> Alias: `-c` |

#### nest generate

Expand All @@ -53,25 +53,25 @@ $ nest g <schematic> <name> [options]

##### Schematics

| Name | Alias | Description |
| ------------- | ----- | --------------------------------------------------------------------------------------------------- |
| `app` | | Generate a new application within a monorepo (converting to monorepo if it's a standard structure). |
| `library` | `lib` | Generate a new library within a monorepo (converting to monorepo if it's a standard structure). |
| `class` | `cl` | Generate a new class. |
| `controller` | `co` | Generate a controller declaration. |
| `decorator` | `d` | Generate a custom decorator. |
| `filter` | `f` | Generate a filter declaration. |
| `gateway` | `ga` | Generate a gateway declaration. |
| `guard` | `gu` | Generate a guard declaration. |
| `interface` | | Generate an interface. |
| `interceptor` | `in` | Generate an interceptor declaration. |
| `middleware` | `mi` | Generate a middleware declaration. |
| `module` | `mo` | Generate a module declaration. |
| `pipe` | `pi` | Generate a pipe declaration. |
| `provider` | `pr` | Generate a provider declaration. |
| `resolver` | `r` | Generate a resolver declaration.
| `resource` | `res` | Generate a new CRUD resource. See the [CRUD (resource) generator](/recipes/crud-generator) for more details. |
| `service` | `s` | Generate a service declaration. |
| Name | Alias | Description |
| ------------- | ----- | ------------------------------------------------------------------------------------------------------------ |
| `app` | | Generate a new application within a monorepo (converting to monorepo if it's a standard structure). |
| `library` | `lib` | Generate a new library within a monorepo (converting to monorepo if it's a standard structure). |
| `class` | `cl` | Generate a new class. |
| `controller` | `co` | Generate a controller declaration. |
| `decorator` | `d` | Generate a custom decorator. |
| `filter` | `f` | Generate a filter declaration. |
| `gateway` | `ga` | Generate a gateway declaration. |
| `guard` | `gu` | Generate a guard declaration. |
| `interface` | | Generate an interface. |
| `interceptor` | `in` | Generate an interceptor declaration. |
| `middleware` | `mi` | Generate a middleware declaration. |
| `module` | `mo` | Generate a module declaration. |
| `pipe` | `pi` | Generate a pipe declaration. |
| `provider` | `pr` | Generate a provider declaration. |
| `resolver` | `r` | Generate a resolver declaration. |
| `resource` | `res` | Generate a new CRUD resource. See the [CRUD (resource) generator](/recipes/crud-generator) for more details. |
| `service` | `s` | Generate a service declaration. |

##### Options

Expand Down Expand Up @@ -158,10 +158,10 @@ Updates `@nestjs` dependencies in the `package.json` `"dependencies"` list to th

##### Options

| Option | Description |
| --------- | ------------------------------------------------------------------------ |
| `--force` | Do **upgrade** instead of update <br/>Alias `-f` |
| `--tag` | Update to tagged version (use `@latest`, `@<tag>`, etc) <br/>Alias `-t` | |
| Option | Description |
| --------- | ----------------------------------------------------------------------- | --- |
| `--force` | Do **upgrade** instead of update <br/>Alias `-f` |
| `--tag` | Update to tagged version (use `@latest`, `@<tag>`, etc) <br/>Alias `-t` | |

#### nest info

Expand Down
2 changes: 1 addition & 1 deletion content/cli/workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ module.exports = {
Since the webpack config file is a JavaScript file, you can even expose a function that takes default options and returns a modified object:

```javascript
module.exports = function(options) {
module.exports = function (options) {
return {
...options,
externals: [],
Expand Down
10 changes: 5 additions & 5 deletions content/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Providers normally have a lifetime ("scope") synchronized with the application l

#### Custom providers

Nest has a built-in inversion of control ("IoC") container that resolves relationships between providers. This feature underlies the dependency injection feature described above, but is in fact far more powerful than what we've described so far. There are several ways to define a provider: you can use plain values, classes, and either asynchronous or synchronous factories. More examples are provided [here](/fundamentals/dependency-injection).
Nest has a built-in inversion of control ("IoC") container that resolves relationships between providers. This feature underlies the dependency injection feature described above, but is in fact far more powerful than what we've described so far. There are several ways to define a provider: you can use plain values, classes, and either asynchronous or synchronous factories. More examples are provided [here](/fundamentals/dependency-injection).

#### Optional providers

Expand Down Expand Up @@ -207,8 +207,8 @@ This is how our directory structure should look now:

#### Manual instantiation

Thus far, we've discussed how Nest automatically handles most of the details of resolving dependencies. In certain circumstances, you may need to step outside of the built-in Dependency Injection system and manually retrieve or instantiate providers. We briefly discuss two such topics below.
Thus far, we've discussed how Nest automatically handles most of the details of resolving dependencies. In certain circumstances, you may need to step outside of the built-in Dependency Injection system and manually retrieve or instantiate providers. We briefly discuss two such topics below.

To get existing instances, or instantiate providers dynamically, you can use [Module reference](https://docs.nestjs.com/fundamentals/module-ref).
To get providers within the `bootstrap()` function (for example for standalone applications without controllers, or to utilize a configuration service during bootstrapping) see [Standalone applications](https://docs.nestjs.com/standalone-applications).
To get existing instances, or instantiate providers dynamically, you can use [Module reference](https://docs.nestjs.com/fundamentals/module-ref).

To get providers within the `bootstrap()` function (for example for standalone applications without controllers, or to utilize a configuration service during bootstrapping) see [Standalone applications](https://docs.nestjs.com/standalone-applications).
5 changes: 2 additions & 3 deletions content/faq/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ Potential solutions:
})
```
The most common culprit of the error, is not having the `provider` in the module's `providers` array. Please make sure that the provider is indeed in the `providers` array and following [standard NestJS provider practices](/fundamentals/custom-providers#di-fundamentals).

There are a few gotchas, that are common. One is putting a provider in an `imports` array. If this is the case, the error will have the provider's name where `<module>` should be.
If you run across this error while developing, take a look at the module mentioned in the error message and look at its `providers`. For each provider in the `providers` array, make sure the module has access to all of the dependencies. Often times, `providers` are duplicated in a "Feature Module" and a "Root Module" which means Nest will try to instantiate the provider twice. More than likely, the module containing the `provider` being duplicated should be added in the "Root Module"'s `imports` array instead.

If the `unknown_token` above is the string `dependency`, you might have a circular file import. This is different from the [circular dependency](./errors.md#circular-dependency-error) below because instead of having providers depend on each other in their constructors, it just means that two files end up importing each other. A common case would be a module file declaring a token and importing a provider, and the provider import the token constant from the module file. If you are using barrel files, ensure that your barrel imports do not end up creating these circular imports as well.
If the `unknown_token` above is the string `dependency`, you might have a circular file import. This is different from the [circular dependency](./errors.md#circular-dependency-error) below because instead of having providers depend on each other in their constructors, it just means that two files end up importing each other. A common case would be a module file declaring a token and importing a provider, and the provider import the token constant from the module file. If you are using barrel files, ensure that your barrel imports do not end up creating these circular imports as well.

#### "Circular dependency" error

Expand All @@ -46,7 +45,7 @@ Circular dependencies can arise from both providers depending on each other, or

#### Debugging dependency errors

Along with just manually verifying your dependencies are correct, as of Nest 8.1.0 you can set the `NEST_DEBUG` environment variable to a string that resolves as truthy, and get extra logging information while Nest is resolving all of the dependencies for the application.
Along with just manually verifying your dependencies are correct, as of Nest 8.1.0 you can set the `NEST_DEBUG` environment variable to a string that resolves as truthy, and get extra logging information while Nest is resolving all of the dependencies for the application.

<figure><img src="/assets/injector_logs.png" /></figure>

Expand Down
1 change: 1 addition & 0 deletions content/first-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ $ npm run start
This command starts the app with the HTTP server listening on the port defined in the `src/main.ts` file. Once the application is running, open your browser and navigate to `http://localhost:3000/`. You should see the `Hello World!` message.

To watch for changes in your files, you can run the following command to start the application:

```bash
$ npm run start:dev
```
Expand Down
2 changes: 1 addition & 1 deletion content/fundamentals/circular-dependency.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ While circular dependencies should be avoided where possible, you can't always d

We also describe resolving circular dependencies between modules.

> warning **Warning** A circular dependency might also be caused when using "barrel files"/index.ts files to group imports. Barrel files should be omitted when it comes to module/provider classes. For example, barrel files should not be used when importing files within the same directory as the barrel file, i.e. `cats/cats.controller` should not import `cats` to import the `cats/cats.service` file. For more details please also see [this github issue](https://github.com/nestjs/nest/issues/1181#issuecomment-430197191).
> warning **Warning** A circular dependency might also be caused when using "barrel files"/index.ts files to group imports. Barrel files should be omitted when it comes to module/provider classes. For example, barrel files should not be used when importing files within the same directory as the barrel file, i.e. `cats/cats.controller` should not import `cats` to import the `cats/cats.service` file. For more details please also see [this github issue](https://github.com/nestjs/nest/issues/1181#issuecomment-430197191).
#### Forward reference

Expand Down
2 changes: 1 addition & 1 deletion content/fundamentals/lifecycle-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ In the following table, `onModuleDestroy`, `beforeApplicationShutdown` and `onAp
| `onApplicationBootstrap()` | Called once all modules have been initialized, but before listening for connections. |
| `onModuleDestroy()`\* | Called after a termination signal (e.g., `SIGTERM`) has been received. |
| `beforeApplicationShutdown()`\* | Called after all `onModuleDestroy()` handlers have completed (Promises resolved or rejected);<br />once complete (Promises resolved or rejected), all existing connections will be closed (`app.close()` called). |
| `onApplicationShutdown()`\* | Called after connections close (`app.close()` resolves). |
| `onApplicationShutdown()`\* | Called after connections close (`app.close()` resolves). |

\* For these events, if you're not calling `app.close()` explicitly, you must opt-in to make them work with system signals such as `SIGTERM`. See [Application shutdown](fundamentals/lifecycle-events#application-shutdown) below.

Expand Down
4 changes: 2 additions & 2 deletions content/fundamentals/unit-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ describe('CatsController', () => {

controller = moduleRef.get(CatsController);
});
})
});
```

> info **Hint** A general mock factory, like `createMock` from [`@golevelup/ts-jest`](https://github.com/golevelup/nestjs/tree/master/packages/testing) can also be passed directly.
Expand Down Expand Up @@ -302,7 +302,7 @@ describe('Cats', () => {
> expect(result.payload).toEqual(/* expectedPayload */);
> });
> });
>
>
> afterAll(async () => {
> await app.close();
> });
Expand Down
4 changes: 2 additions & 2 deletions content/graphql/interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Field, ID, InterfaceType } from '@nestjs/graphql';

@InterfaceType()
export abstract class Character {
@Field(type => ID)
@Field((type) => ID)
id: string;

@Field()
Expand Down Expand Up @@ -58,7 +58,7 @@ To provide a customized `resolveType()` function, pass the `resolveType` propert
},
})
export abstract class Book {
@Field(type => ID)
@Field((type) => ID)
id: string;

@Field()
Expand Down

0 comments on commit 219416a

Please sign in to comment.