fix(misc): update artifact generator option descriptions and cleanup 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 #
This commit is contained in:
parent
c66b99c499
commit
dc67660fec
@ -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"],
|
||||
|
||||
@ -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",
|
||||
@ -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"],
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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"],
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -9,8 +9,12 @@
|
||||
"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.",
|
||||
@ -18,33 +22,13 @@
|
||||
"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",
|
||||
@ -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",
|
||||
|
||||
@ -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,15 +22,13 @@
|
||||
"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",
|
||||
@ -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.",
|
||||
|
||||
@ -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,14 +22,13 @@
|
||||
"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; }`.",
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
}
|
||||
],
|
||||
|
||||
@ -9,26 +9,28 @@
|
||||
"type": "object",
|
||||
"examples": [
|
||||
{
|
||||
"command": "g @nx/expo:component mylib/my-component --name 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 --name 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": "Path where the component will be generated.",
|
||||
"description": "The file path to the component without the file extension. Relative to the current working directory.",
|
||||
"$default": { "$source": "argv", "index": 0 },
|
||||
"x-prompt": "Where should the component be generated?",
|
||||
"x-priority": "important"
|
||||
"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."
|
||||
},
|
||||
"js": {
|
||||
"type": "boolean",
|
||||
|
||||
@ -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"
|
||||
}
|
||||
],
|
||||
|
||||
@ -138,7 +138,7 @@
|
||||
}
|
||||
},
|
||||
"required": ["directory"],
|
||||
"examplesFile": "---\ntitle: JS library generator examples\ndescription: This page contains examples for the @nx/js:lib generator.\n---\n\nThe `@nx/js:lib` generator will generate a library for you, and it will configure it according to the options you provide.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib\n```\n\nBy default, the library that is generated when you use this executor without passing any options, like the example above, will be a buildable library, using the `@nx/js:tsc` executor as a builder.\n\nYou may configure the tools you want to use to build your library, or bundle it too, by passing the `--bundler` flag. The `--bundler` flag controls the compiler and/or the bundler that will be used to build your library. If you choose `tsc` or `swc`, the result will be a buildable library using either `tsc` or `swc` as the compiler. If you choose `rollup` or `vite`, the result will be a buildable library using `rollup` or `vite` as the bundler. In the case of `rollup`, it will default to the `tsc` compiler. If you choose `esbuild`, you may use the [`esbuildOptions` property](https://esbuild.github.io/api/) in your `project.json` under the `build` target options to specify whether you wish to bundle your library or not.\n\n## Examples\n\n{% tabs %}\n\n{% tab label=\"Buildable with default compiler (tsc)\" %}\n\nGenerate a buildable library using the `@nx/js:tsc` executor. This uses `tsc` as the compiler.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib\n```\n\n{% /tab %}\n\n{% tab label=\"Buildable with SWC compiler\" %}\n\nGenerate a buildable library using [SWC](https://swc.rs) as the compiler. This will use the `@nx/js:swc` executor.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=swc\n```\n\n{% /tab %}\n\n{% tab label=\"Buildable with tsc\" %}\n\nGenerate a buildable library using tsc as the compiler. This will use the `@nx/js:tsc` executor.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=tsc\n```\n\n{% /tab %}\n\n{% tab label=\"Buildable, with Rollup as a bundler\" %}\n\nGenerate a buildable library using [Rollup](https://rollupjs.org) as the bundler. This will use the `@nx/rollup:rollup` executor. It will also use [SWC](https://swc.rs) as the compiler.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=rollup\n```\n\nIf you do not want to use `swc` as the compiler, and want to use the default `babel` compiler, you can do so in your `project.json` under the `build` target options, using the [`compiler` property](/nx-api/rollup/executors/rollup#compiler):\n\n```jsonc {% fileName=\"libs/mylib/project.json\" %}\n\"build\": {\n \"executor\": \"@nx/rollup:rollup\",\n \"options\": {\n //...\n \"compiler\": \"babel\"\n }\n}\n```\n\n{% /tab %}\n\n{% tab label=\"Buildable, with Vite as a bundler\" %}\n\nGenerate a buildable library using [Vite](https://vitejs.dev/) as the bundler. This will use the `@nx/vite:build` executor.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=vite\n```\n\n{% /tab %}\n\n{% tab label=\"Using ESBuild\" %}\n\nGenerate a buildable library using [ESBuild](https://esbuild.github.io/) as the bundler. This will use the `@nx/esbuild:esbuild` executor.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=esbuild\n```\n\nIf you want to specify whether you want to bundle your library or not, you can do so in your `project.json` under the `build` target options, using the [`esbuildOptions` property](https://esbuild.github.io/api/):\n\n```jsonc {% fileName=\"libs/mylib/project.json\" %}\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n //...\n \"esbuildOptions\": {\n \"bundle\": true\n }\n }\n}\n```\n\n{% /tab %}\n\n{% tab label=\"Minimal publishing target\" %}\n\nGenerate a **publishable** library with a minimal publishing target. The result will be a buildable library using the `@nx/js:tsc` executor, using `tsc` as the compiler. You can change the compiler or the bundler by passing the `--bundler` flag.\n\n```bash\nnpx nx g lib libs/mylib --publishable\n```\n\n{% /tab %}\n\n{% tab label=\"Using directory flag\" %}\n\nGenerate a library named `mylib` and put it under a directory named `myapp` (`libs/myapp/mylib`)\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=myapp`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.\n{% /callout %}\n\n```shell\nnpx nx g lib libs/nested/mylib\n```\n\n{% /tab %}\n\n{% tab label=\"Non-buildable library\" %}\n\nGenerate a non-buildable library.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=none\n```\n\n{% /tab %}\n\n{% /tabs %}\n",
|
||||
"examplesFile": "---\ntitle: JS library generator examples\ndescription: This page contains examples for the @nx/js:lib generator.\n---\n\nThe `@nx/js:lib` generator will generate a library for you, and it will configure it according to the options you provide.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib\n```\n\nBy default, the library that is generated when you use this executor without passing any options, like the example above, will be a buildable library, using the `@nx/js:tsc` executor as a builder.\n\nYou may configure the tools you want to use to build your library, or bundle it too, by passing the `--bundler` flag. The `--bundler` flag controls the compiler and/or the bundler that will be used to build your library. If you choose `tsc` or `swc`, the result will be a buildable library using either `tsc` or `swc` as the compiler. If you choose `rollup` or `vite`, the result will be a buildable library using `rollup` or `vite` as the bundler. In the case of `rollup`, it will default to the `tsc` compiler. If you choose `esbuild`, you may use the [`esbuildOptions` property](https://esbuild.github.io/api/) in your `project.json` under the `build` target options to specify whether you wish to bundle your library or not.\n\n## Examples\n\n{% tabs %}\n\n{% tab label=\"Buildable with default compiler (tsc)\" %}\n\nGenerate a buildable library using the `@nx/js:tsc` executor. This uses `tsc` as the compiler.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib\n```\n\n{% /tab %}\n\n{% tab label=\"Buildable with SWC compiler\" %}\n\nGenerate a buildable library using [SWC](https://swc.rs) as the compiler. This will use the `@nx/js:swc` executor.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=swc\n```\n\n{% /tab %}\n\n{% tab label=\"Buildable with tsc\" %}\n\nGenerate a buildable library using tsc as the compiler. This will use the `@nx/js:tsc` executor.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=tsc\n```\n\n{% /tab %}\n\n{% tab label=\"Buildable, with Rollup as a bundler\" %}\n\nGenerate a buildable library using [Rollup](https://rollupjs.org) as the bundler. This will use the `@nx/rollup:rollup` executor. It will also use [SWC](https://swc.rs) as the compiler.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=rollup\n```\n\nIf you do not want to use `swc` as the compiler, and want to use the default `babel` compiler, you can do so in your `project.json` under the `build` target options, using the [`compiler` property](/nx-api/rollup/executors/rollup#compiler):\n\n```jsonc {% fileName=\"libs/mylib/project.json\" %}\n\"build\": {\n \"executor\": \"@nx/rollup:rollup\",\n \"options\": {\n //...\n \"compiler\": \"babel\"\n }\n}\n```\n\n{% /tab %}\n\n{% tab label=\"Buildable, with Vite as a bundler\" %}\n\nGenerate a buildable library using [Vite](https://vitejs.dev/) as the bundler. This will use the `@nx/vite:build` executor.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=vite\n```\n\n{% /tab %}\n\n{% tab label=\"Using ESBuild\" %}\n\nGenerate a buildable library using [ESBuild](https://esbuild.github.io/) as the bundler. This will use the `@nx/esbuild:esbuild` executor.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=esbuild\n```\n\nIf you want to specify whether you want to bundle your library or not, you can do so in your `project.json` under the `build` target options, using the [`esbuildOptions` property](https://esbuild.github.io/api/):\n\n```jsonc {% fileName=\"libs/mylib/project.json\" %}\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n //...\n \"esbuildOptions\": {\n \"bundle\": true\n }\n }\n}\n```\n\n{% /tab %}\n\n{% tab label=\"Minimal publishing target\" %}\n\nGenerate a **publishable** library with a minimal publishing target. The result will be a buildable library using the `@nx/js:tsc` executor, using `tsc` as the compiler. You can change the compiler or the bundler by passing the `--bundler` flag.\n\n```bash\nnpx nx g lib libs/mylib --publishable\n```\n\n{% /tab %}\n\n{% tab label=\"In a nested directory\" %}\n\nGenerate a library named `mylib` and put it under a directory named `nested` (`libs/nested/mylib`).\n\n```shell\nnpx nx g lib libs/nested/mylib\n```\n\n{% /tab %}\n\n{% tab label=\"Non-buildable library\" %}\n\nGenerate a non-buildable library.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=none\n```\n\n{% /tab %}\n\n{% /tabs %}\n",
|
||||
"presets": []
|
||||
},
|
||||
"aliases": ["lib"],
|
||||
|
||||
@ -8,17 +8,18 @@
|
||||
"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": "Path where the class will be generated.",
|
||||
"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": "Where should the class be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the class.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the class file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
@ -32,12 +33,6 @@
|
||||
"enum": ["jest", "none"],
|
||||
"default": "jest"
|
||||
},
|
||||
"flat": {
|
||||
"description": "Flag to indicate if a directory is created.",
|
||||
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20.",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"language": {
|
||||
"description": "Nest class language.",
|
||||
"type": "string",
|
||||
|
||||
@ -8,17 +8,18 @@
|
||||
"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": "Path where the controller will be generated.",
|
||||
"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": "Where should the controller be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the controller.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the controller file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
|
||||
@ -8,17 +8,18 @@
|
||||
"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": "Path where the decorator will be generated.",
|
||||
"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": "Where should the decorator be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the decorator.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the decorator file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
|
||||
@ -8,17 +8,18 @@
|
||||
"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": "Path where the filter will be generated.",
|
||||
"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": "Where should the filter be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the filter.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the filter file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"type": "boolean",
|
||||
|
||||
@ -8,17 +8,18 @@
|
||||
"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": "Path where the gateway will be generated.",
|
||||
"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": "Where should the gateway be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the gateway.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the gateway file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
|
||||
@ -8,17 +8,18 @@
|
||||
"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": "Path where the guard will be generated.",
|
||||
"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": "Where should the guard be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the guard.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the guard file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
|
||||
@ -8,17 +8,18 @@
|
||||
"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": "Path where the interceptor will be generated.",
|
||||
"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": "Where should the interceptor be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the interceptor.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the interceptor file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
|
||||
@ -8,29 +8,24 @@
|
||||
"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": "Path where the interface will be generated.",
|
||||
"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": "Where should the interface be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the interface.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the interface file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"x-priority": "internal"
|
||||
},
|
||||
"flat": {
|
||||
"description": "Flag to indicate if a directory is created.",
|
||||
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20.",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
|
||||
@ -8,17 +8,18 @@
|
||||
"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": "Path where the middleware will be generated.",
|
||||
"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": "Where should the middleware be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the middleware.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the middleware file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
|
||||
@ -8,17 +8,18 @@
|
||||
"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": "Path where the module will be generated.",
|
||||
"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": "Where should the module be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the module.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the module file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
|
||||
@ -8,17 +8,18 @@
|
||||
"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": "Path where the pipe will be generated.",
|
||||
"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": "Where should the pipe be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the pipe.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the pipe file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
|
||||
@ -8,17 +8,18 @@
|
||||
"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": "Path where the provider will be generated.",
|
||||
"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": "Where should the provider be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the provider.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the provider file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
|
||||
@ -8,17 +8,18 @@
|
||||
"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": "Path where the resolver will be generated.",
|
||||
"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": "Where should the resolver be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the resolver.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the resolver file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
|
||||
@ -8,17 +8,18 @@
|
||||
"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": "Path where the resource will be generated.",
|
||||
"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": "Where should the resource be generated?"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "The name of the resource.",
|
||||
"x-prompt": "What name would you like to use for this resource (plural, e.g., `users`)?"
|
||||
"x-prompt": "What is the resource file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
|
||||
@ -8,17 +8,18 @@
|
||||
"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": "Path where the service will be generated.",
|
||||
"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": "Where should the service be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the service.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the service file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
|
||||
@ -137,7 +137,7 @@
|
||||
}
|
||||
},
|
||||
"required": ["directory"],
|
||||
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Create app in a directory\" %}\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```shell\nnx g app apps/nested/myapp\n```\n\n{% /tab %}\n{% tab label=\"Use a custom Express server\" %}\n\n```shell\nnx g app apps/myapp --custom-server\n```\n\n{% /tab %}\n{% tab label=\"Use plain JavaScript (not TypeScript)\" %}\n\n```shell\nnx g app apps/myapp --js\n```\n\n{% /tab %}\n{% /tabs %}\n",
|
||||
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Create app in a nested directory\" %}\n\n```shell\nnx g app apps/nested/myapp\n```\n\n{% /tab %}\n{% tab label=\"Use a custom Express server\" %}\n\n```shell\nnx g app apps/myapp --custom-server\n```\n\n{% /tab %}\n{% tab label=\"Use plain JavaScript (not TypeScript)\" %}\n\n```shell\nnx g app apps/myapp --js\n```\n\n{% /tab %}\n{% /tabs %}\n",
|
||||
"presets": []
|
||||
},
|
||||
"aliases": ["app"],
|
||||
|
||||
@ -11,16 +11,14 @@
|
||||
"properties": {
|
||||
"path": {
|
||||
"type": "string",
|
||||
"description": "Path where the component will be generated.",
|
||||
"description": "The file path to the component without the file extension. Relative to the current working directory.",
|
||||
"$default": { "$source": "argv", "index": 0 },
|
||||
"x-prompt": "Where should the component be generated?",
|
||||
"x-prompt": "What is the component file path?",
|
||||
"x-priority": "important"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "The name of the component.",
|
||||
"x-prompt": "What name would you like to use for the component?",
|
||||
"x-priority": "important"
|
||||
"description": "The component symbol name. Defaults to the last segment of the file path."
|
||||
},
|
||||
"style": {
|
||||
"description": "The file extension to be used for style files.",
|
||||
@ -81,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.",
|
||||
|
||||
@ -11,16 +11,14 @@
|
||||
"properties": {
|
||||
"path": {
|
||||
"type": "string",
|
||||
"description": "Path where the page will be generated.",
|
||||
"description": "The path to the directory where the page will be generated. Relative to the current working directory.",
|
||||
"$default": { "$source": "argv", "index": 0 },
|
||||
"x-prompt": "Where should the page be generated?",
|
||||
"x-prompt": "Which directory do you want to create the page in?",
|
||||
"x-priority": "important"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "The name of the page.",
|
||||
"x-prompt": "What name would you like to use for the page?",
|
||||
"x-priority": "important"
|
||||
"description": "The page symbol name. Defaults to the page directory name."
|
||||
},
|
||||
"style": {
|
||||
"description": "The file extension to be used for style files.",
|
||||
@ -73,12 +71,6 @@
|
||||
"description": "Generate JavaScript files rather than TypeScript files.",
|
||||
"default": false
|
||||
},
|
||||
"flat": {
|
||||
"type": "boolean",
|
||||
"description": "Create component at the source root rather than its own directory.",
|
||||
"default": false,
|
||||
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20."
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
"type": "boolean",
|
||||
@ -87,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.",
|
||||
|
||||
@ -100,7 +100,7 @@
|
||||
}
|
||||
},
|
||||
"required": ["directory"],
|
||||
"examplesFile": "---\ntitle: Nuxt application generator examples\ndescription: This page contains examples for the @nx/nuxt:app generator.\n---\n\nYour new Nuxt application will be generated with the following directory structure, following the suggested [directory structure](https://nuxt.com/docs/guide/directory-structure) for Nuxt applications:\n\n```text\nmy-nuxt-app\n├── nuxt.config.ts\n├── project.json\n├── src\n│ ├── app.vue\n│ ├── assets\n│ │ └── css\n│ │ └── styles.css\n│ ├── components\n│ │ └── NxWelcome.vue\n│ ├── pages\n│ │ ├── about.vue\n│ │ └── index.vue\n│ ├── public\n│ │ └── favicon.ico\n│ └── server\n│ ├── api\n│ │ └── greet.ts\n│ └── tsconfig.json\n├── tsconfig.app.json\n├── tsconfig.json\n├── tsconfig.spec.json\n└── vitest.config.ts\n```\n\nYour new app will contain the following:\n\n- Two pages (home and about) under `pages`\n- A component (`NxWelcome`) under `components`\n- A `greet` API endpoint that returns a JSON response under `/api/greet`\n- Configuration for `vitest`\n- Your app's entrypoint (`app.vue`) will contain the navigation links to the home and about pages, and the `nuxt-page` component to display the contents of your pages.\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Create app in a directory\" %}\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```shell\nnx g @nx/nuxt:app =apps/nested/myapp\n```\n\n{% /tab %}\n\n{% tab label=\"Create app with vitest configured\" %}\n\n```shell\nnx g @nx/nuxt:app apps/nested/myapp --unitTestRunner=vitest\n```\n\n{% /tab %}\n\n{% tab label=\"Use plain JavaScript (not TypeScript)\" %}\n\n```shell\nnx g @nx/nuxt:app apps/myapp --js\n```\n\n{% /tab %}\n{% /tabs %}\n\n## Generate pages and components\n\nYou can use the the [`@nx/vue:component` generator](/nx-api/vue/generators/component) to generate new pages and components for your application. You can read more on the [`@nx/vue:component` generator documentation page](/nx-api/vue/generators/component), but here are some examples:\n\n{% tabs %}\n{% tab label=\"New page\" %}\n\n```shell\nnx g @nx/nuxt:component my-app/src/pages/my-page\n```\n\n{% /tab %}\n\n{% tab label=\"New component\" %}\n\n```shell\nnx g @nx/nuxt:component my-app/src/components/my-cmp\n```\n\n{% /tab %}\n{% /tabs %}\n",
|
||||
"examplesFile": "---\ntitle: Nuxt application generator examples\ndescription: This page contains examples for the @nx/nuxt:app generator.\n---\n\nYour new Nuxt application will be generated with the following directory structure, following the suggested [directory structure](https://nuxt.com/docs/guide/directory-structure) for Nuxt applications:\n\n```text\nmy-nuxt-app\n├── nuxt.config.ts\n├── project.json\n├── src\n│ ├── app.vue\n│ ├── assets\n│ │ └── css\n│ │ └── styles.css\n│ ├── components\n│ │ └── NxWelcome.vue\n│ ├── pages\n│ │ ├── about.vue\n│ │ └── index.vue\n│ ├── public\n│ │ └── favicon.ico\n│ └── server\n│ ├── api\n│ │ └── greet.ts\n│ └── tsconfig.json\n├── tsconfig.app.json\n├── tsconfig.json\n├── tsconfig.spec.json\n└── vitest.config.ts\n```\n\nYour new app will contain the following:\n\n- Two pages (home and about) under `pages`\n- A component (`NxWelcome`) under `components`\n- A `greet` API endpoint that returns a JSON response under `/api/greet`\n- Configuration for `vitest`\n- Your app's entrypoint (`app.vue`) will contain the navigation links to the home and about pages, and the `nuxt-page` component to display the contents of your pages.\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Create app in a nested directory\" %}\n\n```shell\nnx g @nx/nuxt:app apps/nested/myapp\n```\n\n{% /tab %}\n\n{% tab label=\"Create app with vitest configured\" %}\n\n```shell\nnx g @nx/nuxt:app apps/nested/myapp --unitTestRunner=vitest\n```\n\n{% /tab %}\n\n{% tab label=\"Use plain JavaScript (not TypeScript)\" %}\n\n```shell\nnx g @nx/nuxt:app apps/myapp --js\n```\n\n{% /tab %}\n{% /tabs %}\n\n## Generate pages and components\n\nYou can use the the [`@nx/vue:component` generator](/nx-api/vue/generators/component) to generate new pages and components for your application. You can read more on the [`@nx/vue:component` generator documentation page](/nx-api/vue/generators/component), but here are some examples:\n\n{% tabs %}\n{% tab label=\"New page\" %}\n\n```shell\nnx g @nx/nuxt:component my-app/src/pages/my-page\n```\n\n{% /tab %}\n\n{% tab label=\"New component\" %}\n\n```shell\nnx g @nx/nuxt:component my-app/src/components/my-cmp\n```\n\n{% /tab %}\n{% /tabs %}\n",
|
||||
"presets": []
|
||||
},
|
||||
"aliases": ["app"],
|
||||
|
||||
@ -7,27 +7,19 @@
|
||||
"$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 my-executor --project=my-plugin",
|
||||
"description": "Generate `libs/my-plugin/src/executors/my-executor`"
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"path": {
|
||||
"type": "string",
|
||||
"description": "Path at which to generate the executor file.",
|
||||
"x-prompt": "What path would you like to use for the executor?",
|
||||
"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"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Executor name.",
|
||||
"x-prompt": "What name would you like to use for the executor?",
|
||||
"x-priority": "important"
|
||||
"description": "The executor name to export in the plugin executors collection."
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
|
||||
@ -10,23 +10,25 @@
|
||||
"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": "Path where the generator will be generated.",
|
||||
"description": "The file path to the generator without the file extension. Relative to the current working directory.",
|
||||
"$default": { "$source": "argv", "index": 0 },
|
||||
"x-prompt": "Where should the generator be generated?",
|
||||
"x-prompt": "What is the generator file path?",
|
||||
"x-priority": "important"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Generator name.",
|
||||
"x-prompt": "What name would you like to use for the generator?",
|
||||
"x-priority": "important"
|
||||
"description": "The generator name to export in the plugin generators collection."
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
|
||||
@ -10,22 +10,25 @@
|
||||
"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": "Path where the migration will be generated.",
|
||||
"description": "The file path to the migration without the file extension. Relative to the current working directory.",
|
||||
"$default": { "$source": "argv", "index": 0 },
|
||||
"x-prompt": "Where should the migration be generated?",
|
||||
"x-prompt": "What is the migration file path?",
|
||||
"x-priority": "important"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Migration name.",
|
||||
"x-priority": "important"
|
||||
"description": "The migration name to export in the plugin migrations collection."
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
|
||||
@ -10,25 +10,28 @@
|
||||
"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 path at which to create the component file.",
|
||||
"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 path would you like to use for 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."
|
||||
},
|
||||
"js": {
|
||||
"type": "boolean",
|
||||
|
||||
@ -180,7 +180,7 @@
|
||||
}
|
||||
},
|
||||
"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/react:application apps/my-app\n```\n\n{% /tab %}\n\n{% tab label=\"Application using Vite as bundler\" %}\n\nCreate an application named `my-app`:\n\n```bash\nnx g @nx/react:app apps/my-app --bundler=vite\n```\n\nWhen choosing `vite` as the bundler, your unit tests will be set up with `vitest`, unless you choose `none` for `unitTestRunner`.\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/react:app apps/my-dir/my-app --style=scss\n```\n\n{% /tab %}\n\n{% tab label=\"Add tags\" %}\n\nAdd tags to the application (used for linting).\n\n```bash\nnx g @nx/react:app apps/my-app --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/react:application apps/my-app\n```\n\n{% /tab %}\n\n{% tab label=\"Application using Vite as bundler\" %}\n\nCreate an application named `my-app`:\n\n```bash\nnx g @nx/react:app apps/my-app --bundler=vite\n```\n\nWhen choosing `vite` as the bundler, your unit tests will be set up with `vitest`, unless you choose `none` for `unitTestRunner`.\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/react:app apps/my-dir/my-app --style=scss\n```\n\n{% /tab %}\n\n{% tab label=\"Add tags\" %}\n\nAdd tags to the application (used for linting).\n\n```bash\nnx g @nx/react:app apps/my-app --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n",
|
||||
"presets": []
|
||||
},
|
||||
"aliases": ["app"],
|
||||
|
||||
@ -11,16 +11,14 @@
|
||||
"properties": {
|
||||
"path": {
|
||||
"type": "string",
|
||||
"description": "Path where the component will be generated.",
|
||||
"description": "The file path to the component without the file extension. Relative to the current working directory.",
|
||||
"$default": { "$source": "argv", "index": 0 },
|
||||
"x-prompt": "Where should the component be generated?",
|
||||
"x-prompt": "What is the component file path?",
|
||||
"x-priority": "important"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "The name of the component.",
|
||||
"x-prompt": "What name would you like to use for the component?",
|
||||
"x-priority": "important"
|
||||
"description": "The component symbol name. Defaults to the last segment of the file path."
|
||||
},
|
||||
"style": {
|
||||
"description": "The file extension to be used for style files.",
|
||||
@ -106,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.",
|
||||
|
||||
@ -10,23 +10,25 @@
|
||||
"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": "Path where the hook will be generated.",
|
||||
"description": "The file path to the hook without the file extension. Relative to the current working directory.",
|
||||
"$default": { "$source": "argv", "index": 0 },
|
||||
"x-prompt": "Where should the hook be generated?",
|
||||
"x-prompt": "What is the hook file path?",
|
||||
"x-priority": "important"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "The name of the hook.",
|
||||
"x-prompt": "What name would you like to use for the hook?",
|
||||
"x-priority": "important"
|
||||
"description": "The hook symbol name. Defaults to the last segment of the file path."
|
||||
},
|
||||
"js": {
|
||||
"type": "boolean",
|
||||
@ -39,16 +41,6 @@
|
||||
"default": false,
|
||||
"x-priority": "internal"
|
||||
},
|
||||
"directory": {
|
||||
"type": "string",
|
||||
"description": "The directory at which to create the hook file. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the project root.",
|
||||
"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"]
|
||||
},
|
||||
"export": {
|
||||
"type": "boolean",
|
||||
"description": "When true, the hook is exported from the project `index.ts` (if it exists).",
|
||||
@ -57,7 +49,7 @@
|
||||
"x-prompt": "Should this hook be exported in the project?"
|
||||
}
|
||||
},
|
||||
"required": ["name"],
|
||||
"required": ["path"],
|
||||
"presets": []
|
||||
},
|
||||
"description": "Create a hook.",
|
||||
|
||||
@ -8,18 +8,27 @@
|
||||
"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": "Path where the Redux slice will be generated.",
|
||||
"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": "Where should the Redux slice be generated?",
|
||||
"x-prompt": "What is the Redux stateslice file path?",
|
||||
"x-priority": "important"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Redux slice name.",
|
||||
"x-priority": "important"
|
||||
"description": "The Redux state slice symbol name. Defaults to the last segment of the file path."
|
||||
},
|
||||
"appProject": {
|
||||
"type": "string",
|
||||
|
||||
@ -84,10 +84,6 @@ npm add -D @nx/remix
|
||||
|
||||
## Generate a Remix Application
|
||||
|
||||
{% 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 %}
|
||||
|
||||
```{% command="nx g @nx/remix:app apps/myapp" path="~/acme" %}
|
||||
NX Generating @nx/remix:application
|
||||
|
||||
|
||||
@ -12,11 +12,6 @@
|
||||
"description": "The route path or path to the filename of the route.",
|
||||
"$default": { "$source": "argv", "index": 0 },
|
||||
"x-prompt": "What is the path of the route? (e.g. 'apps/demo/app/routes/foo/bar.tsx')"
|
||||
},
|
||||
"nameAndDirectoryFormat": {
|
||||
"description": "Whether to generate the action 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"]
|
||||
}
|
||||
},
|
||||
"required": ["path"],
|
||||
|
||||
@ -18,11 +18,6 @@
|
||||
"type": "string",
|
||||
"description": "The path to route file relative to the project root."
|
||||
},
|
||||
"nameAndDirectoryFormat": {
|
||||
"description": "Whether to generate the error boundary in the path 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"]
|
||||
},
|
||||
"skipFormat": {
|
||||
"type": "boolean",
|
||||
"description": "Skip formatting files after generation.",
|
||||
|
||||
@ -12,11 +12,6 @@
|
||||
"description": "The route path or path to the filename of the route.",
|
||||
"$default": { "$source": "argv", "index": 0 },
|
||||
"x-prompt": "What is the path of the route? (e.g. 'apps/demo/app/routes/foo/bar.tsx')"
|
||||
},
|
||||
"nameAndDirectoryFormat": {
|
||||
"description": "Whether to generate the loader in the path 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"]
|
||||
}
|
||||
},
|
||||
"required": ["path"],
|
||||
|
||||
@ -12,11 +12,6 @@
|
||||
"description": "The route path or path to the filename of the route.",
|
||||
"$default": { "$source": "argv", "index": 0 },
|
||||
"x-prompt": "What is the path of the route? (e.g. 'apps/demo/app/routes/foo/bar.tsx')"
|
||||
},
|
||||
"nameAndDirectoryFormat": {
|
||||
"description": "Whether to generate the meta function in the path 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"]
|
||||
}
|
||||
},
|
||||
"required": ["path"],
|
||||
|
||||
@ -125,7 +125,7 @@
|
||||
}
|
||||
},
|
||||
"required": ["directory"],
|
||||
"examplesFile": "---\ntitle: Vue application generator examples\ndescription: This page contains examples for the @nx/vue:app generator.\n---\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Simple Application\" %}\n\nCreate an application named `my-app`:\n\n```shell\nnx g @nx/vue:app 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```shell\nnx g @nx/vue:app apps/my-dir/my-app --style=scss\n```\n\n{% /tab %}\n\n{% tab label=\"Add tags\" %}\n\nAdd tags to the application (used for linting).\n\n```shell\nnx g @nx/vue:app apps/my-app --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n",
|
||||
"examplesFile": "---\ntitle: Vue application generator examples\ndescription: This page contains examples for the @nx/vue:app generator.\n---\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Simple Application\" %}\n\nCreate an application named `my-app`:\n\n```shell\nnx g @nx/vue:app 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```shell\nnx g @nx/vue:app apps/my-dir/my-app --style=scss\n```\n\n{% /tab %}\n\n{% tab label=\"Add tags\" %}\n\nAdd tags to the application (used for linting).\n\n```shell\nnx g @nx/vue:app apps/my-app --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n",
|
||||
"presets": []
|
||||
},
|
||||
"aliases": ["app"],
|
||||
|
||||
@ -10,26 +10,16 @@
|
||||
"type": "object",
|
||||
"examples": [
|
||||
{
|
||||
"command": "nx g @nx/vue:component my-app/src/app/one --name=one --unitTestRunner=vitest",
|
||||
"description": "Generate a component `one` in the `my-app` application at my-app/src/app/one"
|
||||
},
|
||||
{
|
||||
"command": "nx g @nx/vue:component my-app/src/app/one",
|
||||
"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": "Path where the component will be generated.",
|
||||
"description": "The file path to the component without the file extension. Relative to the current working directory.",
|
||||
"$default": { "$source": "argv", "index": 0 },
|
||||
"x-prompt": "Where should the component be generated?",
|
||||
"x-priority": "important"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "The name of the component.",
|
||||
"x-prompt": "What name would you like to use for the component?"
|
||||
"x-prompt": "What is the component file path?"
|
||||
},
|
||||
"js": {
|
||||
"type": "boolean",
|
||||
|
||||
@ -108,7 +108,7 @@
|
||||
}
|
||||
},
|
||||
"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/web:application apps/my-app\n```\n\n{% /tab %}\n\n{% tab label=\"Application using Vite as bundler\" %}\n\nCreate an application named `my-app`:\n\n```bash\nnx g @nx/web:app apps/my-app --bundler=vite\n```\n\nWhen choosing `vite` as the bundler, your unit tests will be set up with `vitest`, unless you choose `none` for `unitTestRunner`.\n\n{% /tab %}\n\n{% tab label=\"Specify directory\" %}\n\nCreate an application named `my-app` in the `my-dir` directory:\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/web:app apps/my-dir/my-app\n```\n\n{% /tab %}\n\n{% tab label=\"Add tags\" %}\n\nAdd tags to the application (used for linting).\n\n```bash\nnx g @nx/web:app apps/my-app --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/web:application apps/my-app\n```\n\n{% /tab %}\n\n{% tab label=\"Application using Vite as bundler\" %}\n\nCreate an application named `my-app`:\n\n```bash\nnx g @nx/web:app apps/my-app --bundler=vite\n```\n\nWhen choosing `vite` as the bundler, your unit tests will be set up with `vitest`, unless you choose `none` for `unitTestRunner`.\n\n{% /tab %}\n\n{% tab label=\"In a nested directory\" %}\n\nCreate an application named `my-app` in the `my-dir` directory:\n\n```bash\nnx g @nx/web:app apps/my-dir/my-app\n```\n\n{% /tab %}\n\n{% tab label=\"Add tags\" %}\n\nAdd tags to the application (used for linting).\n\n```bash\nnx g @nx/web:app apps/my-app --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n",
|
||||
"presets": []
|
||||
},
|
||||
"aliases": ["app"],
|
||||
|
||||
@ -24,10 +24,6 @@ nx add @nx/remix
|
||||
|
||||
## Generate a Remix Application
|
||||
|
||||
{% 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 %}
|
||||
|
||||
```{% command="nx g @nx/remix:app apps/myapp" path="~/acme" %}
|
||||
NX Generating @nx/remix:application
|
||||
|
||||
|
||||
@ -7,12 +7,6 @@ applications.
|
||||
|
||||
To enable incremental builds you need to use buildable libraries.
|
||||
|
||||
{% 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 generate a new buildable library with:
|
||||
|
||||
```shell
|
||||
|
||||
@ -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
|
||||
|
||||
@ -84,10 +84,6 @@ npm add -D @nx/remix
|
||||
|
||||
## Generate a Remix Application
|
||||
|
||||
{% 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 %}
|
||||
|
||||
```{% command="nx g @nx/remix:app apps/myapp" path="~/acme" %}
|
||||
NX Generating @nx/remix:application
|
||||
|
||||
|
||||
@ -88,10 +88,6 @@ nx add @nx/js@<nx-version>
|
||||
|
||||
Then generate a project
|
||||
|
||||
{% 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 %}
|
||||
|
||||
```{% command="nx g @nx/js:lib libs/ui --minimal" path="~/astro-app" %}
|
||||
NX Generating @nx/js:library
|
||||
|
||||
|
||||
@ -119,10 +119,6 @@ This generates the following files:
|
||||
|
||||
Use the `app` generator to create a new .NET app. For this demo, use the `nx` path naming convention and the `web-api` project template.
|
||||
|
||||
{% 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 %}
|
||||
|
||||
```shell
|
||||
nx g @nx-dotnet/core:app my-api --directory=apps/my-api --test-template nunit --language C#
|
||||
```
|
||||
@ -137,10 +133,6 @@ nx serve my-api
|
||||
|
||||
To create a new library, run the library generator. Use the `classlib` template.
|
||||
|
||||
{% 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 %}
|
||||
|
||||
```shell
|
||||
nx g @nx-dotnet/core:lib dotnet-lib --directory=libs/dotnet-lib
|
||||
```
|
||||
|
||||
@ -29,10 +29,6 @@ nx add @nx/express
|
||||
|
||||
Use the `app` generator to create a new Express app.
|
||||
|
||||
{% 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 %}
|
||||
|
||||
```shell
|
||||
nx g @nx/express:app apps/my-express-api
|
||||
```
|
||||
@ -49,10 +45,6 @@ This starts the application on localhost:3333/api by default.
|
||||
|
||||
The `@nx/express` plugin does not have a `library` generator, but we can use the `library` generator from the `@nx/js` plugin. To create a new library, install the `@nx/js` package and run:
|
||||
|
||||
{% 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 %}
|
||||
|
||||
```shell
|
||||
nx g @nx/js:lib libs/my-lib
|
||||
```
|
||||
|
||||
@ -42,10 +42,6 @@ nx add @nx/node
|
||||
|
||||
Use the `app` generator to create a new Fastify app.
|
||||
|
||||
{% 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 %}
|
||||
|
||||
```shell
|
||||
nx g @nx/node:app apps/fastify-api
|
||||
```
|
||||
@ -62,10 +58,6 @@ This starts the application on localhost:3000/api by default.
|
||||
|
||||
To create a new library, run:
|
||||
|
||||
{% 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 %}
|
||||
|
||||
```shell
|
||||
nx g @nx/node:lib libs/my-lib
|
||||
```
|
||||
|
||||
@ -61,10 +61,6 @@ bun add -D lit http-server
|
||||
|
||||
## Create an Application
|
||||
|
||||
{% 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 %}
|
||||
|
||||
We'll start with a node application and then tweak the settings to match what we need. Add a new node application to your workspace with the following command:
|
||||
|
||||
```shell
|
||||
@ -185,10 +181,6 @@ nx serve my-lit-app
|
||||
|
||||
## Create a 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 %}
|
||||
|
||||
Let's create a library that our Lit application is going to consume. To create a new library, install the `@nx/js` package and run:
|
||||
|
||||
```shell
|
||||
|
||||
@ -67,10 +67,6 @@ If you need help finding the version of `nx` you are currently using, run `nx re
|
||||
|
||||
Let's generate a new application using `qwik-nx`.
|
||||
|
||||
{% 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 %}
|
||||
|
||||
```shell
|
||||
nx g qwik-nx:app todo --directory=apps/todo
|
||||
```
|
||||
@ -79,10 +75,6 @@ nx g qwik-nx:app todo --directory=apps/todo
|
||||
|
||||
Let's generate a new library using `qwik-nx`.
|
||||
|
||||
{% 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 %}
|
||||
|
||||
```shell
|
||||
nx g qwik-nx:lib data-access --directory=libs/data-access
|
||||
```
|
||||
|
||||
@ -59,10 +59,6 @@ Using the preset provided by `@monodon/rust` will:
|
||||
|
||||
Let's generate a new application using `@monodon/rust`.
|
||||
|
||||
{% 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 %}
|
||||
|
||||
```shell
|
||||
nx g @monodon/rust:binary myapp --directory=apps/myapp
|
||||
```
|
||||
@ -71,10 +67,6 @@ nx g @monodon/rust:binary myapp --directory=apps/myapp
|
||||
|
||||
Let's generate a new library using `@monodon/rust`.
|
||||
|
||||
{% 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 %}
|
||||
|
||||
```shell
|
||||
nx g @monodon/rust:library cats --directory=libs/cats
|
||||
```
|
||||
|
||||
@ -65,10 +65,6 @@ nx add @nx/web
|
||||
|
||||
## Create an Application
|
||||
|
||||
{% 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 %}
|
||||
|
||||
We'll start with a web application and then tweak the settings to match what we need. Add a new web application to your
|
||||
workspace with the following command:
|
||||
|
||||
@ -244,10 +240,6 @@ You can now run `nx serve my-solid-app` and your Solid application can be viewed
|
||||
|
||||
## Create a 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 %}
|
||||
|
||||
Let's create a library that our Solid application is going to consume. To create a new library, install the `@nx/js`
|
||||
package and run:
|
||||
|
||||
|
||||
@ -264,10 +264,6 @@ Navigate to `http://localhost:4200` and you should see your application.
|
||||
|
||||
Instead of having our Counter directly defined in `App.svelte` file, let's create a library that we can import into our application.
|
||||
|
||||
{% 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 %}
|
||||
|
||||
```shell
|
||||
nx generate @nx/js:library libs/counter --unitTestRunner=vitest --bundler=vite --importPath=@acme/counter
|
||||
```
|
||||
|
||||
@ -21,7 +21,7 @@ Since we are using Nx, we will create a library for this module.
|
||||
**Create a library**
|
||||
|
||||
```shell
|
||||
nx generate @nx/js:library hello --unitTestRunner=jest --projectNameAndRootFormat=as-provided
|
||||
nx generate @nx/js:library hello --unitTestRunner=jest
|
||||
```
|
||||
|
||||
Update the `hello.ts` file with the following code:
|
||||
|
||||
@ -20,12 +20,8 @@ Let’s see how we can implement this solution:
|
||||
|
||||
According to the framework you are using, use the corresponding generator to generate a new library. Let’s suppose that you are using React and all your stories are using the `@storybook/react-vite` framework:
|
||||
|
||||
{% 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 %}
|
||||
|
||||
```shell
|
||||
nx g @nx/react:library lib/storybook-host --bundler=none --unitTestRunner=none --projectNameAndRootFormat=as-provided
|
||||
nx g @nx/react:library lib/storybook-host --bundler=none --unitTestRunner=none
|
||||
```
|
||||
|
||||
Now, you have a new library, which will act as a shell/host for all your stories.
|
||||
|
||||
@ -86,10 +86,6 @@ Let's assume in this case that all our libraries are using Angular.
|
||||
|
||||
Let's generate three Angular libraries, one for each scope, and let's call them `storybook-host-client`, `storybook-host-admin`, and `storybook-host-shared`. We can do this by running the following commands:
|
||||
|
||||
{% callout type="note" title="Directory Flag Behavior Changes" %}
|
||||
The commands 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 %}
|
||||
|
||||
```shell
|
||||
nx g @nx/angular:lib libs/storybook-host-client
|
||||
```
|
||||
|
||||
@ -28,10 +28,6 @@ We are going to assume that you are at the state where you already have your `st
|
||||
|
||||
It does not matter which framework you use for the host Storybook library. It can be any framework really, and it does not have to be one of the frameworks that are used in the hosted apps. The only thing that is important is for this host library to have _at least one story_. This is important, or else Storybook will not load. The one story can be a component, for example, which would work like a title for the application, or any other introduction to your Storybook you see fit.
|
||||
|
||||
{% 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 %}
|
||||
|
||||
So, let’s use React for the Storybook Composition host library:
|
||||
|
||||
```shell
|
||||
|
||||
@ -11,14 +11,10 @@ nx g @nx/angular:application apps/my-app
|
||||
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Specify directory and style extension" %}
|
||||
{% tab label="Specify style extension" %}
|
||||
|
||||
Create an application named `my-app` in the `my-dir` directory and use `scss` for styles:
|
||||
|
||||
{% 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, use `--directory=my-dir`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.
|
||||
{% /callout %}
|
||||
|
||||
```bash
|
||||
nx g @nx/angular:app my-dir/my-app --style=scss
|
||||
```
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -34,10 +34,6 @@ nx g @nx/angular:library libs/my-lib --buildable
|
||||
{% tab label="Nested Folder & Import"%}
|
||||
Creates the `my-lib` library in the `nested` directory and sets the import path to `@myorg/nested/my-lib`:
|
||||
|
||||
{% 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, use `--directory=nested`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.
|
||||
{% /callout %}
|
||||
|
||||
```bash
|
||||
nx g @nx/angular:library libs/nested/my-lib --importPath=@myorg/nested/my-lib
|
||||
```
|
||||
|
||||
@ -9,17 +9,16 @@
|
||||
"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",
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
|
||||
|
||||
export interface Schema {
|
||||
path: string;
|
||||
name?: string;
|
||||
|
||||
@ -6,20 +6,29 @@
|
||||
"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?",
|
||||
"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",
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
|
||||
|
||||
export interface Schema {
|
||||
path: string;
|
||||
name?: string;
|
||||
|
||||
@ -6,20 +6,29 @@
|
||||
"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",
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
|
||||
|
||||
export interface Schema {
|
||||
path: string;
|
||||
name?: string;
|
||||
|
||||
@ -6,8 +6,12 @@
|
||||
"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.",
|
||||
@ -15,38 +19,16 @@
|
||||
"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",
|
||||
@ -59,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",
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
|
||||
|
||||
export interface Schema {
|
||||
path: string;
|
||||
name?: string;
|
||||
|
||||
@ -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,18 +19,16 @@
|
||||
"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",
|
||||
@ -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.",
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
|
||||
|
||||
export interface Schema {
|
||||
path: string;
|
||||
name?: string;
|
||||
|
||||
@ -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,17 +19,16 @@
|
||||
"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; }`.",
|
||||
|
||||
@ -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"
|
||||
}
|
||||
],
|
||||
|
||||
@ -19,7 +19,6 @@ describe('component', () => {
|
||||
appTree = createTreeWithEmptyWorkspace();
|
||||
appTree.write('.gitignore', '');
|
||||
defaultSchema = {
|
||||
name: 'hello',
|
||||
path: 'my-lib/src/lib/hello/hello',
|
||||
skipTests: false,
|
||||
export: false,
|
||||
|
||||
@ -15,8 +15,6 @@ export async function normalizeOptions(
|
||||
host: Tree,
|
||||
options: Schema
|
||||
): Promise<NormalizedSchema> {
|
||||
assertValidOptions(options);
|
||||
|
||||
const {
|
||||
artifactName: name,
|
||||
fileName,
|
||||
@ -45,6 +43,7 @@ export async function normalizeOptions(
|
||||
|
||||
return {
|
||||
...options,
|
||||
name,
|
||||
directory,
|
||||
className,
|
||||
fileName,
|
||||
@ -53,19 +52,3 @@ export async function normalizeOptions(
|
||||
projectName,
|
||||
};
|
||||
}
|
||||
|
||||
function assertValidOptions(options: Schema) {
|
||||
const slashes = ['/', '\\'];
|
||||
slashes.forEach((s) => {
|
||||
if (options.name.indexOf(s) !== -1) {
|
||||
const [name, ...rest] = options.name.split(s).reverse();
|
||||
let suggestion = rest.map((x) => x.toLowerCase()).join(s);
|
||||
if (options.path) {
|
||||
suggestion = `${options.path}${s}${suggestion}`;
|
||||
}
|
||||
throw new Error(
|
||||
`Found "${s}" in the component name. Did you mean to use the --directory option (e.g. \`nx g c ${name} --directory ${suggestion}\`)?`
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -9,5 +9,4 @@ export interface Schema {
|
||||
export: boolean; // default is false
|
||||
classComponent: boolean; // default is false
|
||||
js: boolean; // default is false
|
||||
nameAndDirectoryFormat?: NameAndDirectoryFormat;
|
||||
}
|
||||
|
||||
@ -6,29 +6,31 @@
|
||||
"type": "object",
|
||||
"examples": [
|
||||
{
|
||||
"command": "g @nx/expo:component mylib/my-component --name 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 --name 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": "Path where the component will be generated.",
|
||||
"description": "The file path to the component without the file extension. Relative to the current working directory.",
|
||||
"$default": {
|
||||
"$source": "argv",
|
||||
"index": 0
|
||||
},
|
||||
"x-prompt": "Where should the component be generated?",
|
||||
"x-priority": "important"
|
||||
"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."
|
||||
},
|
||||
"js": {
|
||||
"type": "boolean",
|
||||
|
||||
@ -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"
|
||||
}
|
||||
],
|
||||
|
||||
@ -113,13 +113,9 @@ npx nx g lib libs/mylib --publishable
|
||||
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Using directory flag" %}
|
||||
{% tab label="In a nested directory" %}
|
||||
|
||||
Generate a library named `mylib` and put it under a directory named `myapp` (`libs/myapp/mylib`)
|
||||
|
||||
{% 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, use `--directory=myapp`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.
|
||||
{% /callout %}
|
||||
Generate a library named `mylib` and put it under a directory named `nested` (`libs/nested/mylib`).
|
||||
|
||||
```shell
|
||||
npx nx g lib libs/nested/mylib
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
import type {
|
||||
ProjectNameAndRootFormat,
|
||||
ProjectNameAndRootOptions,
|
||||
} from '@nx/devkit/src/generators/project-name-and-root-utils';
|
||||
import type { ProjectNameAndRootOptions } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
||||
// nx-ignore-next-line
|
||||
const { Linter, LinterType } = require('@nx/eslint'); // use require to import to avoid circular dependency
|
||||
import type { ProjectPackageManagerWorkspaceState } from '../../utils/package-manager-workspaces';
|
||||
@ -12,7 +9,6 @@ export type Bundler = 'swc' | 'tsc' | 'rollup' | 'vite' | 'esbuild' | 'none';
|
||||
export interface LibraryGeneratorSchema {
|
||||
directory: string;
|
||||
name?: string;
|
||||
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
||||
skipFormat?: boolean;
|
||||
tags?: string;
|
||||
skipTsConfig?: boolean;
|
||||
|
||||
@ -1,25 +1,17 @@
|
||||
import type { Tree } from '@nx/devkit';
|
||||
import { createTreeWithNestApplication } from '../utils/testing';
|
||||
import type { ClassGeneratorOptions } from './class';
|
||||
import { classGenerator } from './class';
|
||||
|
||||
describe('class generator', () => {
|
||||
let tree: Tree;
|
||||
const path = 'api';
|
||||
const options: ClassGeneratorOptions = {
|
||||
name: 'test',
|
||||
path,
|
||||
unitTestRunner: 'jest',
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
tree = createTreeWithNestApplication(path);
|
||||
jest.clearAllMocks();
|
||||
tree = createTreeWithNestApplication('api');
|
||||
});
|
||||
|
||||
it('should run successfully', async () => {
|
||||
await expect(
|
||||
classGenerator(tree, { ...options, path: 'api/test' })
|
||||
classGenerator(tree, { path: 'api/test' })
|
||||
).resolves.not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,20 +5,21 @@
|
||||
"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": "Path where the class will be generated.",
|
||||
"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": "Where should the class be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the class.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the class file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
@ -32,12 +33,6 @@
|
||||
"enum": ["jest", "none"],
|
||||
"default": "jest"
|
||||
},
|
||||
"flat": {
|
||||
"description": "Flag to indicate if a directory is created.",
|
||||
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20.",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"language": {
|
||||
"description": "Nest class language.",
|
||||
"type": "string",
|
||||
|
||||
@ -1,25 +1,17 @@
|
||||
import type { Tree } from '@nx/devkit';
|
||||
import { createTreeWithNestApplication } from '../utils/testing';
|
||||
import type { ControllerGeneratorOptions } from './controller';
|
||||
import { controllerGenerator } from './controller';
|
||||
|
||||
describe('controller generator', () => {
|
||||
let tree: Tree;
|
||||
const path = 'api';
|
||||
const options: ControllerGeneratorOptions = {
|
||||
name: 'test',
|
||||
path,
|
||||
unitTestRunner: 'jest',
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
tree = createTreeWithNestApplication(path);
|
||||
jest.clearAllMocks();
|
||||
tree = createTreeWithNestApplication('api');
|
||||
});
|
||||
|
||||
it('should run successfully', async () => {
|
||||
await expect(
|
||||
controllerGenerator(tree, { ...options, path: 'api/test' })
|
||||
controllerGenerator(tree, { path: 'api/test' })
|
||||
).resolves.not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,20 +5,21 @@
|
||||
"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": "Path where the controller will be generated.",
|
||||
"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": "Where should the controller be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the controller.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the controller file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
|
||||
@ -1,24 +1,17 @@
|
||||
import type { Tree } from '@nx/devkit';
|
||||
import { createTreeWithNestApplication } from '../utils/testing';
|
||||
import type { DecoratorGeneratorOptions } from './decorator';
|
||||
import { decoratorGenerator } from './decorator';
|
||||
|
||||
describe('decorator generator', () => {
|
||||
let tree: Tree;
|
||||
const path = 'api';
|
||||
const options: DecoratorGeneratorOptions = {
|
||||
name: 'test',
|
||||
path,
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
tree = createTreeWithNestApplication(path);
|
||||
jest.clearAllMocks();
|
||||
tree = createTreeWithNestApplication('api');
|
||||
});
|
||||
|
||||
it('should run successfully', async () => {
|
||||
await expect(
|
||||
decoratorGenerator(tree, { ...options, path: 'api/test' })
|
||||
decoratorGenerator(tree, { path: 'api/test' })
|
||||
).resolves.not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,20 +5,21 @@
|
||||
"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": "Path where the decorator will be generated.",
|
||||
"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": "Where should the decorator be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the decorator.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the decorator file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
|
||||
@ -1,25 +1,17 @@
|
||||
import type { Tree } from '@nx/devkit';
|
||||
import { createTreeWithNestApplication } from '../utils/testing';
|
||||
import type { FilterGeneratorOptions } from './filter';
|
||||
import { filterGenerator } from './filter';
|
||||
|
||||
describe('filter generator', () => {
|
||||
let tree: Tree;
|
||||
const path = 'api';
|
||||
const options: FilterGeneratorOptions = {
|
||||
name: 'test',
|
||||
path,
|
||||
unitTestRunner: 'jest',
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
tree = createTreeWithNestApplication(path);
|
||||
jest.clearAllMocks();
|
||||
tree = createTreeWithNestApplication('api');
|
||||
});
|
||||
|
||||
it('should run successfully', async () => {
|
||||
await expect(
|
||||
filterGenerator(tree, { ...options, path: 'api/test' })
|
||||
filterGenerator(tree, { path: 'api/test' })
|
||||
).resolves.not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,20 +5,21 @@
|
||||
"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": "Path where the filter will be generated.",
|
||||
"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": "Where should the filter be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the filter.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the filter file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"type": "boolean",
|
||||
|
||||
@ -1,25 +1,17 @@
|
||||
import type { Tree } from '@nx/devkit';
|
||||
import { createTreeWithNestApplication } from '../utils/testing';
|
||||
import type { GatewayGeneratorOptions } from './gateway';
|
||||
import { gatewayGenerator } from './gateway';
|
||||
|
||||
describe('gateway generator', () => {
|
||||
let tree: Tree;
|
||||
const path = 'api';
|
||||
const options: GatewayGeneratorOptions = {
|
||||
name: 'test',
|
||||
path,
|
||||
unitTestRunner: 'jest',
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
tree = createTreeWithNestApplication(path);
|
||||
jest.clearAllMocks();
|
||||
tree = createTreeWithNestApplication('api');
|
||||
});
|
||||
|
||||
it('should run successfully', async () => {
|
||||
await expect(
|
||||
gatewayGenerator(tree, { ...options, path: 'api/test' })
|
||||
gatewayGenerator(tree, { path: 'api/test' })
|
||||
).resolves.not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,20 +5,21 @@
|
||||
"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": "Path where the gateway will be generated.",
|
||||
"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": "Where should the gateway be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the gateway.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the gateway file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
|
||||
@ -1,25 +1,17 @@
|
||||
import type { Tree } from '@nx/devkit';
|
||||
import { createTreeWithNestApplication } from '../utils/testing';
|
||||
import type { GuardGeneratorOptions } from './guard';
|
||||
import { guardGenerator } from './guard';
|
||||
|
||||
describe('guard generator', () => {
|
||||
let tree: Tree;
|
||||
const path = 'api';
|
||||
const options: GuardGeneratorOptions = {
|
||||
name: 'test',
|
||||
path,
|
||||
unitTestRunner: 'jest',
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
tree = createTreeWithNestApplication(path);
|
||||
jest.clearAllMocks();
|
||||
tree = createTreeWithNestApplication('api');
|
||||
});
|
||||
|
||||
it('should run successfully', async () => {
|
||||
await expect(
|
||||
guardGenerator(tree, { ...options, path: 'api/test' })
|
||||
guardGenerator(tree, { path: 'api/test' })
|
||||
).resolves.not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,20 +5,21 @@
|
||||
"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": "Path where the guard will be generated.",
|
||||
"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": "Where should the guard be generated?"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the guard.",
|
||||
"type": "string",
|
||||
"x-prompt": "What name would you like to use?"
|
||||
"x-prompt": "What is the guard file path?"
|
||||
},
|
||||
"skipFormat": {
|
||||
"description": "Skip formatting files.",
|
||||
|
||||
@ -1,25 +1,17 @@
|
||||
import type { Tree } from '@nx/devkit';
|
||||
import { createTreeWithNestApplication } from '../utils/testing';
|
||||
import type { InterceptorGeneratorOptions } from './interceptor';
|
||||
import { interceptorGenerator } from './interceptor';
|
||||
|
||||
describe('interceptor generator', () => {
|
||||
let tree: Tree;
|
||||
const path = 'api';
|
||||
const options: InterceptorGeneratorOptions = {
|
||||
name: 'test',
|
||||
path,
|
||||
unitTestRunner: 'jest',
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
tree = createTreeWithNestApplication(path);
|
||||
jest.clearAllMocks();
|
||||
tree = createTreeWithNestApplication('api');
|
||||
});
|
||||
|
||||
it('should run successfully', async () => {
|
||||
await expect(
|
||||
interceptorGenerator(tree, { ...options, path: 'api/test' })
|
||||
interceptorGenerator(tree, { path: 'api/test' })
|
||||
).resolves.not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user