@nx/nest 20.1.3 → 20.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/nest",
3
- "version": "20.1.3",
3
+ "version": "20.1.4",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Nest contains executors and generators for allowing your workspace to create powerful Nest best in class APIs.",
6
6
  "repository": {
@@ -32,10 +32,10 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@nestjs/schematics": "^9.1.0",
35
- "@nx/devkit": "20.1.3",
36
- "@nx/js": "20.1.3",
37
- "@nx/eslint": "20.1.3",
38
- "@nx/node": "20.1.3",
35
+ "@nx/devkit": "20.1.4",
36
+ "@nx/js": "20.1.4",
37
+ "@nx/eslint": "20.1.4",
38
+ "@nx/node": "20.1.4",
39
39
  "tslib": "^2.3.0"
40
40
  },
41
41
  "publishConfig": {
@@ -5,20 +5,21 @@
5
5
  "description": "Nest Class Options Schema.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
+ "examples": [
9
+ {
10
+ "description": "Generate the class `Foo` at `myapp/src/app/foo.ts`",
11
+ "command": "nx g @nx/nest:class myapp/src/app/foo"
12
+ }
13
+ ],
8
14
  "properties": {
9
15
  "path": {
10
- "description": "Path where the class will be generated.",
16
+ "description": "The file path to the class without the file extension. Relative to the current working directory.",
11
17
  "type": "string",
12
18
  "$default": {
13
19
  "$source": "argv",
14
20
  "index": 0
15
21
  },
16
- "x-prompt": "Where should the class be generated?"
17
- },
18
- "name": {
19
- "description": "The name of the class.",
20
- "type": "string",
21
- "x-prompt": "What name would you like to use?"
22
+ "x-prompt": "What is the class file path?"
22
23
  },
23
24
  "skipFormat": {
24
25
  "description": "Skip formatting files.",
@@ -32,12 +33,6 @@
32
33
  "enum": ["jest", "none"],
33
34
  "default": "jest"
34
35
  },
35
- "flat": {
36
- "description": "Flag to indicate if a directory is created.",
37
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20.",
38
- "type": "boolean",
39
- "default": true
40
- },
41
36
  "language": {
42
37
  "description": "Nest class language.",
43
38
  "type": "string",
@@ -5,20 +5,21 @@
5
5
  "description": "Nest Controller Options Schema.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
+ "examples": [
9
+ {
10
+ "description": "Generate the controller `FooController` at `myapp/src/app/foo.controller.ts`",
11
+ "command": "nx g @nx/nest:controller myapp/src/app/foo"
12
+ }
13
+ ],
8
14
  "properties": {
9
15
  "path": {
10
- "description": "Path where the controller will be generated.",
16
+ "description": "The file path to the controller without the file extension and suffix. Relative to the current working directory.",
11
17
  "type": "string",
12
18
  "$default": {
13
19
  "$source": "argv",
14
20
  "index": 0
15
21
  },
16
- "x-prompt": "Where should the controller be generated?"
17
- },
18
- "name": {
19
- "description": "The name of the controller.",
20
- "type": "string",
21
- "x-prompt": "What name would you like to use?"
22
+ "x-prompt": "What is the controller file path?"
22
23
  },
23
24
  "skipFormat": {
24
25
  "description": "Skip formatting files.",
@@ -5,20 +5,21 @@
5
5
  "description": "Nest Decorator Options Schema.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
+ "examples": [
9
+ {
10
+ "description": "Generate the decorator `Foo` at `myapp/src/app/foo.decorator.ts`",
11
+ "command": "nx g @nx/nest:decorator myapp/src/app/foo"
12
+ }
13
+ ],
8
14
  "properties": {
9
15
  "path": {
10
- "description": "Path where the decorator will be generated.",
16
+ "description": "The file path to the decorator without the file extension and suffix. Relative to the current working directory.",
11
17
  "type": "string",
12
18
  "$default": {
13
19
  "$source": "argv",
14
20
  "index": 0
15
21
  },
16
- "x-prompt": "Where should the decorator be generated?"
17
- },
18
- "name": {
19
- "description": "The name of the decorator.",
20
- "type": "string",
21
- "x-prompt": "What name would you like to use?"
22
+ "x-prompt": "What is the decorator file path?"
22
23
  },
23
24
  "skipFormat": {
24
25
  "description": "Skip formatting files.",
@@ -5,20 +5,21 @@
5
5
  "description": "Nest Filter Options Schema.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
+ "examples": [
9
+ {
10
+ "description": "Generate the filter `FooFilter` at `myapp/src/app/foo.filter.ts`",
11
+ "command": "nx g @nx/nest:filter myapp/src/app/foo"
12
+ }
13
+ ],
8
14
  "properties": {
9
15
  "path": {
10
- "description": "Path where the filter will be generated.",
16
+ "description": "The file path to the filter without the file extension and suffix. Relative to the current working directory.",
11
17
  "type": "string",
12
18
  "$default": {
13
19
  "$source": "argv",
14
20
  "index": 0
15
21
  },
16
- "x-prompt": "Where should the filter be generated?"
17
- },
18
- "name": {
19
- "description": "The name of the filter.",
20
- "type": "string",
21
- "x-prompt": "What name would you like to use?"
22
+ "x-prompt": "What is the filter file path?"
22
23
  },
23
24
  "skipFormat": {
24
25
  "type": "boolean",
@@ -5,20 +5,21 @@
5
5
  "description": "Nest Gateway Options Schema.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
+ "examples": [
9
+ {
10
+ "description": "Generate the gateway `FooGateway` at `myapp/src/app/foo.gateway.ts`",
11
+ "command": "nx g @nx/nest:gateway myapp/src/app/foo"
12
+ }
13
+ ],
8
14
  "properties": {
9
15
  "path": {
10
- "description": "Path where the gateway will be generated.",
16
+ "description": "The file path to the gateway without the file extension and suffix. Relative to the current working directory.",
11
17
  "type": "string",
12
18
  "$default": {
13
19
  "$source": "argv",
14
20
  "index": 0
15
21
  },
16
- "x-prompt": "Where should the gateway be generated?"
17
- },
18
- "name": {
19
- "description": "The name of the gateway.",
20
- "type": "string",
21
- "x-prompt": "What name would you like to use?"
22
+ "x-prompt": "What is the gateway file path?"
22
23
  },
23
24
  "skipFormat": {
24
25
  "description": "Skip formatting files.",
@@ -5,20 +5,21 @@
5
5
  "description": "Nest Guard Options Schema.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
+ "examples": [
9
+ {
10
+ "description": "Generate the guard `FooGuard` at `myapp/src/app/foo.guard.ts`",
11
+ "command": "nx g @nx/nest:guard myapp/src/app/foo"
12
+ }
13
+ ],
8
14
  "properties": {
9
15
  "path": {
10
- "description": "Path where the guard will be generated.",
16
+ "description": "The file path to the guard without the file extension and suffix. Relative to the current working directory.",
11
17
  "type": "string",
12
18
  "$default": {
13
19
  "$source": "argv",
14
20
  "index": 0
15
21
  },
16
- "x-prompt": "Where should the guard be generated?"
17
- },
18
- "name": {
19
- "description": "The name of the guard.",
20
- "type": "string",
21
- "x-prompt": "What name would you like to use?"
22
+ "x-prompt": "What is the guard file path?"
22
23
  },
23
24
  "skipFormat": {
24
25
  "description": "Skip formatting files.",
@@ -39,5 +40,5 @@
39
40
  }
40
41
  },
41
42
  "additionalProperties": false,
42
- "required": ["name"]
43
+ "required": ["path"]
43
44
  }
@@ -5,20 +5,21 @@
5
5
  "description": "Nest Interceptor Options Schema.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
+ "examples": [
9
+ {
10
+ "description": "Generate the interceptor `FooInterceptor` at `myapp/src/app/foo.interceptor.ts`",
11
+ "command": "nx g @nx/nest:interceptor myapp/src/app/foo"
12
+ }
13
+ ],
8
14
  "properties": {
9
15
  "path": {
10
- "description": "Path where the interceptor will be generated.",
16
+ "description": "The file path to the interceptor without the file extension and suffix. Relative to the current working directory.",
11
17
  "type": "string",
12
18
  "$default": {
13
19
  "$source": "argv",
14
20
  "index": 0
15
21
  },
16
- "x-prompt": "Where should the interceptor be generated?"
17
- },
18
- "name": {
19
- "description": "The name of the interceptor.",
20
- "type": "string",
21
- "x-prompt": "What name would you like to use?"
22
+ "x-prompt": "What is the interceptor file path?"
22
23
  },
23
24
  "skipFormat": {
24
25
  "description": "Skip formatting files.",
@@ -39,5 +40,5 @@
39
40
  }
40
41
  },
41
42
  "additionalProperties": false,
42
- "required": ["name"]
43
+ "required": ["path"]
43
44
  }
@@ -5,32 +5,27 @@
5
5
  "description": "Nest Interface Options Schema.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
+ "examples": [
9
+ {
10
+ "description": "Generate the interface `Foo` at `myapp/src/app/foo.interface.ts`",
11
+ "command": "nx g @nx/nest:interface myapp/src/app/foo"
12
+ }
13
+ ],
8
14
  "properties": {
9
15
  "path": {
10
- "description": "Path where the interface will be generated.",
16
+ "description": "The file path to the interface without the file extension and suffix. Relative to the current working directory.",
11
17
  "type": "string",
12
18
  "$default": {
13
19
  "$source": "argv",
14
20
  "index": 0
15
21
  },
16
- "x-prompt": "Where should the interface be generated?"
17
- },
18
- "name": {
19
- "description": "The name of the interface.",
20
- "type": "string",
21
- "x-prompt": "What name would you like to use?"
22
+ "x-prompt": "What is the interface file path?"
22
23
  },
23
24
  "skipFormat": {
24
25
  "description": "Skip formatting files.",
25
26
  "type": "boolean",
26
27
  "default": false,
27
28
  "x-priority": "internal"
28
- },
29
- "flat": {
30
- "description": "Flag to indicate if a directory is created.",
31
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20.",
32
- "type": "boolean",
33
- "default": true
34
29
  }
35
30
  },
36
31
  "additionalProperties": false,
@@ -5,20 +5,21 @@
5
5
  "description": "Nest Middleware Options Schema.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
+ "examples": [
9
+ {
10
+ "description": "Generate the middleware `FooMiddleware` at `myapp/src/app/foo.middleware.ts`",
11
+ "command": "nx g @nx/nest:middleware myapp/src/app/foo"
12
+ }
13
+ ],
8
14
  "properties": {
9
15
  "path": {
10
- "description": "Path where the middleware will be generated.",
16
+ "description": "The file path to the middleware without the file extension and suffix. Relative to the current working directory.",
11
17
  "type": "string",
12
18
  "$default": {
13
19
  "$source": "argv",
14
20
  "index": 0
15
21
  },
16
- "x-prompt": "Where should the middleware be generated?"
17
- },
18
- "name": {
19
- "description": "The name of the middleware.",
20
- "type": "string",
21
- "x-prompt": "What name would you like to use?"
22
+ "x-prompt": "What is the middleware file path?"
22
23
  },
23
24
  "skipFormat": {
24
25
  "description": "Skip formatting files.",
@@ -5,20 +5,21 @@
5
5
  "description": "Nest Module Options Schema.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
+ "examples": [
9
+ {
10
+ "description": "Generate the module `FooModule` at `myapp/src/app/foo.module.ts`",
11
+ "command": "nx g @nx/nest:module myapp/src/app/foo"
12
+ }
13
+ ],
8
14
  "properties": {
9
15
  "path": {
10
- "description": "Path where the module will be generated.",
16
+ "description": "The file path to the module without the file extension and suffix. Relative to the current working directory.",
11
17
  "type": "string",
12
18
  "$default": {
13
19
  "$source": "argv",
14
20
  "index": 0
15
21
  },
16
- "x-prompt": "Where should the module be generated?"
17
- },
18
- "name": {
19
- "description": "The name of the module.",
20
- "type": "string",
21
- "x-prompt": "What name would you like to use?"
22
+ "x-prompt": "What is the module file path?"
22
23
  },
23
24
  "skipFormat": {
24
25
  "description": "Skip formatting files.",
@@ -5,20 +5,21 @@
5
5
  "description": "Nest Pipe Options Schema.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
+ "examples": [
9
+ {
10
+ "description": "Generate the pipe `FooPipe` at `myapp/src/app/foo.pipe.ts`",
11
+ "command": "nx g @nx/nest:pipe myapp/src/app/foo"
12
+ }
13
+ ],
8
14
  "properties": {
9
15
  "path": {
10
- "description": "Path where the pipe will be generated.",
16
+ "description": "The file path to the pipe without the file extension and suffix. Relative to the current working directory.",
11
17
  "type": "string",
12
18
  "$default": {
13
19
  "$source": "argv",
14
20
  "index": 0
15
21
  },
16
- "x-prompt": "Where should the pipe be generated?"
17
- },
18
- "name": {
19
- "description": "The name of the pipe.",
20
- "type": "string",
21
- "x-prompt": "What name would you like to use?"
22
+ "x-prompt": "What is the pipe file path?"
22
23
  },
23
24
  "skipFormat": {
24
25
  "description": "Skip formatting files.",
@@ -5,20 +5,21 @@
5
5
  "description": "Nest Provider Options Schema.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
+ "examples": [
9
+ {
10
+ "description": "Generate the provider `Foo` at `myapp/src/app/foo.ts`",
11
+ "command": "nx g @nx/nest:provider myapp/src/app/foo"
12
+ }
13
+ ],
8
14
  "properties": {
9
15
  "path": {
10
- "description": "Path where the provider will be generated.",
16
+ "description": "The file path to the provider without the file extension and suffix. Relative to the current working directory.",
11
17
  "type": "string",
12
18
  "$default": {
13
19
  "$source": "argv",
14
20
  "index": 0
15
21
  },
16
- "x-prompt": "Where should the provider be generated?"
17
- },
18
- "name": {
19
- "description": "The name of the provider.",
20
- "type": "string",
21
- "x-prompt": "What name would you like to use?"
22
+ "x-prompt": "What is the provider file path?"
22
23
  },
23
24
  "skipFormat": {
24
25
  "description": "Skip formatting files.",
@@ -5,20 +5,21 @@
5
5
  "description": "Nest Resolver Options Schema.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
+ "examples": [
9
+ {
10
+ "description": "Generate the resolver `FooResolver` at `myapp/src/app/foo.resolver.ts`",
11
+ "command": "nx g @nx/nest:resolver myapp/src/app/foo"
12
+ }
13
+ ],
8
14
  "properties": {
9
15
  "path": {
10
- "description": "Path where the resolver will be generated.",
16
+ "description": "The file path to the resolver without the file extension and suffix. Relative to the current working directory.",
11
17
  "type": "string",
12
18
  "$default": {
13
19
  "$source": "argv",
14
20
  "index": 0
15
21
  },
16
- "x-prompt": "Where should the resolver be generated?"
17
- },
18
- "name": {
19
- "description": "The name of the resolver.",
20
- "type": "string",
21
- "x-prompt": "What name would you like to use?"
22
+ "x-prompt": "What is the resolver file path?"
22
23
  },
23
24
  "skipFormat": {
24
25
  "description": "Skip formatting files.",
@@ -5,20 +5,21 @@
5
5
  "description": "Nest Resource Options Schema.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
+ "examples": [
9
+ {
10
+ "description": "Generate `myapp/src/app/entities/foo.entity.ts`, `myapp/src/app/dto/create-foo.dto.ts`, `myapp/src/app/dto/update-foo.dto.ts`, `myapp/src/app/foo.service.ts`, `myapp/src/app/foo.controller.ts`, and `myapp/src/app/foo.module.ts`",
11
+ "command": "nx g @nx/nest:resource myapp/src/app/foo"
12
+ }
13
+ ],
8
14
  "properties": {
9
15
  "path": {
10
16
  "type": "string",
11
- "description": "Path where the resource will be generated.",
17
+ "description": "The file path to the resource without the file extension and suffix. Relative to the current working directory.",
12
18
  "$default": {
13
19
  "$source": "argv",
14
20
  "index": 0
15
21
  },
16
- "x-prompt": "Where should the resource be generated?"
17
- },
18
- "name": {
19
- "type": "string",
20
- "description": "The name of the resource.",
21
- "x-prompt": "What name would you like to use for this resource (plural, e.g., `users`)?"
22
+ "x-prompt": "What is the resource file path?"
22
23
  },
23
24
  "skipFormat": {
24
25
  "description": "Skip formatting files.",
@@ -5,20 +5,21 @@
5
5
  "description": "Nest Service Options Schema.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
+ "examples": [
9
+ {
10
+ "description": "Generate the service `FooService` at `myapp/src/app/foo.service.ts`",
11
+ "command": "nx g @nx/nest:service myapp/src/app/foo"
12
+ }
13
+ ],
8
14
  "properties": {
9
15
  "path": {
10
- "description": "Path where the service will be generated.",
16
+ "description": "The file path to the service without the file extension and suffix. Relative to the current working directory.",
11
17
  "type": "string",
12
18
  "$default": {
13
19
  "$source": "argv",
14
20
  "index": 0
15
21
  },
16
- "x-prompt": "Where should the service be generated?"
17
- },
18
- "name": {
19
- "description": "The name of the service.",
20
- "type": "string",
21
- "x-prompt": "What name would you like to use?"
22
+ "x-prompt": "What is the service file path?"
22
23
  },
23
24
  "skipFormat": {
24
25
  "description": "Skip formatting files.",
@@ -4,14 +4,14 @@ exports.normalizeOptions = normalizeOptions;
4
4
  exports.unitTestRunnerToSpec = unitTestRunnerToSpec;
5
5
  const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
6
6
  async function normalizeOptions(tree, options) {
7
- const { directory, fileName } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
8
- name: options.name,
7
+ const { directory, artifactName } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
9
8
  path: options.path,
10
9
  });
10
+ options.path = undefined; // Now that we have `directory` we don't need `path`
11
11
  return {
12
12
  ...options,
13
13
  flat: true,
14
- name: fileName,
14
+ name: artifactName,
15
15
  skipFormat: options.skipFormat,
16
16
  sourceRoot: directory,
17
17
  };
@@ -4,7 +4,6 @@ export type NestSchematic = 'class' | 'controller' | 'decorator' | 'filter' | 'g
4
4
  export type TransportLayer = 'rest' | 'graphql-code-first' | 'graphql-schema-first' | 'microservice' | 'ws';
5
5
  export type NestGeneratorOptions = {
6
6
  path: string;
7
- name?: string;
8
7
  skipFormat?: boolean;
9
8
  };
10
9
  export type NestGeneratorWithLanguageOption = NestGeneratorOptions & {