Skip to content

Commit

Permalink
fix(misc): update artifact generator option descriptions and cleanup …
Browse files Browse the repository at this point in the history
…leftovers (#29077)

- Update artifact generator schemas:
- Clarify `path` is the artifact file path relative to the current
working directory
  - Clarify `name` is the artifact symbol name
- Remove prompt for `name` and remove it from the important options
(won't be displayed by default in Nx Console generation UI, it will be
part of the collapsed options) given that most of the time, it's meant
to match the filename (last segment of the `path`)
- Remove some leftover options related to the name and path formats that
were previously missed
- Fix an issue with NestJS generators
- Fix an issue with Next `page` generator

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
  • Loading branch information
leosvelperez authored Nov 28, 2024
1 parent c66b99c commit dc67660
Show file tree
Hide file tree
Showing 173 changed files with 937 additions and 1,425 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
},
"additionalProperties": false,
"required": ["directory"],
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Application\" %}\n\nCreate an application named `my-app`:\n\n```bash\nnx g @nx/angular:application apps/my-app\n```\n\n{% /tab %}\n\n{% tab label=\"Specify directory and style extension\" %}\n\nCreate an application named `my-app` in the `my-dir` directory and use `scss` for styles:\n\n{% callout type=\"note\" title=\"Directory Flag Behavior Changes\" %}\nThe command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=my-dir`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.\n{% /callout %}\n\n```bash\nnx g @nx/angular:app my-dir/my-app --style=scss\n```\n\n{% /tab %}\n\n{% tab label=\"Single File Components application\" %}\n\nCreate an application with Single File Components (inline styles and inline templates):\n\n```bash\nnx g @nx/angular:app apps/my-app --inlineStyle --inlineTemplate\n```\n\n{% /tab %}\n\n{% tab label=\"Set custom prefix and tags\" %}\n\nSet the prefix to apply to generated selectors and add tags to the application (used for linting).\n\n```bash\nnx g @nx/angular:app apps/my-app --prefix=admin --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n",
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Application\" %}\n\nCreate an application named `my-app`:\n\n```bash\nnx g @nx/angular:application apps/my-app\n```\n\n{% /tab %}\n\n{% tab label=\"Specify style extension\" %}\n\nCreate an application named `my-app` in the `my-dir` directory and use `scss` for styles:\n\n```bash\nnx g @nx/angular:app my-dir/my-app --style=scss\n```\n\n{% /tab %}\n\n{% tab label=\"Single File Components application\" %}\n\nCreate an application with Single File Components (inline styles and inline templates):\n\n```bash\nnx g @nx/angular:app apps/my-app --inlineStyle --inlineTemplate\n```\n\n{% /tab %}\n\n{% tab label=\"Set custom prefix and tags\" %}\n\nSet the prefix to apply to generated selectors and add tags to the application (used for linting).\n\n```bash\nnx g @nx/angular:app apps/my-app --prefix=admin --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n",
"presets": []
},
"aliases": ["app"],
Expand Down
9 changes: 4 additions & 5 deletions docs/generated/packages/angular/generators/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
"properties": {
"path": {
"type": "string",
"description": "The path at which to create the component file, relative to the workspace root. By default, it is set to the root of the project.",
"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": "Where to create the component?"
"x-prompt": "What is the component file path?"
},
"name": {
"type": "string",
"description": "The name of the component.",
"x-prompt": "What name would you like to use for the component?"
"description": "The component symbol name. Defaults to the last segment of the file path."
},
"prefix": {
"type": "string",
Expand Down Expand Up @@ -113,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"],
Expand Down
19 changes: 14 additions & 5 deletions docs/generated/packages/angular/generators/directive.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,26 @@
"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 path at which to create the directive file.",
"x-prompt": "Where to put the directive?",
"$default": { "$source": "argv", "index": 0 }
"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?"
},
"name": {
"type": "string",
"description": "The name of the new directive.",
"x-prompt": "What name would you like to use for the directive?"
"description": "The directive symbol name. Defaults to the last segment of the file path."
},
"prefix": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/packages/angular/generators/library.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
},
"additionalProperties": false,
"required": ["directory"],
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Library\" %}\n\nCreates the `my-ui-lib` library with an `ui` tag:\n\n```bash\nnx g @nx/angular:library libs/my-ui-lib --tags=ui\n```\n\n{% /tab %}\n\n{% tab label=\"Publishable Library\" %}\n\nCreates the `my-lib` library that can be built producing an output following the Angular Package Format (APF) to be distributed as an NPM package:\n\n```bash\nnx g @nx/angular:library libs/my-lib --publishable --import-path=@my-org/my-lib\n```\n\n{% /tab %}\n\n{% tab label=\"Buildable Library\" %}\n\nCreates the `my-lib` library with support for incremental builds:\n\n```bash\nnx g @nx/angular:library libs/my-lib --buildable\n```\n\n{% /tab %}\n\n{% tab label=\"Nested Folder & Import\"%}\nCreates the `my-lib` library in the `nested` directory and sets the import path to `@myorg/nested/my-lib`:\n\n{% callout type=\"note\" title=\"Directory Flag Behavior Changes\" %}\nThe command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=nested`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.\n{% /callout %}\n\n```bash\nnx g @nx/angular:library libs/nested/my-lib --importPath=@myorg/nested/my-lib\n```\n\n{% /tab %}\n",
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Library\" %}\n\nCreates the `my-ui-lib` library with an `ui` tag:\n\n```bash\nnx g @nx/angular:library libs/my-ui-lib --tags=ui\n```\n\n{% /tab %}\n\n{% tab label=\"Publishable Library\" %}\n\nCreates the `my-lib` library that can be built producing an output following the Angular Package Format (APF) to be distributed as an NPM package:\n\n```bash\nnx g @nx/angular:library libs/my-lib --publishable --import-path=@my-org/my-lib\n```\n\n{% /tab %}\n\n{% tab label=\"Buildable Library\" %}\n\nCreates the `my-lib` library with support for incremental builds:\n\n```bash\nnx g @nx/angular:library libs/my-lib --buildable\n```\n\n{% /tab %}\n\n{% tab label=\"Nested Folder & Import\"%}\nCreates the `my-lib` library in the `nested` directory and sets the import path to `@myorg/nested/my-lib`:\n\n```bash\nnx g @nx/angular:library libs/nested/my-lib --importPath=@myorg/nested/my-lib\n```\n\n{% /tab %}\n",
"presets": []
},
"aliases": ["lib"],
Expand Down
17 changes: 13 additions & 4 deletions docs/generated/packages/angular/generators/pipe.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,26 @@
"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 path at which to create the pipe file, relative to the workspace root.",
"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 path of the new pipe?"
"x-prompt": "What is the pipe file path?"
},
"name": {
"type": "string",
"description": "The name of the pipe.",
"x-prompt": "What name would you like to use for the pipe?"
"description": "The pipe symbol name. Defaults to the last segment of the file path."
},
"skipTests": {
"type": "boolean",
Expand Down
40 changes: 9 additions & 31 deletions docs/generated/packages/angular/generators/scam-directive.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,26 @@
"type": "object",
"examples": [
{
"command": "nx g @nx/angular:scam-directive my-sample --directory=my-lib/src/lib/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.",
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
"description": "The path at which to create the SCAM Directive files, relative to the workspace root.",
"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 path of the new directive?"
"x-prompt": "What is the SCAM directive file path?"
},
"name": {
"type": "string",
"description": "The name of the directive.",
"x-prompt": "What name would you like to use for the directive?",
"x-priority": "important"
},
"directory": {
"type": "string",
"description": "The directory at which to create the SCAM Directive files. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the workspace root.",
"aliases": ["dir", "path"],
"x-priority": "important"
},
"nameAndDirectoryFormat": {
"description": "Whether to generate the component in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
},
"project": {
"type": "string",
"description": "The name of the project.",
"$default": { "$source": "projectName" },
"x-dropdown": "projects",
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v20."
"description": "The directive symbol name. Defaults to the last segment of the file path."
},
"skipTests": {
"type": "boolean",
Expand All @@ -57,12 +41,6 @@
"default": true,
"x-priority": "important"
},
"flat": {
"type": "boolean",
"description": "Create the new files at the top level of the current project.",
"default": true,
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20."
},
"selector": {
"type": "string",
"format": "html-selector",
Expand Down
22 changes: 9 additions & 13 deletions docs/generated/packages/angular/generators/scam-pipe.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,26 @@
"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.",
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
"description": "The path at which to create the pipe file, relative to the workspace root.",
"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 path of the new pipe?"
"x-prompt": "What is the SCAM pipe file path?"
},
"name": {
"type": "string",
"description": "The name of the pipe.",
"x-prompt": "What name would you like to use for the pipe?",
"x-priority": "important"
"description": "The pipe symbol name. Defaults to the last segment of the file path."
},
"skipTests": {
"type": "boolean",
Expand All @@ -39,12 +41,6 @@
"default": true,
"x-priority": "important"
},
"flat": {
"type": "boolean",
"description": "Create the new files at the top level of the current project.",
"default": true,
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20."
},
"export": {
"type": "boolean",
"description": "Specifies if the SCAM should be exported from the project's entry point (normally `index.ts`). It only applies to libraries.",
Expand Down
15 changes: 9 additions & 6 deletions docs/generated/packages/angular/generators/scam.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,26 @@
"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.",
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
"description": "The path at which to create the SCAM file, relative to the workspace root.",
"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 path of the new SCAM?"
"x-prompt": "What is the SCAM file path?"
},
"name": {
"type": "string",
"description": "The name of the component.",
"x-prompt": "What name would you like to use for the component?"
"description": "The component symbol name. Defaults to the last segment of the file path."
},
"displayBlock": {
"description": "Specifies if the style will contain `:host { display: block; }`.",
Expand Down
4 changes: 0 additions & 4 deletions docs/generated/packages/esbuild/documents/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ npm add -D @nx/esbuild

### Creating a new JS library

{% callout type="note" title="Directory Flag Behavior Changes" %}
The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.
{% /callout %}

You can add a new library that builds using esbuild with:

```shell
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/packages/expo/generators/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
],
Expand Down
Loading

0 comments on commit dc67660

Please sign in to comment.