From 30d877410bdd1fbafabc826c45268355b4b66e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leosvel=20P=C3=A9rez=20Espinosa?= Date: Wed, 27 Nov 2024 14:21:54 +0100 Subject: [PATCH] docs(misc): udpate `path` option description and provide examples --- .../angular/generators/component.json | 4 ++-- .../angular/generators/directive.json | 12 +++++++++++- .../packages/angular/generators/pipe.json | 12 +++++++++++- .../angular/generators/scam-directive.json | 10 +++++++--- .../angular/generators/scam-pipe.json | 10 +++++++--- .../packages/angular/generators/scam.json | 10 +++++++--- .../packages/expo/generators/application.json | 4 ++-- .../packages/expo/generators/component.json | 14 +++++++++----- .../packages/expo/generators/library.json | 2 +- .../packages/nest/generators/class.json | 8 +++++++- .../packages/nest/generators/controller.json | 8 +++++++- .../packages/nest/generators/decorator.json | 8 +++++++- .../packages/nest/generators/filter.json | 8 +++++++- .../packages/nest/generators/gateway.json | 8 +++++++- .../packages/nest/generators/guard.json | 8 +++++++- .../packages/nest/generators/interceptor.json | 8 +++++++- .../packages/nest/generators/interface.json | 8 +++++++- .../packages/nest/generators/middleware.json | 8 +++++++- .../packages/nest/generators/module.json | 8 +++++++- .../packages/nest/generators/pipe.json | 8 +++++++- .../packages/nest/generators/provider.json | 8 +++++++- .../packages/nest/generators/resolver.json | 8 +++++++- .../packages/nest/generators/resource.json | 8 +++++++- .../packages/nest/generators/service.json | 8 +++++++- .../packages/next/generators/component.json | 4 ++-- .../packages/next/generators/page.json | 2 +- .../packages/plugin/generators/executor.json | 10 ++-------- .../packages/plugin/generators/generator.json | 10 +++++++--- .../packages/plugin/generators/migration.json | 10 +++++++--- .../react-native/generators/component.json | 14 +++++++++----- .../packages/react/generators/component.json | 4 ++-- .../packages/react/generators/hook.json | 12 ++++++++---- .../packages/react/generators/redux.json | 12 +++++++++++- .../packages/vue/generators/component.json | 10 +++------- packages/angular/docs/component-examples.md | 12 +++++++++++- .../src/generators/component/schema.json | 2 +- .../src/generators/directive/schema.json | 12 +++++++++++- .../angular/src/generators/pipe/schema.json | 12 +++++++++++- .../src/generators/scam-directive/schema.json | 10 +++++++--- .../src/generators/scam-pipe/schema.json | 10 +++++++--- .../angular/src/generators/scam/schema.json | 10 +++++++--- .../src/generators/application/schema.json | 4 ++-- .../expo/src/generators/component/schema.json | 14 +++++++++----- .../expo/src/generators/library/schema.json | 2 +- .../nest/src/generators/class/schema.json | 8 +++++++- .../src/generators/controller/schema.json | 8 +++++++- .../nest/src/generators/decorator/schema.json | 8 +++++++- .../nest/src/generators/filter/schema.json | 8 +++++++- .../nest/src/generators/gateway/schema.json | 8 +++++++- .../nest/src/generators/guard/schema.json | 8 +++++++- .../src/generators/interceptor/schema.json | 8 +++++++- .../nest/src/generators/interface/schema.json | 8 +++++++- .../src/generators/middleware/schema.json | 8 +++++++- .../nest/src/generators/module/schema.json | 8 +++++++- packages/nest/src/generators/pipe/schema.json | 8 +++++++- .../nest/src/generators/provider/schema.json | 8 +++++++- .../nest/src/generators/resolver/schema.json | 8 +++++++- .../nest/src/generators/resource/schema.json | 8 +++++++- .../nest/src/generators/service/schema.json | 8 +++++++- packages/next/docs/component-examples.md | 19 ++++++------------- packages/next/docs/page-examples.md | 8 +++++--- .../next/src/generators/component/schema.json | 2 +- .../configuration.spec.ts | 1 - .../docs/generators/executor-examples.md | 13 +++++++++++-- .../src/generators/executor/schema.json | 8 +------- .../src/generators/generator/schema.json | 10 +++++++--- .../src/generators/migration/schema.json | 10 +++++++--- .../src/generators/component/schema.json | 14 +++++++++----- packages/react/docs/component-examples.md | 16 +++++++++++++--- .../src/generators/component/schema.json | 2 +- .../react/src/generators/hook/schema.json | 12 ++++++++---- .../react/src/generators/redux/schema.json | 12 +++++++++++- .../generators/component/component.spec.ts | 5 ----- .../vue/src/generators/component/lib/utils.ts | 1 - .../vue/src/generators/component/schema.d.ts | 1 - .../vue/src/generators/component/schema.json | 10 +++------- .../configuration.spec.ts | 1 - 77 files changed, 469 insertions(+), 170 deletions(-) diff --git a/docs/generated/packages/angular/generators/component.json b/docs/generated/packages/angular/generators/component.json index 31ee8820b35a5..bea59dcc8c6e3 100644 --- a/docs/generated/packages/angular/generators/component.json +++ b/docs/generated/packages/angular/generators/component.json @@ -12,7 +12,7 @@ "properties": { "path": { "type": "string", - "description": "The file path to the component without the file extension and suffix (e.g. `my-app/src/app/my-component/my-component` generates the file `my-app/src/app/my-component/my-component.component.ts`). Relative to the current working directory.", + "description": "The file path to the component without the file extension and suffix. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the component file path?" }, @@ -112,7 +112,7 @@ } }, "required": ["path"], - "examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Component\" %}\n\nCreate a component named `my-component`:\n\n```bash\nnx g @nx/angular:component apps/my-app/src/lib/my-component/my-component\n```\n\n{% /tab %}\n\n{% tab label=\"Single File Component\" %}\n\nCreate a component named `my-component` with inline styles and inline template:\n\n```bash\nnx g @nx/angular:component apps/my-app/src/lib/my-component/my-component --inlineStyle --inlineTemplate\n```\n\n{% /tab %}\n\n{% tab label=\"Component with OnPush Change Detection Strategy\" %}\n\nCreate a component named `my-component` with OnPush Change Detection Strategy:\n\n```bash\nnx g @nx/angular:component apps/my-app/src/lib/my-component/my-component --changeDetection=OnPush\n```\n\n{% /tab %}\n", + "examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Component\" %}\n\nGenerate a component named `MyComponent` at `apps/my-app/src/lib/my-component/my-component.component.ts`:\n\n```bash\nnx g @nx/angular:component apps/my-app/src/lib/my-component/my-component\n```\n\n{% /tab %}\n\n{% tab label=\"With Different Symbol Name\" %}\n\nGenerate a component named `CustomComponent` at `apps/my-app/src/lib/my-component/my-component.component.ts`:\n\n```bash\nnx g @nx/angular:component apps/my-app/src/lib/my-component/my-component --name=custom\n```\n\n{% /tab %}\n\n{% tab label=\"Single File Component\" %}\n\nCreate a component named `my-component` with inline styles and inline template:\n\n```bash\nnx g @nx/angular:component apps/my-app/src/lib/my-component/my-component --inlineStyle --inlineTemplate\n```\n\n{% /tab %}\n\n{% tab label=\"Component with OnPush Change Detection Strategy\" %}\n\nCreate a component named `my-component` with OnPush Change Detection Strategy:\n\n```bash\nnx g @nx/angular:component apps/my-app/src/lib/my-component/my-component --changeDetection=OnPush\n```\n\n{% /tab %}\n", "presets": [] }, "aliases": ["c"], diff --git a/docs/generated/packages/angular/generators/directive.json b/docs/generated/packages/angular/generators/directive.json index 6927e55eb486b..8bf52bce9760c 100644 --- a/docs/generated/packages/angular/generators/directive.json +++ b/docs/generated/packages/angular/generators/directive.json @@ -9,10 +9,20 @@ "type": "object", "description": "Creates a new Angular directive.", "additionalProperties": false, + "examples": [ + { + "description": "Generate a directive with the exported symbol matching the file name. It results in the directive `FooDirective` at `mylib/src/lib/foo.directive.ts`", + "command": "nx g @nx/angular:directive mylib/src/lib/foo" + }, + { + "description": "Generate a directive with the exported symbol different from the file name. It results in the directive `CustomDirective` at `mylib/src/lib/foo.directive.ts`", + "command": "nx g @nx/angular:directive mylib/src/lib/foo --name=custom" + } + ], "properties": { "path": { "type": "string", - "description": "The file path to the directive without the file extension and suffix (e.g. `my-app/src/app/my-directive/my-directive` generates the file `my-app/src/app/my-directive/my-directive.directive.ts`). Relative to the current working directory.", + "description": "The file path to the directive without the file extension and suffix. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the directive file path?" }, diff --git a/docs/generated/packages/angular/generators/pipe.json b/docs/generated/packages/angular/generators/pipe.json index 27643ae7d9e11..8f01183961b94 100644 --- a/docs/generated/packages/angular/generators/pipe.json +++ b/docs/generated/packages/angular/generators/pipe.json @@ -9,10 +9,20 @@ "cli": "nx", "additionalProperties": false, "description": "Creates an Angular pipe.", + "examples": [ + { + "description": "Generate a pipe with the exported symbol matching the file name. It results in the pipe `FooPipe` at `mylib/src/lib/foo.pipe.ts`", + "command": "nx g @nx/angular:pipe mylib/src/lib/foo" + }, + { + "description": "Generate a pipe with the exported symbol different from the file name. It results in the pipe `CustomPipe` at `mylib/src/lib/foo.pipe.ts`", + "command": "nx g @nx/angular:pipe mylib/src/lib/foo --name=custom" + } + ], "properties": { "path": { "type": "string", - "description": "The file path to the pipe without the file extension and suffix (e.g. `my-app/src/app/my-pipe/my-pipe` generates the file `my-app/src/app/my-pipe/my-pipe.pipe.ts`). Relative to the current working directory.", + "description": "The file path to the pipe without the file extension and suffix. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the pipe file path?" }, diff --git a/docs/generated/packages/angular/generators/scam-directive.json b/docs/generated/packages/angular/generators/scam-directive.json index bfa5826da0772..b1d5db9ec57dd 100644 --- a/docs/generated/packages/angular/generators/scam-directive.json +++ b/docs/generated/packages/angular/generators/scam-directive.json @@ -9,8 +9,12 @@ "type": "object", "examples": [ { - "command": "nx g @nx/angular:scam-directive my-lib/src/lib/my-sample/my-sample", - "description": "Generate a `MySampleDirective` directive in a `my-sample` folder in the `my-lib` library" + "description": "Generate a directive with the exported symbol matching the file name. It results in the directive `FooDirective` at `mylib/src/lib/foo.directive.ts`", + "command": "nx g @nx/angular:scam-directive mylib/src/lib/foo" + }, + { + "description": "Generate a directive with the exported symbol different from the file name. It results in the directive `CustomDirective` at `mylib/src/lib/foo.directive.ts`", + "command": "nx g @nx/angular:scam-directive mylib/src/lib/foo --name=custom" } ], "description": "Creates a new, generic Angular directive definition in the given or default project.", @@ -18,7 +22,7 @@ "properties": { "path": { "type": "string", - "description": "The file path to the SCAM directive without the file extension and suffix (e.g. `my-app/src/app/my-scam/my-scam` generates the file `my-app/src/app/my-scam/my-scam.directive.ts`). Relative to the current working directory.", + "description": "The file path to the SCAM directive without the file extension and suffix. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the SCAM directive file path?" }, diff --git a/docs/generated/packages/angular/generators/scam-pipe.json b/docs/generated/packages/angular/generators/scam-pipe.json index f63f1e2fea5bf..a12009cac3964 100644 --- a/docs/generated/packages/angular/generators/scam-pipe.json +++ b/docs/generated/packages/angular/generators/scam-pipe.json @@ -9,8 +9,12 @@ "type": "object", "examples": [ { - "command": "nx g @nx/angular:scam-pipe mylib/src/lib/my-transformation/my-transformation", - "description": "Generates a `MyTransformationPipe` in a `my-transformation` folder in the `my-lib` project" + "description": "Generate a pipe with the exported symbol matching the file name. It results in the pipe `FooPipe` at `mylib/src/lib/foo.pipe.ts`", + "command": "nx g @nx/angular:scam-pipe mylib/src/lib/foo" + }, + { + "description": "Generate a pipe with the exported symbol different from the file name. It results in the pipe `CustomPipe` at `mylib/src/lib/foo.pipe.ts`", + "command": "nx g @nx/angular:scam-pipe mylib/src/lib/foo --name=custom" } ], "description": "Creates a new, generic Angular pipe definition in the given or default project.", @@ -18,7 +22,7 @@ "properties": { "path": { "type": "string", - "description": "The file path to the SCAM pipe without the file extension and suffix (e.g. `my-app/src/app/my-scam/my-scam` generates the file `my-app/src/app/my-scam/my-scam.pipe.ts`). Relative to the current working directory.", + "description": "The file path to the SCAM pipe without the file extension and suffix. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the SCAM pipe file path?" }, diff --git a/docs/generated/packages/angular/generators/scam.json b/docs/generated/packages/angular/generators/scam.json index ab3760cd5ec02..0bc374ec6e408 100644 --- a/docs/generated/packages/angular/generators/scam.json +++ b/docs/generated/packages/angular/generators/scam.json @@ -9,8 +9,12 @@ "type": "object", "examples": [ { - "command": "nx g @nx/angular:scam my-lib/src/lib/my-sample/my-sample", - "description": "Generate a `MySampleComponent` component in the `my-lib` library." + "description": "Generate a component with the exported symbol matching the file name. It results in the component `FooComponent` at `mylib/src/lib/foo.component.ts`", + "command": "nx g @nx/angular:scam mylib/src/lib/foo" + }, + { + "description": "Generate a component with the exported symbol different from the file name. It results in the component `CustomComponent` at `mylib/src/lib/foo.component.ts`", + "command": "nx g @nx/angular:scam mylib/src/lib/foo --name=custom" } ], "description": "Creates a new Angular SCAM.", @@ -18,7 +22,7 @@ "properties": { "path": { "type": "string", - "description": "The file path to the SCAM without the file extension and suffix (e.g. `my-app/src/app/my-scam/my-scam` generates the file `my-app/src/app/my-scam/my-scam.component.ts`). Relative to the current working directory.", + "description": "The file path to the SCAM without the file extension and suffix. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the SCAM file path?" }, diff --git a/docs/generated/packages/expo/generators/application.json b/docs/generated/packages/expo/generators/application.json index 2207ca6aa84d7..7eb94e7915e40 100644 --- a/docs/generated/packages/expo/generators/application.json +++ b/docs/generated/packages/expo/generators/application.json @@ -8,11 +8,11 @@ "description": "Create an Expo Application for Nx.", "examples": [ { - "command": "g @nx/expo:app myapp --directory=nested", + "command": "nx g @nx/expo:app myapp --directory=nested", "description": "Generate apps/nested/myapp" }, { - "command": "g @nx/expo:app myapp --classComponent", + "command": "nx g @nx/expo:app myapp --classComponent", "description": "Use class components instead of functional components" } ], diff --git a/docs/generated/packages/expo/generators/component.json b/docs/generated/packages/expo/generators/component.json index 22de2d93f2980..e89226db41cc5 100644 --- a/docs/generated/packages/expo/generators/component.json +++ b/docs/generated/packages/expo/generators/component.json @@ -9,18 +9,22 @@ "type": "object", "examples": [ { - "command": "g @nx/expo:component mylib/my-component", - "description": "Generate a component in the mylib library" + "description": "Generate a component with the exported symbol matching the file name. It results in the component `Foo` at `mylib/src/foo.tsx`", + "command": "nx g @nx/expo:component mylib/src/foo" }, { - "command": "g @nx/expo:component mylib/my-component --classComponent", - "description": "Generate a class component in the mylib library" + "description": "Generate a component with the exported symbol different from the file name. It results in the component `Custom` at `mylib/src/foo.tsx`", + "command": "nx g @nx/expo:component mylib/src/foo --name=custom" + }, + { + "description": "Generate a class component at `mylib/src/foo.tsx`", + "command": "nx g @nx/expo:component mylib/src/foo --classComponent" } ], "properties": { "path": { "type": "string", - "description": "The file path to the component without the file extension (e.g. `my-app/src/app/my-component/my-component` generates the file `my-app/src/app/my-component/my-component.tsx`). Relative to the current working directory.", + "description": "The file path to the component without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the component file path?" }, diff --git a/docs/generated/packages/expo/generators/library.json b/docs/generated/packages/expo/generators/library.json index ec955911b9797..ce7f139f379e4 100644 --- a/docs/generated/packages/expo/generators/library.json +++ b/docs/generated/packages/expo/generators/library.json @@ -9,7 +9,7 @@ "type": "object", "examples": [ { - "command": "g @nx/expo:lib mylib --directory=myapp", + "command": "nx g @nx/expo:lib mylib --directory=myapp", "description": "Generate libs/myapp/mylib" } ], diff --git a/docs/generated/packages/nest/generators/class.json b/docs/generated/packages/nest/generators/class.json index ccc56164b1566..8cb77da4265d6 100644 --- a/docs/generated/packages/nest/generators/class.json +++ b/docs/generated/packages/nest/generators/class.json @@ -8,9 +8,15 @@ "description": "Nest Class Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the class `Foo` at `myapp/src/app/foo.ts`", + "command": "nx g @nx/nest:class myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the class without the file extension (e.g. `my-app/src/app/my-class/my-class` generates the file `my-app/src/app/my-class/my-class.ts`). Relative to the current working directory.", + "description": "The file path to the class without the file extension. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the class file path?" diff --git a/docs/generated/packages/nest/generators/controller.json b/docs/generated/packages/nest/generators/controller.json index a60607cffac62..58c64fccc5b1a 100644 --- a/docs/generated/packages/nest/generators/controller.json +++ b/docs/generated/packages/nest/generators/controller.json @@ -8,9 +8,15 @@ "description": "Nest Controller Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the controller `FooController` at `myapp/src/app/foo.controller.ts`", + "command": "nx g @nx/nest:controller myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the controller without the file extension and suffix (e.g. `my-app/src/app/my-controller/my-controller` generates the file `my-app/src/app/my-controller/my-controller.controller.ts`). Relative to the current working directory.", + "description": "The file path to the controller without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the controller file path?" diff --git a/docs/generated/packages/nest/generators/decorator.json b/docs/generated/packages/nest/generators/decorator.json index 328b8ca457199..218a1b364dc1c 100644 --- a/docs/generated/packages/nest/generators/decorator.json +++ b/docs/generated/packages/nest/generators/decorator.json @@ -8,9 +8,15 @@ "description": "Nest Decorator Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the decorator `Foo` at `myapp/src/app/foo.decorator.ts`", + "command": "nx g @nx/nest:decorator myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the decorator without the file extension and suffix (e.g. `my-app/src/app/my-decorator/my-decorator` generates the file `my-app/src/app/my-decorator/my-decorator.decorator.ts`). Relative to the current working directory.", + "description": "The file path to the decorator without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the decorator file path?" diff --git a/docs/generated/packages/nest/generators/filter.json b/docs/generated/packages/nest/generators/filter.json index b04533051aec9..02c70a46572f9 100644 --- a/docs/generated/packages/nest/generators/filter.json +++ b/docs/generated/packages/nest/generators/filter.json @@ -8,9 +8,15 @@ "description": "Nest Filter Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the filter `FooFilter` at `myapp/src/app/foo.filter.ts`", + "command": "nx g @nx/nest:filter myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the filter without the file extension and suffix (e.g. `my-app/src/app/my-filter/my-filter` generates the file `my-app/src/app/my-filter/my-filter.filter.ts`). Relative to the current working directory.", + "description": "The file path to the filter without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the filter file path?" diff --git a/docs/generated/packages/nest/generators/gateway.json b/docs/generated/packages/nest/generators/gateway.json index 2ddf72613629f..54899663ce7b5 100644 --- a/docs/generated/packages/nest/generators/gateway.json +++ b/docs/generated/packages/nest/generators/gateway.json @@ -8,9 +8,15 @@ "description": "Nest Gateway Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the gateway `FooGateway` at `myapp/src/app/foo.gateway.ts`", + "command": "nx g @nx/nest:gateway myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the gateway without the file extension and suffix (e.g. `my-app/src/app/my-gateway/my-gateway` generates the file `my-app/src/app/my-gateway/my-gateway.gateway.ts`). Relative to the current working directory.", + "description": "The file path to the gateway without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the gateway file path?" diff --git a/docs/generated/packages/nest/generators/guard.json b/docs/generated/packages/nest/generators/guard.json index b99d08c361980..4731a5d9a2045 100644 --- a/docs/generated/packages/nest/generators/guard.json +++ b/docs/generated/packages/nest/generators/guard.json @@ -8,9 +8,15 @@ "description": "Nest Guard Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the guard `FooGuard` at `myapp/src/app/foo.guard.ts`", + "command": "nx g @nx/nest:guard myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the guard without the file extension and suffix (e.g. `my-app/src/app/my-guard/my-guard` generates the file `my-app/src/app/my-guard/my-guard.guard.ts`). Relative to the current working directory.", + "description": "The file path to the guard without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the guard file path?" diff --git a/docs/generated/packages/nest/generators/interceptor.json b/docs/generated/packages/nest/generators/interceptor.json index ed3d35cba0192..656d5f9ce4fa4 100644 --- a/docs/generated/packages/nest/generators/interceptor.json +++ b/docs/generated/packages/nest/generators/interceptor.json @@ -8,9 +8,15 @@ "description": "Nest Interceptor Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the interceptor `FooInterceptor` at `myapp/src/app/foo.interceptor.ts`", + "command": "nx g @nx/nest:interceptor myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the interceptor without the file extension and suffix (e.g. `my-app/src/app/my-interceptor/my-interceptor` generates the file `my-app/src/app/my-interceptor/my-interceptor.interceptor.ts`). Relative to the current working directory.", + "description": "The file path to the interceptor without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the interceptor file path?" diff --git a/docs/generated/packages/nest/generators/interface.json b/docs/generated/packages/nest/generators/interface.json index c51546fe18590..a9cba7590699c 100644 --- a/docs/generated/packages/nest/generators/interface.json +++ b/docs/generated/packages/nest/generators/interface.json @@ -8,9 +8,15 @@ "description": "Nest Interface Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the interface `Foo` at `myapp/src/app/foo.interface.ts`", + "command": "nx g @nx/nest:interface myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the interface without the file extension and suffix (e.g. `my-app/src/app/my-interface/my-interface` generates the file `my-app/src/app/my-interface/my-interface.interface.ts`). Relative to the current working directory.", + "description": "The file path to the interface without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the interface file path?" diff --git a/docs/generated/packages/nest/generators/middleware.json b/docs/generated/packages/nest/generators/middleware.json index 928441b069add..23bcfd22b9083 100644 --- a/docs/generated/packages/nest/generators/middleware.json +++ b/docs/generated/packages/nest/generators/middleware.json @@ -8,9 +8,15 @@ "description": "Nest Middleware Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the middleware `FooMiddleware` at `myapp/src/app/foo.middleware.ts`", + "command": "nx g @nx/nest:middleware myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the middleware without the file extension and suffix (e.g. `my-app/src/app/my-middleware/my-middleware` generates the file `my-app/src/app/my-middleware/my-middleware.middleware.ts`). Relative to the current working directory.", + "description": "The file path to the middleware without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the middleware file path?" diff --git a/docs/generated/packages/nest/generators/module.json b/docs/generated/packages/nest/generators/module.json index dd3b0074151ff..40c3e0aaf07b6 100644 --- a/docs/generated/packages/nest/generators/module.json +++ b/docs/generated/packages/nest/generators/module.json @@ -8,9 +8,15 @@ "description": "Nest Module Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the module `FooModule` at `myapp/src/app/foo.module.ts`", + "command": "nx g @nx/nest:module myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the module without the file extension and suffix (e.g. `my-app/src/app/my-module/my-module` generates the file `my-app/src/app/my-module/my-module.module.ts`). Relative to the current working directory.", + "description": "The file path to the module without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the module file path?" diff --git a/docs/generated/packages/nest/generators/pipe.json b/docs/generated/packages/nest/generators/pipe.json index a1666a3af91c9..e35abd415bd78 100644 --- a/docs/generated/packages/nest/generators/pipe.json +++ b/docs/generated/packages/nest/generators/pipe.json @@ -8,9 +8,15 @@ "description": "Nest Pipe Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the pipe `FooPipe` at `myapp/src/app/foo.pipe.ts`", + "command": "nx g @nx/nest:pipe myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the pipe without the file extension and suffix (e.g. `my-app/src/app/my-pipe/my-pipe` generates the file `my-app/src/app/my-pipe/my-pipe.pipe.ts`). Relative to the current working directory.", + "description": "The file path to the pipe without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the pipe file path?" diff --git a/docs/generated/packages/nest/generators/provider.json b/docs/generated/packages/nest/generators/provider.json index d9149fe658bb6..afa111b68ef87 100644 --- a/docs/generated/packages/nest/generators/provider.json +++ b/docs/generated/packages/nest/generators/provider.json @@ -8,9 +8,15 @@ "description": "Nest Provider Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the provider `Foo` at `myapp/src/app/foo.ts`", + "command": "nx g @nx/nest:provider myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the provider without the file extension (e.g. `my-app/src/app/my-provider/my-provider` generates the file `my-app/src/app/my-provider/my-provider.ts`). Relative to the current working directory.", + "description": "The file path to the provider without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the provider file path?" diff --git a/docs/generated/packages/nest/generators/resolver.json b/docs/generated/packages/nest/generators/resolver.json index abba2f33aa2af..83aed6442ff14 100644 --- a/docs/generated/packages/nest/generators/resolver.json +++ b/docs/generated/packages/nest/generators/resolver.json @@ -8,9 +8,15 @@ "description": "Nest Resolver Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the resolver `FooResolver` at `myapp/src/app/foo.resolver.ts`", + "command": "nx g @nx/nest:resolver myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the resolver without the file extension and suffix (e.g. `my-app/src/app/my-resolver/my-resolver` generates the file `my-app/src/app/my-resolver/my-resolver.resolver.ts`). Relative to the current working directory.", + "description": "The file path to the resolver without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the resolver file path?" diff --git a/docs/generated/packages/nest/generators/resource.json b/docs/generated/packages/nest/generators/resource.json index c4724800c080c..083e6135cc869 100644 --- a/docs/generated/packages/nest/generators/resource.json +++ b/docs/generated/packages/nest/generators/resource.json @@ -8,10 +8,16 @@ "description": "Nest Resource Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "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`", + "command": "nx g @nx/nest:resource myapp/src/app/foo" + } + ], "properties": { "path": { "type": "string", - "description": "The file path to the resource without the file extension and suffix (e.g. `my-app/src/app/my-resource/my-resource` generates the file `my-app/src/app/my-resource/my-resource.entity.ts`). Relative to the current working directory.", + "description": "The file path to the resource without the file extension and suffix. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the resource file path?" }, diff --git a/docs/generated/packages/nest/generators/service.json b/docs/generated/packages/nest/generators/service.json index 96cf16e41aaf3..f55e04fbb4d2b 100644 --- a/docs/generated/packages/nest/generators/service.json +++ b/docs/generated/packages/nest/generators/service.json @@ -8,9 +8,15 @@ "description": "Nest Service Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the service `FooService` at `myapp/src/app/foo.service.ts`", + "command": "nx g @nx/nest:service myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the service without the file extension and suffix (e.g. `my-app/src/app/my-service/my-service` generates the file `my-app/src/app/my-service/my-service.service.ts`). Relative to the current working directory.", + "description": "The file path to the service without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the service file path?" diff --git a/docs/generated/packages/next/generators/component.json b/docs/generated/packages/next/generators/component.json index def33dd290f76..be5ecf0e4b594 100644 --- a/docs/generated/packages/next/generators/component.json +++ b/docs/generated/packages/next/generators/component.json @@ -11,7 +11,7 @@ "properties": { "path": { "type": "string", - "description": "The file path to the component without the file extension (e.g. `my-app/components/my-component/my-component` generates the file `my-app/components/my-component/my-component.tsx`). Relative to the current working directory.", + "description": "The file path to the component without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the component file path?", "x-priority": "important" @@ -79,7 +79,7 @@ } }, "required": ["path"], - "examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Create an app component\" %}\n\n```shell\nnx g component apps/my-app/src/lib/my-cmp/my-cmp\n```\n\n{% /tab %}\n{% tab label=\"Create a component without its own folder\" %}\n\nRunning the following will create a component under `apps/my-app/components/my-cmp.tsx` rather than `apps/my-app/components/my-cmp/my-cmp.tsx`.\n\n```shell\nnx g component apps/my-app/src/lib/my-cmp\n```\n\n{% /tab %}\n{% tab label=\"Create component in a custom directory\" %}\n\nRunning the following will create a component under `apps/my-app/foo/my-cmp.tsx` rather than `apps/my-app/my-cmp/my-cmp.tsx`.\n\n```shell\nnx g component apps/my-app/foo/my-cmp\n```\n\n{% /tab %}\n{% /tabs %}\n", + "examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Create a Component\" %}\n\nGenerate a component named `MyComponent` at `apps/my-app/src/app/my-component/my-component.tsx`:\n\n```shell\nnx g component apps/my-app/src/app/my-component/my-component\n```\n\n{% /tab %}\n{% tab label=\"Create a Component with a Different Symbol Name\" %}\n\nGenerate a component named `Custom` at `apps/my-app/src/app/my-component/my-component.tsx`:\n\n```shell\nnx g component apps/my-app/src/app/my-component/my-component --name=custom\n```\n\n{% /tab %}\n{% /tabs %}\n", "presets": [] }, "description": "Create a component.", diff --git a/docs/generated/packages/next/generators/page.json b/docs/generated/packages/next/generators/page.json index e3c11edcecb2e..74f658610d3f9 100644 --- a/docs/generated/packages/next/generators/page.json +++ b/docs/generated/packages/next/generators/page.json @@ -79,7 +79,7 @@ } }, "required": ["path"], - "examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Create static page in an app\" %}\n\n```shell\nnx g page apps/my-app/pages/my-page\n```\n\n{% /tab %}\n{% tab label=\"Create dynamic page in an app\" %}\n\nThe following creates a page under `apps/my-app/pages/products/[id].tsx`.\n\n```shell\nnx g page \"apps/my-app/pages/products/[id]\"\n```\n\n{% /tab %}\n\n{% /tabs %}\n", + "examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Create a Static Page\" %}\n\nGenerate a static page named `MyPage` at `apps/my-app/pages/my-page/page.tsx`:\n\n```shell\nnx g page apps/my-app/pages/my-page\n```\n\n{% /tab %}\n{% tab label=\"Create a Dynamic Page\" %}\n\nGenerate a dynamic page at `apps/my-app/pages/products/[id]/page.tsx`:\n\n```shell\nnx g page \"apps/my-app/pages/products/[id]\"\n```\n\n{% /tab %}\n\n{% /tabs %}\n", "presets": [] }, "description": "Create a page.", diff --git a/docs/generated/packages/plugin/generators/executor.json b/docs/generated/packages/plugin/generators/executor.json index 46e2e96404c29..afbc23662ccd6 100644 --- a/docs/generated/packages/plugin/generators/executor.json +++ b/docs/generated/packages/plugin/generators/executor.json @@ -7,18 +7,12 @@ "$id": "NxPluginExecutor", "title": "Create an Executor for an Nx Plugin", "description": "Create an Executor for an Nx Plugin.", - "examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Basic executor\" %}\n\nCreate a new executor called `build` inside the plugin `my-plugin`:\n\n```bash\nnx g @nx/plugin:executor tools/my-plugin/src/executors/build\n```\n\n{% /tab %}\n{% tab label=\"With custom hashing\" %}\n\nCreate a new executor called `build` inside the plugin `my-plugin`, that uses a custom hashing function:\n\n```bash\nnx g @nx/plugin:executor tools/my-plugin/src/executors/build --includeHasher\n```\n\n{% /tab %}\n{% /tabs %}\n", + "examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Basic executor\" %}\n\nCreate a new executor called `build` at `tools/my-plugin/src/executors/build.ts`:\n\n```bash\nnx g @nx/plugin:executor tools/my-plugin/src/executors/build\n```\n\n{% /tab %}\n{% tab label=\"With different exported name\" %}\n\nCreate a new executor called `custom` at `tools/my-plugin/src/executors/build.ts`:\n\n```bash\nnx g @nx/plugin:executor tools/my-plugin/src/executors/build --name=custom\n```\n\n{% /tab %}\n{% tab label=\"With custom hashing\" %}\n\nCreate a new executor called `build` at `tools/my-plugin/src/executors/build.ts`, that uses a custom hashing function:\n\n```bash\nnx g @nx/plugin:executor tools/my-plugin/src/executors/build --includeHasher\n```\n\n{% /tab %}\n{% /tabs %}\n", "type": "object", - "examples": [ - { - "command": "nx g executor libs/my-plugin/src/executors/my-executor", - "description": "Generate `libs/my-plugin/src/executors/my-executor`" - } - ], "properties": { "path": { "type": "string", - "description": "The file path to the executor without the file extension (e.g. `my-plugin/src/executors/my-executor` generates the file `my-plugin/src/executors/my-executor.ts`). Relative to the current working directory.", + "description": "The file path to the executor without the file extension. Relative to the current working directory.", "x-prompt": "What is the executor file path?", "$default": { "$source": "argv", "index": 0 }, "x-priority": "important" diff --git a/docs/generated/packages/plugin/generators/generator.json b/docs/generated/packages/plugin/generators/generator.json index ed1db76ae0ccb..37f5350d58118 100644 --- a/docs/generated/packages/plugin/generators/generator.json +++ b/docs/generated/packages/plugin/generators/generator.json @@ -10,14 +10,18 @@ "type": "object", "examples": [ { - "command": "nx g generator libs/my-plugin/src/generators/my-generator", - "description": "Generate `libs/my-plugin/src/generators/my-generator`" + "description": "Generate a generator exported with the name matching the file name. It results in the generator `foo` at `mylib/src/generators/foo.ts`", + "command": "nx g @nx/plugin:generator mylib/src/generators/foo" + }, + { + "description": "Generate a generator exported with a different name from the file name. It results in the generator `custom` at `mylib/src/generators/foo.ts`", + "command": "nx g @nx/plugin:generator mylib/src/generators/foo --name=custom" } ], "properties": { "path": { "type": "string", - "description": "The file path to the generator without the file extension (e.g. `my-plugin/src/generators/my-generator` generates the file `my-plugin/src/generators/my-generator.ts`). Relative to the current working directory.", + "description": "The file path to the generator without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the generator file path?", "x-priority": "important" diff --git a/docs/generated/packages/plugin/generators/migration.json b/docs/generated/packages/plugin/generators/migration.json index 61d99d336568d..e86d1e1f0da72 100644 --- a/docs/generated/packages/plugin/generators/migration.json +++ b/docs/generated/packages/plugin/generators/migration.json @@ -10,14 +10,18 @@ "type": "object", "examples": [ { - "command": "nx g migration my-plugin/my-migration --version=1.0.0", - "description": "Adds a new migration inside `my-plugin`, which will be triggered when migrating to version 1.0.0 or above from a previous version." + "description": "Generate a migration exported with the name matching the file name, which will be triggered when migrating to version 1.0.0 or above from a previous version. It results in the migration `foo` at `mylib/src/migrations/foo.ts`", + "command": "nx g @nx/plugin:migration mylib/src/migrations/foo -v=1.0.0" + }, + { + "description": "Generate a migration exported with a different name from the file name, which will be triggered when migrating to version 1.0.0 or above from a previous version. It results in the migration `custom` at `mylib/src/migrations/foo.ts`", + "command": "nx g @nx/plugin:migration mylib/src/migrations/foo --name=custom -v=1.0.0" } ], "properties": { "path": { "type": "string", - "description": "The file path to the migration without the file extension (e.g. `my-plugin/src/migrations/my-migration` generates the file `my-plugin/src/migrations/my-migration.ts`). Relative to the current working directory.", + "description": "The file path to the migration without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the migration file path?", "x-priority": "important" diff --git a/docs/generated/packages/react-native/generators/component.json b/docs/generated/packages/react-native/generators/component.json index 845de58dd3d3a..b8110eae0c65b 100644 --- a/docs/generated/packages/react-native/generators/component.json +++ b/docs/generated/packages/react-native/generators/component.json @@ -10,18 +10,22 @@ "type": "object", "examples": [ { - "command": "nx g @nx/react-native:component mylib/src/lib/my-component/my-component ", - "description": "Generate a component in the `mylib` library" + "description": "Generate a component with the exported symbol matching the file name. It results in the component `Foo` at `mylib/src/lib/foo.tsx`", + "command": "nx g @nx/react-native:component mylib/src/lib/foo" }, { - "command": "nx g @nx/react-native:component mylib/src/lib/my-component/my-component --classComponent", - "description": "Generate a class component in the `mylib` library" + "description": "Generate a component with the exported symbol different from the file name. It results in the component `Custom` at `mylib/src/lib/foo.tsx`", + "command": "nx g @nx/react-native:component mylib/src/lib/foo --name=custom" + }, + { + "description": "Generate a class component at `mylib/src/lib/foo.tsx`", + "command": "nx g @nx/react-native:component mylib/src/lib/foo --classComponent" } ], "properties": { "path": { "type": "string", - "description": "The file path to the component without the file extension (e.g. `my-app/src/app/my-component/my-component` generates the file `my-app/src/app/my-component/my-component.tsx`). Relative to the current working directory.", + "description": "The file path to the component without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the component file path?" }, diff --git a/docs/generated/packages/react/generators/component.json b/docs/generated/packages/react/generators/component.json index 7626bda8b99d9..53432b4bc212a 100644 --- a/docs/generated/packages/react/generators/component.json +++ b/docs/generated/packages/react/generators/component.json @@ -11,7 +11,7 @@ "properties": { "path": { "type": "string", - "description": "The file path to the component without the file extension (e.g. `my-app/src/app/my-component/my-component` generates the file `my-app/src/app/my-component/my-component.tsx`). Relative to the current working directory.", + "description": "The file path to the component without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the component file path?", "x-priority": "important" @@ -104,7 +104,7 @@ } }, "required": ["path"], - "examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Component\" %}\n\nCreate a component named `my-component` under the `libs/ui` project:\n\n```shell\nnx g @nx/react:component libs/ui/src/my-component\n```\n\n{% /tab %}\n\n{% tab label=\"Standalone Component\" %}\n\nCreate a class component named `my-component` under the `libs/ui` project:\n\n```shell\nnx g @nx/react:component libs/ui/src/my-component --classComponent\n```\n\n{% /tab %}\n", + "examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Component\" %}\n\nCreate a component named `MyComponent` at `libs/ui/src/my-component.tsx`:\n\n```shell\nnx g @nx/react:component libs/ui/src/my-component\n```\n\n{% /tab %}\n\n{% tab label=\"With a Different Symbol Name\" %}\n\nCreate a component named `Custom` at `libs/ui/src/my-component.tsx`:\n\n```shell\nnx g @nx/react:component libs/ui/src/my-component --name=custom\n```\n\n{% /tab %}\n\n{% tab label=\"Class Component\" %}\n\nCreate a class component named `MyComponent` at `libs/ui/src/my-component.tsx`:\n\n```shell\nnx g @nx/react:component libs/ui/src/my-component --classComponent\n```\n\n{% /tab %}\n", "presets": [] }, "description": "Create a React component.", diff --git a/docs/generated/packages/react/generators/hook.json b/docs/generated/packages/react/generators/hook.json index acf727d4d02bf..e95adfe3f908d 100644 --- a/docs/generated/packages/react/generators/hook.json +++ b/docs/generated/packages/react/generators/hook.json @@ -10,14 +10,18 @@ "type": "object", "examples": [ { - "command": "nx g hook mylib/my-hook", - "description": "Generate a hook `my-hook` in the `mylib` library" + "description": "Generate a hook with the exported symbol matching the file name. It results in the hook `useFoo` at `mylib/src/lib/foo.ts`", + "command": "nx g @nx/react:hook mylib/src/lib/foo" + }, + { + "description": "Generate a hook with the exported symbol different from the file name. It results in the hook `useCustom` at `mylib/src/lib/foo.ts`", + "command": "nx g @nx/react:hook mylib/src/lib/foo --name=useCustom" } ], "properties": { "path": { "type": "string", - "description": "The file path to the hook without the file extension (e.g. `my-app/src/app/my-hook/use-my-hook` generates the file `my-app/src/app/my-hook/use-my-hook.ts`). Relative to the current working directory.", + "description": "The file path to the hook without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the hook file path?", "x-priority": "important" @@ -45,7 +49,7 @@ "x-prompt": "Should this hook be exported in the project?" } }, - "required": ["name"], + "required": ["path"], "presets": [] }, "description": "Create a hook.", diff --git a/docs/generated/packages/react/generators/redux.json b/docs/generated/packages/react/generators/redux.json index 8756c96a6582b..893c4845dc2df 100644 --- a/docs/generated/packages/react/generators/redux.json +++ b/docs/generated/packages/react/generators/redux.json @@ -8,10 +8,20 @@ "title": "Create Redux state", "description": "Create a Redux state slice for a React project.", "type": "object", + "examples": [ + { + "description": "Generate a Redux state slice with the exported symbol matching the file name. It results in the slice `fooSlice` at `mylib/src/lib/foo.slice.ts`", + "command": "nx g @nx/react:redux mylib/src/lib/foo" + }, + { + "description": "Generate a Redux state slice with the exported symbol different from the file name. It results in the slice `customSlice` at `mylib/src/lib/foo.slice.ts`", + "command": "nx g @nx/react:redux mylib/src/lib/foo --name=custom" + } + ], "properties": { "path": { "type": "string", - "description": "The file path to the Redux state slice without the file extension (e.g. `my-app/src/app/my-slice/my-slice` generates the file `my-app/src/app/my-slice/my-slice.ts`). Relative to the current working directory.", + "description": "The file path to the Redux state slice without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the Redux stateslice file path?", "x-priority": "important" diff --git a/docs/generated/packages/vue/generators/component.json b/docs/generated/packages/vue/generators/component.json index fe27531973b8a..6eb4e14372287 100644 --- a/docs/generated/packages/vue/generators/component.json +++ b/docs/generated/packages/vue/generators/component.json @@ -10,21 +10,17 @@ "type": "object", "examples": [ { - "command": "nx g @nx/vue:component my-app/src/app/one --unitTestRunner=vitest", - "description": "Generate a component `one` in the `my-app` application at my-app/src/app/one" + "description": "Generate a component at `mylib/src/lib/foo.vue` with `vitest` as the unit test runner", + "command": "nx g @nx/vue:component mylib/src/lib/foo --unitTestRunner=vitest" } ], "properties": { "path": { "type": "string", - "description": "The file path to the component without the file extension (e.g. `my-app/src/app/my-component/my-component` generates the file `my-app/src/app/my-component/my-component.vue`). Relative to the current working directory.", + "description": "The file path to the component without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the component file path?" }, - "name": { - "type": "string", - "description": "The component symbol name. Defaults to the last segment of the file path." - }, "js": { "type": "boolean", "description": "Generate JavaScript files rather than TypeScript files.", diff --git a/packages/angular/docs/component-examples.md b/packages/angular/docs/component-examples.md index 22bc7481ca5a1..08e0ae5a7dbdd 100644 --- a/packages/angular/docs/component-examples.md +++ b/packages/angular/docs/component-examples.md @@ -3,7 +3,7 @@ {% tabs %} {% tab label="Simple Component" %} -Create a component named `my-component`: +Generate a component named `MyComponent` at `apps/my-app/src/lib/my-component/my-component.component.ts`: ```bash nx g @nx/angular:component apps/my-app/src/lib/my-component/my-component @@ -11,6 +11,16 @@ nx g @nx/angular:component apps/my-app/src/lib/my-component/my-component {% /tab %} +{% tab label="With Different Symbol Name" %} + +Generate a component named `CustomComponent` at `apps/my-app/src/lib/my-component/my-component.component.ts`: + +```bash +nx g @nx/angular:component apps/my-app/src/lib/my-component/my-component --name=custom +``` + +{% /tab %} + {% tab label="Single File Component" %} Create a component named `my-component` with inline styles and inline template: diff --git a/packages/angular/src/generators/component/schema.json b/packages/angular/src/generators/component/schema.json index 5c35c9a4123e2..d7e569eb17a30 100644 --- a/packages/angular/src/generators/component/schema.json +++ b/packages/angular/src/generators/component/schema.json @@ -9,7 +9,7 @@ "properties": { "path": { "type": "string", - "description": "The file path to the component without the file extension and suffix (e.g. `my-app/src/app/my-component/my-component` generates the file `my-app/src/app/my-component/my-component.component.ts`). Relative to the current working directory.", + "description": "The file path to the component without the file extension and suffix. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 diff --git a/packages/angular/src/generators/directive/schema.json b/packages/angular/src/generators/directive/schema.json index 8af95801b9082..28d3e29bae9b8 100644 --- a/packages/angular/src/generators/directive/schema.json +++ b/packages/angular/src/generators/directive/schema.json @@ -6,10 +6,20 @@ "type": "object", "description": "Creates a new Angular directive.", "additionalProperties": false, + "examples": [ + { + "description": "Generate a directive with the exported symbol matching the file name. It results in the directive `FooDirective` at `mylib/src/lib/foo.directive.ts`", + "command": "nx g @nx/angular:directive mylib/src/lib/foo" + }, + { + "description": "Generate a directive with the exported symbol different from the file name. It results in the directive `CustomDirective` at `mylib/src/lib/foo.directive.ts`", + "command": "nx g @nx/angular:directive mylib/src/lib/foo --name=custom" + } + ], "properties": { "path": { "type": "string", - "description": "The file path to the directive without the file extension and suffix (e.g. `my-app/src/app/my-directive/my-directive` generates the file `my-app/src/app/my-directive/my-directive.directive.ts`). Relative to the current working directory.", + "description": "The file path to the directive without the file extension and suffix. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 diff --git a/packages/angular/src/generators/pipe/schema.json b/packages/angular/src/generators/pipe/schema.json index 44e3676ddb480..6698b4fa83eec 100644 --- a/packages/angular/src/generators/pipe/schema.json +++ b/packages/angular/src/generators/pipe/schema.json @@ -6,10 +6,20 @@ "cli": "nx", "additionalProperties": false, "description": "Creates an Angular pipe.", + "examples": [ + { + "description": "Generate a pipe with the exported symbol matching the file name. It results in the pipe `FooPipe` at `mylib/src/lib/foo.pipe.ts`", + "command": "nx g @nx/angular:pipe mylib/src/lib/foo" + }, + { + "description": "Generate a pipe with the exported symbol different from the file name. It results in the pipe `CustomPipe` at `mylib/src/lib/foo.pipe.ts`", + "command": "nx g @nx/angular:pipe mylib/src/lib/foo --name=custom" + } + ], "properties": { "path": { "type": "string", - "description": "The file path to the pipe without the file extension and suffix (e.g. `my-app/src/app/my-pipe/my-pipe` generates the file `my-app/src/app/my-pipe/my-pipe.pipe.ts`). Relative to the current working directory.", + "description": "The file path to the pipe without the file extension and suffix. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 diff --git a/packages/angular/src/generators/scam-directive/schema.json b/packages/angular/src/generators/scam-directive/schema.json index 6bdb52e1c99fb..79ad26713c7e9 100644 --- a/packages/angular/src/generators/scam-directive/schema.json +++ b/packages/angular/src/generators/scam-directive/schema.json @@ -6,8 +6,12 @@ "type": "object", "examples": [ { - "command": "nx g @nx/angular:scam-directive my-lib/src/lib/my-sample/my-sample", - "description": "Generate a `MySampleDirective` directive in a `my-sample` folder in the `my-lib` library" + "description": "Generate a directive with the exported symbol matching the file name. It results in the directive `FooDirective` at `mylib/src/lib/foo.directive.ts`", + "command": "nx g @nx/angular:scam-directive mylib/src/lib/foo" + }, + { + "description": "Generate a directive with the exported symbol different from the file name. It results in the directive `CustomDirective` at `mylib/src/lib/foo.directive.ts`", + "command": "nx g @nx/angular:scam-directive mylib/src/lib/foo --name=custom" } ], "description": "Creates a new, generic Angular directive definition in the given or default project.", @@ -15,7 +19,7 @@ "properties": { "path": { "type": "string", - "description": "The file path to the SCAM directive without the file extension and suffix (e.g. `my-app/src/app/my-scam/my-scam` generates the file `my-app/src/app/my-scam/my-scam.directive.ts`). Relative to the current working directory.", + "description": "The file path to the SCAM directive without the file extension and suffix. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 diff --git a/packages/angular/src/generators/scam-pipe/schema.json b/packages/angular/src/generators/scam-pipe/schema.json index 97f2b90eef605..90e0982352cf4 100644 --- a/packages/angular/src/generators/scam-pipe/schema.json +++ b/packages/angular/src/generators/scam-pipe/schema.json @@ -6,8 +6,12 @@ "type": "object", "examples": [ { - "command": "nx g @nx/angular:scam-pipe mylib/src/lib/my-transformation/my-transformation", - "description": "Generates a `MyTransformationPipe` in a `my-transformation` folder in the `my-lib` project" + "description": "Generate a pipe with the exported symbol matching the file name. It results in the pipe `FooPipe` at `mylib/src/lib/foo.pipe.ts`", + "command": "nx g @nx/angular:scam-pipe mylib/src/lib/foo" + }, + { + "description": "Generate a pipe with the exported symbol different from the file name. It results in the pipe `CustomPipe` at `mylib/src/lib/foo.pipe.ts`", + "command": "nx g @nx/angular:scam-pipe mylib/src/lib/foo --name=custom" } ], "description": "Creates a new, generic Angular pipe definition in the given or default project.", @@ -15,7 +19,7 @@ "properties": { "path": { "type": "string", - "description": "The file path to the SCAM pipe without the file extension and suffix (e.g. `my-app/src/app/my-scam/my-scam` generates the file `my-app/src/app/my-scam/my-scam.pipe.ts`). Relative to the current working directory.", + "description": "The file path to the SCAM pipe without the file extension and suffix. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 diff --git a/packages/angular/src/generators/scam/schema.json b/packages/angular/src/generators/scam/schema.json index 95db776c2d119..2d005a07bac00 100644 --- a/packages/angular/src/generators/scam/schema.json +++ b/packages/angular/src/generators/scam/schema.json @@ -6,8 +6,12 @@ "type": "object", "examples": [ { - "command": "nx g @nx/angular:scam my-lib/src/lib/my-sample/my-sample", - "description": "Generate a `MySampleComponent` component in the `my-lib` library." + "description": "Generate a component with the exported symbol matching the file name. It results in the component `FooComponent` at `mylib/src/lib/foo.component.ts`", + "command": "nx g @nx/angular:scam mylib/src/lib/foo" + }, + { + "description": "Generate a component with the exported symbol different from the file name. It results in the component `CustomComponent` at `mylib/src/lib/foo.component.ts`", + "command": "nx g @nx/angular:scam mylib/src/lib/foo --name=custom" } ], "description": "Creates a new Angular SCAM.", @@ -15,7 +19,7 @@ "properties": { "path": { "type": "string", - "description": "The file path to the SCAM without the file extension and suffix (e.g. `my-app/src/app/my-scam/my-scam` generates the file `my-app/src/app/my-scam/my-scam.component.ts`). Relative to the current working directory.", + "description": "The file path to the SCAM without the file extension and suffix. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 diff --git a/packages/expo/src/generators/application/schema.json b/packages/expo/src/generators/application/schema.json index bbfcb6875fe6e..197f2a7840c05 100644 --- a/packages/expo/src/generators/application/schema.json +++ b/packages/expo/src/generators/application/schema.json @@ -5,11 +5,11 @@ "description": "Create an Expo Application for Nx.", "examples": [ { - "command": "g @nx/expo:app myapp --directory=nested", + "command": "nx g @nx/expo:app myapp --directory=nested", "description": "Generate apps/nested/myapp" }, { - "command": "g @nx/expo:app myapp --classComponent", + "command": "nx g @nx/expo:app myapp --classComponent", "description": "Use class components instead of functional components" } ], diff --git a/packages/expo/src/generators/component/schema.json b/packages/expo/src/generators/component/schema.json index 3e05307820597..4d9ae633828fd 100644 --- a/packages/expo/src/generators/component/schema.json +++ b/packages/expo/src/generators/component/schema.json @@ -6,18 +6,22 @@ "type": "object", "examples": [ { - "command": "g @nx/expo:component mylib/my-component", - "description": "Generate a component in the mylib library" + "description": "Generate a component with the exported symbol matching the file name. It results in the component `Foo` at `mylib/src/foo.tsx`", + "command": "nx g @nx/expo:component mylib/src/foo" }, { - "command": "g @nx/expo:component mylib/my-component --classComponent", - "description": "Generate a class component in the mylib library" + "description": "Generate a component with the exported symbol different from the file name. It results in the component `Custom` at `mylib/src/foo.tsx`", + "command": "nx g @nx/expo:component mylib/src/foo --name=custom" + }, + { + "description": "Generate a class component at `mylib/src/foo.tsx`", + "command": "nx g @nx/expo:component mylib/src/foo --classComponent" } ], "properties": { "path": { "type": "string", - "description": "The file path to the component without the file extension (e.g. `my-app/src/app/my-component/my-component` generates the file `my-app/src/app/my-component/my-component.tsx`). Relative to the current working directory.", + "description": "The file path to the component without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 diff --git a/packages/expo/src/generators/library/schema.json b/packages/expo/src/generators/library/schema.json index 5425019828b83..11c7c50439b39 100644 --- a/packages/expo/src/generators/library/schema.json +++ b/packages/expo/src/generators/library/schema.json @@ -6,7 +6,7 @@ "type": "object", "examples": [ { - "command": "g @nx/expo:lib mylib --directory=myapp", + "command": "nx g @nx/expo:lib mylib --directory=myapp", "description": "Generate libs/myapp/mylib" } ], diff --git a/packages/nest/src/generators/class/schema.json b/packages/nest/src/generators/class/schema.json index b5e0ec6ba7f10..55188ad976881 100644 --- a/packages/nest/src/generators/class/schema.json +++ b/packages/nest/src/generators/class/schema.json @@ -5,9 +5,15 @@ "description": "Nest Class Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the class `Foo` at `myapp/src/app/foo.ts`", + "command": "nx g @nx/nest:class myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the class without the file extension (e.g. `my-app/src/app/my-class/my-class` generates the file `my-app/src/app/my-class/my-class.ts`). Relative to the current working directory.", + "description": "The file path to the class without the file extension. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", diff --git a/packages/nest/src/generators/controller/schema.json b/packages/nest/src/generators/controller/schema.json index a3bebf707fb9f..c583a1627f42c 100644 --- a/packages/nest/src/generators/controller/schema.json +++ b/packages/nest/src/generators/controller/schema.json @@ -5,9 +5,15 @@ "description": "Nest Controller Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the controller `FooController` at `myapp/src/app/foo.controller.ts`", + "command": "nx g @nx/nest:controller myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the controller without the file extension and suffix (e.g. `my-app/src/app/my-controller/my-controller` generates the file `my-app/src/app/my-controller/my-controller.controller.ts`). Relative to the current working directory.", + "description": "The file path to the controller without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", diff --git a/packages/nest/src/generators/decorator/schema.json b/packages/nest/src/generators/decorator/schema.json index aa39770fd22d6..bd481761fb0fc 100644 --- a/packages/nest/src/generators/decorator/schema.json +++ b/packages/nest/src/generators/decorator/schema.json @@ -5,9 +5,15 @@ "description": "Nest Decorator Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the decorator `Foo` at `myapp/src/app/foo.decorator.ts`", + "command": "nx g @nx/nest:decorator myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the decorator without the file extension and suffix (e.g. `my-app/src/app/my-decorator/my-decorator` generates the file `my-app/src/app/my-decorator/my-decorator.decorator.ts`). Relative to the current working directory.", + "description": "The file path to the decorator without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", diff --git a/packages/nest/src/generators/filter/schema.json b/packages/nest/src/generators/filter/schema.json index 8022f49d5a97c..9ed282afb9d51 100644 --- a/packages/nest/src/generators/filter/schema.json +++ b/packages/nest/src/generators/filter/schema.json @@ -5,9 +5,15 @@ "description": "Nest Filter Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the filter `FooFilter` at `myapp/src/app/foo.filter.ts`", + "command": "nx g @nx/nest:filter myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the filter without the file extension and suffix (e.g. `my-app/src/app/my-filter/my-filter` generates the file `my-app/src/app/my-filter/my-filter.filter.ts`). Relative to the current working directory.", + "description": "The file path to the filter without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", diff --git a/packages/nest/src/generators/gateway/schema.json b/packages/nest/src/generators/gateway/schema.json index 5582191d4b552..16550c2fb98a4 100644 --- a/packages/nest/src/generators/gateway/schema.json +++ b/packages/nest/src/generators/gateway/schema.json @@ -5,9 +5,15 @@ "description": "Nest Gateway Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the gateway `FooGateway` at `myapp/src/app/foo.gateway.ts`", + "command": "nx g @nx/nest:gateway myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the gateway without the file extension and suffix (e.g. `my-app/src/app/my-gateway/my-gateway` generates the file `my-app/src/app/my-gateway/my-gateway.gateway.ts`). Relative to the current working directory.", + "description": "The file path to the gateway without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", diff --git a/packages/nest/src/generators/guard/schema.json b/packages/nest/src/generators/guard/schema.json index 2d9da1b04871b..388f8246e3ca6 100644 --- a/packages/nest/src/generators/guard/schema.json +++ b/packages/nest/src/generators/guard/schema.json @@ -5,9 +5,15 @@ "description": "Nest Guard Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the guard `FooGuard` at `myapp/src/app/foo.guard.ts`", + "command": "nx g @nx/nest:guard myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the guard without the file extension and suffix (e.g. `my-app/src/app/my-guard/my-guard` generates the file `my-app/src/app/my-guard/my-guard.guard.ts`). Relative to the current working directory.", + "description": "The file path to the guard without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", diff --git a/packages/nest/src/generators/interceptor/schema.json b/packages/nest/src/generators/interceptor/schema.json index 828d890f7e3b1..21604cc5fbe63 100644 --- a/packages/nest/src/generators/interceptor/schema.json +++ b/packages/nest/src/generators/interceptor/schema.json @@ -5,9 +5,15 @@ "description": "Nest Interceptor Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the interceptor `FooInterceptor` at `myapp/src/app/foo.interceptor.ts`", + "command": "nx g @nx/nest:interceptor myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the interceptor without the file extension and suffix (e.g. `my-app/src/app/my-interceptor/my-interceptor` generates the file `my-app/src/app/my-interceptor/my-interceptor.interceptor.ts`). Relative to the current working directory.", + "description": "The file path to the interceptor without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", diff --git a/packages/nest/src/generators/interface/schema.json b/packages/nest/src/generators/interface/schema.json index b2383a16bd8cc..c8bfd3fe6ff2a 100644 --- a/packages/nest/src/generators/interface/schema.json +++ b/packages/nest/src/generators/interface/schema.json @@ -5,9 +5,15 @@ "description": "Nest Interface Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the interface `Foo` at `myapp/src/app/foo.interface.ts`", + "command": "nx g @nx/nest:interface myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the interface without the file extension and suffix (e.g. `my-app/src/app/my-interface/my-interface` generates the file `my-app/src/app/my-interface/my-interface.interface.ts`). Relative to the current working directory.", + "description": "The file path to the interface without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", diff --git a/packages/nest/src/generators/middleware/schema.json b/packages/nest/src/generators/middleware/schema.json index 269dd39350206..fba06ed958b89 100644 --- a/packages/nest/src/generators/middleware/schema.json +++ b/packages/nest/src/generators/middleware/schema.json @@ -5,9 +5,15 @@ "description": "Nest Middleware Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the middleware `FooMiddleware` at `myapp/src/app/foo.middleware.ts`", + "command": "nx g @nx/nest:middleware myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the middleware without the file extension and suffix (e.g. `my-app/src/app/my-middleware/my-middleware` generates the file `my-app/src/app/my-middleware/my-middleware.middleware.ts`). Relative to the current working directory.", + "description": "The file path to the middleware without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", diff --git a/packages/nest/src/generators/module/schema.json b/packages/nest/src/generators/module/schema.json index c4efb938d226d..f730ac1d1c15a 100644 --- a/packages/nest/src/generators/module/schema.json +++ b/packages/nest/src/generators/module/schema.json @@ -5,9 +5,15 @@ "description": "Nest Module Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the module `FooModule` at `myapp/src/app/foo.module.ts`", + "command": "nx g @nx/nest:module myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the module without the file extension and suffix (e.g. `my-app/src/app/my-module/my-module` generates the file `my-app/src/app/my-module/my-module.module.ts`). Relative to the current working directory.", + "description": "The file path to the module without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", diff --git a/packages/nest/src/generators/pipe/schema.json b/packages/nest/src/generators/pipe/schema.json index 55c6a9afe6849..f7da5a8c95dea 100644 --- a/packages/nest/src/generators/pipe/schema.json +++ b/packages/nest/src/generators/pipe/schema.json @@ -5,9 +5,15 @@ "description": "Nest Pipe Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the pipe `FooPipe` at `myapp/src/app/foo.pipe.ts`", + "command": "nx g @nx/nest:pipe myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the pipe without the file extension and suffix (e.g. `my-app/src/app/my-pipe/my-pipe` generates the file `my-app/src/app/my-pipe/my-pipe.pipe.ts`). Relative to the current working directory.", + "description": "The file path to the pipe without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", diff --git a/packages/nest/src/generators/provider/schema.json b/packages/nest/src/generators/provider/schema.json index 49f3d3dd500a8..ab1bcf9472ed1 100644 --- a/packages/nest/src/generators/provider/schema.json +++ b/packages/nest/src/generators/provider/schema.json @@ -5,9 +5,15 @@ "description": "Nest Provider Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the provider `Foo` at `myapp/src/app/foo.ts`", + "command": "nx g @nx/nest:provider myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the provider without the file extension (e.g. `my-app/src/app/my-provider/my-provider` generates the file `my-app/src/app/my-provider/my-provider.ts`). Relative to the current working directory.", + "description": "The file path to the provider without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", diff --git a/packages/nest/src/generators/resolver/schema.json b/packages/nest/src/generators/resolver/schema.json index ca8e3d66840d5..3226b4a078fb3 100644 --- a/packages/nest/src/generators/resolver/schema.json +++ b/packages/nest/src/generators/resolver/schema.json @@ -5,9 +5,15 @@ "description": "Nest Resolver Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the resolver `FooResolver` at `myapp/src/app/foo.resolver.ts`", + "command": "nx g @nx/nest:resolver myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the resolver without the file extension and suffix (e.g. `my-app/src/app/my-resolver/my-resolver` generates the file `my-app/src/app/my-resolver/my-resolver.resolver.ts`). Relative to the current working directory.", + "description": "The file path to the resolver without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", diff --git a/packages/nest/src/generators/resource/schema.json b/packages/nest/src/generators/resource/schema.json index 90fa061671917..304567d33d38a 100644 --- a/packages/nest/src/generators/resource/schema.json +++ b/packages/nest/src/generators/resource/schema.json @@ -5,10 +5,16 @@ "description": "Nest Resource Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "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`", + "command": "nx g @nx/nest:resource myapp/src/app/foo" + } + ], "properties": { "path": { "type": "string", - "description": "The file path to the resource without the file extension and suffix (e.g. `my-app/src/app/my-resource/my-resource` generates the file `my-app/src/app/my-resource/my-resource.entity.ts`). Relative to the current working directory.", + "description": "The file path to the resource without the file extension and suffix. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 diff --git a/packages/nest/src/generators/service/schema.json b/packages/nest/src/generators/service/schema.json index 2136c6a94c247..4d96311886dfd 100644 --- a/packages/nest/src/generators/service/schema.json +++ b/packages/nest/src/generators/service/schema.json @@ -5,9 +5,15 @@ "description": "Nest Service Options Schema.", "cli": "nx", "type": "object", + "examples": [ + { + "description": "Generate the service `FooService` at `myapp/src/app/foo.service.ts`", + "command": "nx g @nx/nest:service myapp/src/app/foo" + } + ], "properties": { "path": { - "description": "The file path to the service without the file extension and suffix (e.g. `my-app/src/app/my-service/my-service` generates the file `my-app/src/app/my-service/my-service.service.ts`). Relative to the current working directory.", + "description": "The file path to the service without the file extension and suffix. Relative to the current working directory.", "type": "string", "$default": { "$source": "argv", diff --git a/packages/next/docs/component-examples.md b/packages/next/docs/component-examples.md index 75b1bf30b1731..44d508d5ba3b0 100644 --- a/packages/next/docs/component-examples.md +++ b/packages/next/docs/component-examples.md @@ -1,28 +1,21 @@ ## Examples {% tabs %} -{% tab label="Create an app component" %} +{% tab label="Create a Component" %} -```shell -nx g component apps/my-app/src/lib/my-cmp/my-cmp -``` - -{% /tab %} -{% tab label="Create a component without its own folder" %} - -Running the following will create a component under `apps/my-app/components/my-cmp.tsx` rather than `apps/my-app/components/my-cmp/my-cmp.tsx`. +Generate a component named `MyComponent` at `apps/my-app/src/app/my-component/my-component.tsx`: ```shell -nx g component apps/my-app/src/lib/my-cmp +nx g component apps/my-app/src/app/my-component/my-component ``` {% /tab %} -{% tab label="Create component in a custom directory" %} +{% tab label="Create a Component with a Different Symbol Name" %} -Running the following will create a component under `apps/my-app/foo/my-cmp.tsx` rather than `apps/my-app/my-cmp/my-cmp.tsx`. +Generate a component named `Custom` at `apps/my-app/src/app/my-component/my-component.tsx`: ```shell -nx g component apps/my-app/foo/my-cmp +nx g component apps/my-app/src/app/my-component/my-component --name=custom ``` {% /tab %} diff --git a/packages/next/docs/page-examples.md b/packages/next/docs/page-examples.md index 6fe460e925e5b..fcea7385706fb 100644 --- a/packages/next/docs/page-examples.md +++ b/packages/next/docs/page-examples.md @@ -1,16 +1,18 @@ ## Examples {% tabs %} -{% tab label="Create static page in an app" %} +{% tab label="Create a Static Page" %} + +Generate a static page named `MyPage` at `apps/my-app/pages/my-page/page.tsx`: ```shell nx g page apps/my-app/pages/my-page ``` {% /tab %} -{% tab label="Create dynamic page in an app" %} +{% tab label="Create a Dynamic Page" %} -The following creates a page under `apps/my-app/pages/products/[id].tsx`. +Generate a dynamic page at `apps/my-app/pages/products/[id]/page.tsx`: ```shell nx g page "apps/my-app/pages/products/[id]" diff --git a/packages/next/src/generators/component/schema.json b/packages/next/src/generators/component/schema.json index 62a70aedc1e3a..feed4a894384a 100644 --- a/packages/next/src/generators/component/schema.json +++ b/packages/next/src/generators/component/schema.json @@ -8,7 +8,7 @@ "properties": { "path": { "type": "string", - "description": "The file path to the component without the file extension (e.g. `my-app/components/my-component/my-component` generates the file `my-app/components/my-component/my-component.tsx`). Relative to the current working directory.", + "description": "The file path to the component without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 diff --git a/packages/nuxt/src/generators/storybook-configuration/configuration.spec.ts b/packages/nuxt/src/generators/storybook-configuration/configuration.spec.ts index 9c7d6e3505de2..ae9e94ff32fe5 100644 --- a/packages/nuxt/src/generators/storybook-configuration/configuration.spec.ts +++ b/packages/nuxt/src/generators/storybook-configuration/configuration.spec.ts @@ -93,7 +93,6 @@ export async function createTestApp( }); await componentGenerator(appTree, { - name: 'my-component', path: `${appName}/src/components/my-component`, }); diff --git a/packages/plugin/docs/generators/executor-examples.md b/packages/plugin/docs/generators/executor-examples.md index 95e88baa14485..a904ba6d86caf 100644 --- a/packages/plugin/docs/generators/executor-examples.md +++ b/packages/plugin/docs/generators/executor-examples.md @@ -3,16 +3,25 @@ {% tabs %} {% tab label="Basic executor" %} -Create a new executor called `build` inside the plugin `my-plugin`: +Create a new executor called `build` at `tools/my-plugin/src/executors/build.ts`: ```bash nx g @nx/plugin:executor tools/my-plugin/src/executors/build ``` +{% /tab %} +{% tab label="With different exported name" %} + +Create a new executor called `custom` at `tools/my-plugin/src/executors/build.ts`: + +```bash +nx g @nx/plugin:executor tools/my-plugin/src/executors/build --name=custom +``` + {% /tab %} {% tab label="With custom hashing" %} -Create a new executor called `build` inside the plugin `my-plugin`, that uses a custom hashing function: +Create a new executor called `build` at `tools/my-plugin/src/executors/build.ts`, that uses a custom hashing function: ```bash nx g @nx/plugin:executor tools/my-plugin/src/executors/build --includeHasher diff --git a/packages/plugin/src/generators/executor/schema.json b/packages/plugin/src/generators/executor/schema.json index fa3e65a86f8a1..2ee691e2bc859 100644 --- a/packages/plugin/src/generators/executor/schema.json +++ b/packages/plugin/src/generators/executor/schema.json @@ -6,16 +6,10 @@ "description": "Create an Executor for an Nx Plugin.", "examplesFile": "../../../docs/generators/executor-examples.md", "type": "object", - "examples": [ - { - "command": "nx g executor libs/my-plugin/src/executors/my-executor", - "description": "Generate `libs/my-plugin/src/executors/my-executor`" - } - ], "properties": { "path": { "type": "string", - "description": "The file path to the executor without the file extension (e.g. `my-plugin/src/executors/my-executor` generates the file `my-plugin/src/executors/my-executor.ts`). Relative to the current working directory.", + "description": "The file path to the executor without the file extension. Relative to the current working directory.", "x-prompt": "What is the executor file path?", "$default": { "$source": "argv", diff --git a/packages/plugin/src/generators/generator/schema.json b/packages/plugin/src/generators/generator/schema.json index d45c4abe6b8cd..206b0e0a1e1f0 100644 --- a/packages/plugin/src/generators/generator/schema.json +++ b/packages/plugin/src/generators/generator/schema.json @@ -7,14 +7,18 @@ "type": "object", "examples": [ { - "command": "nx g generator libs/my-plugin/src/generators/my-generator", - "description": "Generate `libs/my-plugin/src/generators/my-generator`" + "description": "Generate a generator exported with the name matching the file name. It results in the generator `foo` at `mylib/src/generators/foo.ts`", + "command": "nx g @nx/plugin:generator mylib/src/generators/foo" + }, + { + "description": "Generate a generator exported with a different name from the file name. It results in the generator `custom` at `mylib/src/generators/foo.ts`", + "command": "nx g @nx/plugin:generator mylib/src/generators/foo --name=custom" } ], "properties": { "path": { "type": "string", - "description": "The file path to the generator without the file extension (e.g. `my-plugin/src/generators/my-generator` generates the file `my-plugin/src/generators/my-generator.ts`). Relative to the current working directory.", + "description": "The file path to the generator without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 diff --git a/packages/plugin/src/generators/migration/schema.json b/packages/plugin/src/generators/migration/schema.json index 924cfd0596dfe..7c158677e7b3a 100644 --- a/packages/plugin/src/generators/migration/schema.json +++ b/packages/plugin/src/generators/migration/schema.json @@ -7,14 +7,18 @@ "type": "object", "examples": [ { - "command": "nx g migration my-plugin/my-migration --version=1.0.0", - "description": "Adds a new migration inside `my-plugin`, which will be triggered when migrating to version 1.0.0 or above from a previous version." + "description": "Generate a migration exported with the name matching the file name, which will be triggered when migrating to version 1.0.0 or above from a previous version. It results in the migration `foo` at `mylib/src/migrations/foo.ts`", + "command": "nx g @nx/plugin:migration mylib/src/migrations/foo -v=1.0.0" + }, + { + "description": "Generate a migration exported with a different name from the file name, which will be triggered when migrating to version 1.0.0 or above from a previous version. It results in the migration `custom` at `mylib/src/migrations/foo.ts`", + "command": "nx g @nx/plugin:migration mylib/src/migrations/foo --name=custom -v=1.0.0" } ], "properties": { "path": { "type": "string", - "description": "The file path to the migration without the file extension (e.g. `my-plugin/src/migrations/my-migration` generates the file `my-plugin/src/migrations/my-migration.ts`). Relative to the current working directory.", + "description": "The file path to the migration without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 diff --git a/packages/react-native/src/generators/component/schema.json b/packages/react-native/src/generators/component/schema.json index a0868c6e58db1..adde83800b39f 100644 --- a/packages/react-native/src/generators/component/schema.json +++ b/packages/react-native/src/generators/component/schema.json @@ -7,18 +7,22 @@ "type": "object", "examples": [ { - "command": "nx g @nx/react-native:component mylib/src/lib/my-component/my-component ", - "description": "Generate a component in the `mylib` library" + "description": "Generate a component with the exported symbol matching the file name. It results in the component `Foo` at `mylib/src/lib/foo.tsx`", + "command": "nx g @nx/react-native:component mylib/src/lib/foo" }, { - "command": "nx g @nx/react-native:component mylib/src/lib/my-component/my-component --classComponent", - "description": "Generate a class component in the `mylib` library" + "description": "Generate a component with the exported symbol different from the file name. It results in the component `Custom` at `mylib/src/lib/foo.tsx`", + "command": "nx g @nx/react-native:component mylib/src/lib/foo --name=custom" + }, + { + "description": "Generate a class component at `mylib/src/lib/foo.tsx`", + "command": "nx g @nx/react-native:component mylib/src/lib/foo --classComponent" } ], "properties": { "path": { "type": "string", - "description": "The file path to the component without the file extension (e.g. `my-app/src/app/my-component/my-component` generates the file `my-app/src/app/my-component/my-component.tsx`). Relative to the current working directory.", + "description": "The file path to the component without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 diff --git a/packages/react/docs/component-examples.md b/packages/react/docs/component-examples.md index a8839c24eba44..efbc7daea600c 100644 --- a/packages/react/docs/component-examples.md +++ b/packages/react/docs/component-examples.md @@ -3,7 +3,7 @@ {% tabs %} {% tab label="Simple Component" %} -Create a component named `my-component` under the `libs/ui` project: +Create a component named `MyComponent` at `libs/ui/src/my-component.tsx`: ```shell nx g @nx/react:component libs/ui/src/my-component @@ -11,9 +11,19 @@ nx g @nx/react:component libs/ui/src/my-component {% /tab %} -{% tab label="Standalone Component" %} +{% tab label="With a Different Symbol Name" %} -Create a class component named `my-component` under the `libs/ui` project: +Create a component named `Custom` at `libs/ui/src/my-component.tsx`: + +```shell +nx g @nx/react:component libs/ui/src/my-component --name=custom +``` + +{% /tab %} + +{% tab label="Class Component" %} + +Create a class component named `MyComponent` at `libs/ui/src/my-component.tsx`: ```shell nx g @nx/react:component libs/ui/src/my-component --classComponent diff --git a/packages/react/src/generators/component/schema.json b/packages/react/src/generators/component/schema.json index 266ee36574f77..e5af0634c2743 100644 --- a/packages/react/src/generators/component/schema.json +++ b/packages/react/src/generators/component/schema.json @@ -8,7 +8,7 @@ "properties": { "path": { "type": "string", - "description": "The file path to the component without the file extension (e.g. `my-app/src/app/my-component/my-component` generates the file `my-app/src/app/my-component/my-component.tsx`). Relative to the current working directory.", + "description": "The file path to the component without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 diff --git a/packages/react/src/generators/hook/schema.json b/packages/react/src/generators/hook/schema.json index b3f3f7fab5f54..88336f4273791 100644 --- a/packages/react/src/generators/hook/schema.json +++ b/packages/react/src/generators/hook/schema.json @@ -7,14 +7,18 @@ "type": "object", "examples": [ { - "command": "nx g hook mylib/my-hook", - "description": "Generate a hook `my-hook` in the `mylib` library" + "description": "Generate a hook with the exported symbol matching the file name. It results in the hook `useFoo` at `mylib/src/lib/foo.ts`", + "command": "nx g @nx/react:hook mylib/src/lib/foo" + }, + { + "description": "Generate a hook with the exported symbol different from the file name. It results in the hook `useCustom` at `mylib/src/lib/foo.ts`", + "command": "nx g @nx/react:hook mylib/src/lib/foo --name=useCustom" } ], "properties": { "path": { "type": "string", - "description": "The file path to the hook without the file extension (e.g. `my-app/src/app/my-hook/use-my-hook` generates the file `my-app/src/app/my-hook/use-my-hook.ts`). Relative to the current working directory.", + "description": "The file path to the hook without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 @@ -45,5 +49,5 @@ "x-prompt": "Should this hook be exported in the project?" } }, - "required": ["name"] + "required": ["path"] } diff --git a/packages/react/src/generators/redux/schema.json b/packages/react/src/generators/redux/schema.json index 5c86e23c1fcc7..034548d79004e 100644 --- a/packages/react/src/generators/redux/schema.json +++ b/packages/react/src/generators/redux/schema.json @@ -5,10 +5,20 @@ "title": "Create Redux state", "description": "Create a Redux state slice for a React project.", "type": "object", + "examples": [ + { + "description": "Generate a Redux state slice with the exported symbol matching the file name. It results in the slice `fooSlice` at `mylib/src/lib/foo.slice.ts`", + "command": "nx g @nx/react:redux mylib/src/lib/foo" + }, + { + "description": "Generate a Redux state slice with the exported symbol different from the file name. It results in the slice `customSlice` at `mylib/src/lib/foo.slice.ts`", + "command": "nx g @nx/react:redux mylib/src/lib/foo --name=custom" + } + ], "properties": { "path": { "type": "string", - "description": "The file path to the Redux state slice without the file extension (e.g. `my-app/src/app/my-slice/my-slice` generates the file `my-app/src/app/my-slice/my-slice.ts`). Relative to the current working directory.", + "description": "The file path to the Redux state slice without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 diff --git a/packages/vue/src/generators/component/component.spec.ts b/packages/vue/src/generators/component/component.spec.ts index 95717566c731c..e023e6f6e2250 100644 --- a/packages/vue/src/generators/component/component.spec.ts +++ b/packages/vue/src/generators/component/component.spec.ts @@ -24,7 +24,6 @@ describe('component', () => { it('should generate files with vitest', async () => { await componentGenerator(appTree, { - name: 'hello', path: `${libName}/src/lib/hello/hello`, }); @@ -58,7 +57,6 @@ describe('component', () => { it('should have correct component name based on directory', async () => { await componentGenerator(appTree, { - name: 'hello-world', path: `${libName}/src/foo/bar/hello-world/hello-world`, }); @@ -72,7 +70,6 @@ describe('component', () => { it('should generate files for an app', async () => { await componentGenerator(appTree, { - name: 'hello', path: `${appName}/src/app/hello/hello`, }); @@ -87,7 +84,6 @@ describe('component', () => { describe('--export', () => { it('should add to index.ts barrel', async () => { await componentGenerator(appTree, { - name: 'hello', path: `${libName}/src/lib/hello/hello`, export: true, }); @@ -100,7 +96,6 @@ describe('component', () => { it('should not export from an app', async () => { await componentGenerator(appTree, { - name: 'hello', path: `${appName}/src/app/hello/hello`, export: true, }); diff --git a/packages/vue/src/generators/component/lib/utils.ts b/packages/vue/src/generators/component/lib/utils.ts index 583ee57a12205..d2f458d0ae279 100644 --- a/packages/vue/src/generators/component/lib/utils.ts +++ b/packages/vue/src/generators/component/lib/utils.ts @@ -26,7 +26,6 @@ export async function normalizeOptions( directory, project: projectName, } = await determineArtifactNameAndDirectoryOptions(host, { - name: options.name, path: options.path, fileExtension: 'vue', }); diff --git a/packages/vue/src/generators/component/schema.d.ts b/packages/vue/src/generators/component/schema.d.ts index 7aab8ca539eab..d0dc390799618 100644 --- a/packages/vue/src/generators/component/schema.d.ts +++ b/packages/vue/src/generators/component/schema.d.ts @@ -1,6 +1,5 @@ export interface ComponentGeneratorSchema { path: string; - name?: string; skipTests?: boolean; export?: boolean; routing?: boolean; diff --git a/packages/vue/src/generators/component/schema.json b/packages/vue/src/generators/component/schema.json index aa5b375cfb04c..980176fce8071 100644 --- a/packages/vue/src/generators/component/schema.json +++ b/packages/vue/src/generators/component/schema.json @@ -7,24 +7,20 @@ "type": "object", "examples": [ { - "command": "nx g @nx/vue:component my-app/src/app/one --unitTestRunner=vitest", - "description": "Generate a component `one` in the `my-app` application at my-app/src/app/one" + "description": "Generate a component at `mylib/src/lib/foo.vue` with `vitest` as the unit test runner", + "command": "nx g @nx/vue:component mylib/src/lib/foo --unitTestRunner=vitest" } ], "properties": { "path": { "type": "string", - "description": "The file path to the component without the file extension (e.g. `my-app/src/app/my-component/my-component` generates the file `my-app/src/app/my-component/my-component.vue`). Relative to the current working directory.", + "description": "The file path to the component without the file extension. Relative to the current working directory.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What is the component file path?" }, - "name": { - "type": "string", - "description": "The component symbol name. Defaults to the last segment of the file path." - }, "js": { "type": "boolean", "description": "Generate JavaScript files rather than TypeScript files.", diff --git a/packages/vue/src/generators/storybook-configuration/configuration.spec.ts b/packages/vue/src/generators/storybook-configuration/configuration.spec.ts index 7866fccd315f0..afd7832e9efe5 100644 --- a/packages/vue/src/generators/storybook-configuration/configuration.spec.ts +++ b/packages/vue/src/generators/storybook-configuration/configuration.spec.ts @@ -168,7 +168,6 @@ export async function createTestAppLib( }); await componentGenerator(appTree, { - name: 'my-component', path: `${libName}/src/app/my-component/my-component`, });