diff --git a/docs/generated/packages/angular/generators/application.json b/docs/generated/packages/angular/generators/application.json index c7fb4a4d67f0f..bb25bae780041 100644 --- a/docs/generated/packages/angular/generators/application.json +++ b/docs/generated/packages/angular/generators/application.json @@ -9,22 +9,17 @@ "type": "object", "cli": "nx", "properties": { - "name": { - "description": "The name of the application.", - "type": "string", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the application?", - "pattern": "^[a-zA-Z][^:]*$" - }, "directory": { "description": "The directory of the new application.", "type": "string", - "x-priority": "important" + "$default": { "$source": "argv", "index": 0 }, + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { + "description": "The name of the application.", "type": "string", - "enum": ["as-provided", "derived"] + "x-priority": "important" }, "style": { "description": "The file extension to be used for style files.", diff --git a/docs/generated/packages/angular/generators/federate-module.json b/docs/generated/packages/angular/generators/federate-module.json index 73e1c917dc77a..1c978a84bdc94 100644 --- a/docs/generated/packages/angular/generators/federate-module.json +++ b/docs/generated/packages/angular/generators/federate-module.json @@ -37,11 +37,6 @@ "description": "The directory of the new remote application if one needs to be created.", "type": "string" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "style": { "description": "The file extension to be used for style files for the remote if one needs to be created.", "type": "string", diff --git a/docs/generated/packages/angular/generators/host.json b/docs/generated/packages/angular/generators/host.json index ec92ae8ceef32..9e29c77999288 100644 --- a/docs/generated/packages/angular/generators/host.json +++ b/docs/generated/packages/angular/generators/host.json @@ -15,11 +15,17 @@ } ], "properties": { + "directory": { + "description": "The directory of the new application.", + "type": "string", + "$default": { "$source": "argv", "index": 0 }, + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" + }, "name": { "type": "string", "description": "The name to give to the host Angular application.", - "$default": { "$source": "argv", "index": 0 }, - "pattern": "^[a-zA-Z][^:]*$" + "x-priority": "important" }, "remotes": { "type": "array", @@ -31,15 +37,6 @@ "description": "Should the host application use dynamic federation?", "default": false }, - "directory": { - "description": "The directory of the new application.", - "type": "string" - }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "style": { "description": "The file extension to be used for style files.", "type": "string", @@ -178,7 +175,7 @@ } }, "additionalProperties": false, - "required": ["name"], + "required": ["directory"], "presets": [] }, "x-type": "application", diff --git a/docs/generated/packages/angular/generators/library.json b/docs/generated/packages/angular/generators/library.json index 6cbd1928745a3..837c5bc664bb7 100644 --- a/docs/generated/packages/angular/generators/library.json +++ b/docs/generated/packages/angular/generators/library.json @@ -12,19 +12,14 @@ "name": { "type": "string", "description": "The name of the library.", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$" + "x-priority": "important" }, "directory": { "type": "string", "description": "A directory where the library is placed.", - "x-priority": "important" - }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] + "$default": { "$source": "argv", "index": 0 }, + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the library in?" }, "publishable": { "type": "boolean", @@ -203,7 +198,7 @@ } }, "additionalProperties": false, - "required": ["name"], + "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 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 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 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 --directory=libs/nested/my-lib --importPath=@myorg/nested/my-lib my-lib\n```\n\n{% /tab %}\n", "presets": [] }, diff --git a/docs/generated/packages/angular/generators/move.json b/docs/generated/packages/angular/generators/move.json index 049afe97b8133..9179b04d53680 100644 --- a/docs/generated/packages/angular/generators/move.json +++ b/docs/generated/packages/angular/generators/move.json @@ -35,11 +35,6 @@ "$default": { "$source": "argv", "index": 0 }, "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the new project name and destination as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "importPath": { "type": "string", "description": "The new import path to use in the `tsconfig.base.json`." diff --git a/docs/generated/packages/angular/generators/remote.json b/docs/generated/packages/angular/generators/remote.json index 937783ecd7a0f..f7b3370d96c49 100644 --- a/docs/generated/packages/angular/generators/remote.json +++ b/docs/generated/packages/angular/generators/remote.json @@ -15,11 +15,17 @@ } ], "properties": { + "directory": { + "description": "The directory of the new application.", + "type": "string", + "$default": { "$source": "argv", "index": 0 }, + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" + }, "name": { "type": "string", "description": "The name to give to the remote Angular app.", - "$default": { "$source": "argv", "index": 0 }, - "pattern": "^[a-zA-Z][^:]*$" + "x-priority": "important" }, "host": { "type": "string", @@ -31,15 +37,6 @@ "type": "number", "description": "The port on which this app should be served." }, - "directory": { - "description": "The directory of the new application.", - "type": "string" - }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "style": { "description": "The file extension to be used for style files.", "type": "string", @@ -171,7 +168,7 @@ } }, "additionalProperties": false, - "required": ["name"], + "required": ["directory"], "presets": [] }, "x-type": "application", diff --git a/docs/generated/packages/detox/generators/application.json b/docs/generated/packages/detox/generators/application.json index 5b7611478117b..33d7ea84c1f18 100644 --- a/docs/generated/packages/detox/generators/application.json +++ b/docs/generated/packages/detox/generators/application.json @@ -13,12 +13,16 @@ "$default": { "$source": "projectName" }, "x-prompt": "What is the name of the frontend project to test?" }, - "e2eName": { + "e2eDirectory": { "type": "string", - "description": "Name of the E2E Project.", + "description": "A directory where the project is placed relative current working directory (CWD).", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the E2E project?", - "pattern": "^[a-zA-Z][^:]*$" + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the E2E project in?" + }, + "e2eName": { + "type": "string", + "description": "Name of the E2E Project." }, "appName": { "type": "string", @@ -34,15 +38,6 @@ "enum": ["react-native", "expo"], "x-prompt": "What app framework should detox test?" }, - "e2eDirectory": { - "type": "string", - "description": "A directory where the project is placed relative to apps directory." - }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "linter": { "description": "The tool to use for running lint checks.", "type": "string", @@ -66,7 +61,7 @@ "default": false } }, - "required": ["e2eName", "appProject", "framework"], + "required": ["e2eDirectory", "appProject", "framework"], "presets": [] }, "aliases": ["app"], diff --git a/docs/generated/packages/expo/generators/application.json b/docs/generated/packages/expo/generators/application.json index c9648c5cf6c07..53fdbddd37658 100644 --- a/docs/generated/packages/expo/generators/application.json +++ b/docs/generated/packages/expo/generators/application.json @@ -18,27 +18,22 @@ ], "type": "object", "properties": { + "directory": { + "description": "The directory of the new application.", + "type": "string", + "$default": { "$source": "argv", "index": 0 }, + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" + }, "name": { "description": "The name of the application.", "type": "string", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the application?", - "pattern": "^[a-zA-Z][^:]*$" + "x-priority": "important" }, "displayName": { "description": "The display name to show in the application. Defaults to name.", "type": "string" }, - "directory": { - "description": "The directory of the new application.", - "type": "string", - "x-priority": "important" - }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "skipFormat": { "description": "Skip formatting files", "type": "boolean", @@ -90,7 +85,7 @@ "default": false } }, - "required": ["name"], + "required": ["directory"], "presets": [] }, "aliases": ["app"], diff --git a/docs/generated/packages/expo/generators/library.json b/docs/generated/packages/expo/generators/library.json index f2b97f63283b4..09e94624bf61c 100644 --- a/docs/generated/packages/expo/generators/library.json +++ b/docs/generated/packages/expo/generators/library.json @@ -14,22 +14,17 @@ } ], "properties": { - "name": { - "type": "string", - "description": "Library name", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$" - }, "directory": { "type": "string", "description": "A directory where the lib is placed.", - "x-priority": "important" + "$default": { "$source": "argv", "index": 0 }, + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the library in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { "type": "string", - "enum": ["as-provided", "derived"] + "description": "Library name", + "x-priority": "important" }, "linter": { "description": "The tool to use for running lint checks.", @@ -94,7 +89,7 @@ "default": false } }, - "required": ["name"], + "required": ["directory"], "presets": [] }, "aliases": ["lib"], diff --git a/docs/generated/packages/express/generators/application.json b/docs/generated/packages/express/generators/application.json index ecbccb407158b..4f578c65b055a 100644 --- a/docs/generated/packages/express/generators/application.json +++ b/docs/generated/packages/express/generators/application.json @@ -9,22 +9,17 @@ "description": "Nx Application Options Schema.", "type": "object", "properties": { - "name": { - "description": "The name of the application.", + "directory": { + "description": "The directory of the new application.", "type": "string", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the node application?", - "pattern": "^[a-zA-Z][^:]*$" + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "directory": { - "description": "The directory of the new application.", + "name": { + "description": "The name of the application.", "type": "string" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "skipFormat": { "description": "Skip formatting files.", "type": "boolean", @@ -71,19 +66,13 @@ "description": "Generate JavaScript files rather than TypeScript files.", "default": false }, - "standaloneConfig": { - "description": "Split the project configuration into `/project.json` rather than including it inside `workspace.json`.", - "type": "boolean", - "default": true, - "x-deprecated": "Nx only supports standaloneConfig" - }, "setParserOptionsProject": { "type": "boolean", "description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.", "default": false } }, - "required": [], + "required": ["directory"], "presets": [] }, "aliases": ["app"], diff --git a/docs/generated/packages/js/generators/library.json b/docs/generated/packages/js/generators/library.json index 70859e0d8f84b..350405ef30f7a 100644 --- a/docs/generated/packages/js/generators/library.json +++ b/docs/generated/packages/js/generators/library.json @@ -9,22 +9,17 @@ "description": "Create a TypeScript Library.", "type": "object", "properties": { - "name": { - "type": "string", - "description": "Library name.", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$" - }, "directory": { "type": "string", "description": "A directory where the lib is placed.", - "x-priority": "important" + "$default": { "$source": "argv", "index": 0 }, + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the library in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { "type": "string", - "enum": ["as-provided", "derived"] + "description": "Library name.", + "x-priority": "important" }, "linter": { "description": "The tool to use for running lint checks.", @@ -140,7 +135,7 @@ "default": false } }, - "required": ["name"], + "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 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 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 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 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 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 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 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 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 mylib --directory=libs/myapp/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 mylib --bundler=none\n```\n\n{% /tab %}\n\n{% /tabs %}\n", "presets": [] }, diff --git a/docs/generated/packages/nest/generators/application.json b/docs/generated/packages/nest/generators/application.json index 304141f665d42..97c26460e269f 100644 --- a/docs/generated/packages/nest/generators/application.json +++ b/docs/generated/packages/nest/generators/application.json @@ -9,21 +9,17 @@ "cli": "nx", "type": "object", "properties": { - "name": { - "description": "The name of the application.", - "type": "string", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the node application?", - "pattern": "^[a-zA-Z][^:]*$" - }, "directory": { "description": "The directory of the new application.", - "type": "string" + "type": "string", + "$default": { "$source": "argv", "index": 0 }, + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { + "description": "The name of the application.", "type": "string", - "enum": ["as-provided", "derived"] + "x-priority": "important" }, "skipFormat": { "description": "Skip formatting files.", @@ -82,7 +78,7 @@ } }, "additionalProperties": false, - "required": ["name"], + "required": ["directory"], "presets": [] }, "aliases": ["app"], diff --git a/docs/generated/packages/nest/generators/library.json b/docs/generated/packages/nest/generators/library.json index f811ec86a38fb..574037aa02d9e 100644 --- a/docs/generated/packages/nest/generators/library.json +++ b/docs/generated/packages/nest/generators/library.json @@ -15,23 +15,15 @@ } ], "properties": { - "name": { - "description": "Library name.", - "type": "string", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$" - }, "directory": { "description": "A directory where the library is placed.", "type": "string", - "alias": "dir" - }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided"] + "alias": "dir", + "$default": { "$source": "argv", "index": 0 }, + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the library in?" }, + "name": { "description": "Library name.", "type": "string" }, "linter": { "description": "The tool to use for running lint checks.", "type": "string", @@ -143,7 +135,7 @@ } }, "additionalProperties": false, - "required": ["name"], + "required": ["directory"], "presets": [] }, "aliases": ["lib"], diff --git a/docs/generated/packages/next/generators/application.json b/docs/generated/packages/next/generators/application.json index 344a8545d16ec..cf0bb9bc00110 100644 --- a/docs/generated/packages/next/generators/application.json +++ b/docs/generated/packages/next/generators/application.json @@ -9,24 +9,18 @@ "description": "Create a Next.js Application for Nx.", "type": "object", "properties": { - "name": { - "description": "The name of the application.", - "type": "string", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the application?", - "pattern": "^[a-zA-Z][^:]*$", - "x-priority": "important" - }, "directory": { "description": "The directory of the new application.", "type": "string", "alias": "dir", - "x-priority": "important" + "$default": { "$source": "argv", "index": 0 }, + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { + "description": "The name of the application.", "type": "string", - "enum": ["as-provided", "derived"] + "x-priority": "important" }, "style": { "description": "The file extension to be used for style files.", @@ -142,7 +136,7 @@ "x-priority": "internal" } }, - "required": [], + "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 myapp --directory=apps/nested/myapp\n```\n\n{% /tab %}\n{% tab label=\"Use a custom Express server\" %}\n\n```shell\nnx g app myapp --custom-server\n```\n\n{% /tab %}\n{% tab label=\"Use plain JavaScript (not TypeScript)\" %}\n\n```shell\nnx g app myapp --js\n```\n\n{% /tab %}\n{% /tabs %}\n", "presets": [] }, diff --git a/docs/generated/packages/next/generators/library.json b/docs/generated/packages/next/generators/library.json index 3f148199fa048..b11342b94ad61 100644 --- a/docs/generated/packages/next/generators/library.json +++ b/docs/generated/packages/next/generators/library.json @@ -9,24 +9,18 @@ "description": "Create a React Library for an Nx workspace.", "type": "object", "properties": { - "name": { - "type": "string", - "description": "Library name", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", - "x-priority": "important" - }, "directory": { "type": "string", "description": "A directory where the lib is placed.", "alias": "dir", - "x-priority": "important" + "$default": { "$source": "argv", "index": 0 }, + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the library in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { "type": "string", - "enum": ["as-provided", "derived"] + "description": "Library name", + "x-priority": "important" }, "style": { "description": "The file extension to be used for style files.", @@ -142,7 +136,7 @@ "x-priority": "internal" } }, - "required": ["name"], + "required": ["directory"], "examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Create a new lib\" %}\n\n```shell\nnx g lib my-lib\n```\n\n{% /tab %}\n{% tab label=\"Create a new lib under a directory\" %}\n\nThe following will create a library at `libs/shared/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=shared`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.\n{% /callout %}\n\n```shell\nnx g lib my-lib --directory=libs/shared/my-lib\n```\n\n{% /tab %}\n{% /tabs %}\n", "presets": [] }, diff --git a/docs/generated/packages/node/generators/application.json b/docs/generated/packages/node/generators/application.json index 40113b7e1e27c..bb96770a69e98 100644 --- a/docs/generated/packages/node/generators/application.json +++ b/docs/generated/packages/node/generators/application.json @@ -9,23 +9,17 @@ "description": "Nx Application Options Schema.", "type": "object", "properties": { - "name": { - "description": "The name of the application.", - "type": "string", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the node application?", - "x-priority": "important", - "pattern": "^[a-zA-Z][^:]*$" - }, "directory": { "description": "The directory of the new application.", "type": "string", - "x-priority": "important" + "$default": { "$source": "argv", "index": 0 }, + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { + "description": "The name of the application.", "type": "string", - "enum": ["as-provided", "derived"] + "x-priority": "important" }, "skipFormat": { "description": "Skip formatting files", @@ -126,7 +120,7 @@ "description": "Add a docker build target" } }, - "required": ["name"], + "required": ["directory"], "presets": [] }, "aliases": ["app"], diff --git a/docs/generated/packages/node/generators/library.json b/docs/generated/packages/node/generators/library.json index a7b9bc38ffd93..ecc567769841d 100644 --- a/docs/generated/packages/node/generators/library.json +++ b/docs/generated/packages/node/generators/library.json @@ -15,26 +15,21 @@ } ], "properties": { - "name": { - "type": "string", - "description": "Library name", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$" - }, "directory": { "type": "string", "description": "A directory where the lib is placed", "alias": "dir", - "x-priority": "important" + "$default": { "$source": "argv", "index": 0 }, + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the library in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { "type": "string", - "enum": ["as-provided", "derived"] + "description": "Library name", + "x-priority": "important" }, "simpleModuleName": { - "description": "Keep the module name simple (when using `--directory`).", + "description": "Keep the module name simple.", "type": "boolean", "default": false }, @@ -126,7 +121,7 @@ "default": false } }, - "required": ["name"], + "required": ["directory"], "presets": [] }, "aliases": ["lib"], diff --git a/docs/generated/packages/nuxt/generators/application.json b/docs/generated/packages/nuxt/generators/application.json index 2145854b09ebf..1b6aaf21801cb 100644 --- a/docs/generated/packages/nuxt/generators/application.json +++ b/docs/generated/packages/nuxt/generators/application.json @@ -9,24 +9,18 @@ "description": "Create a Nuxt Application for Nx.", "type": "object", "properties": { - "name": { - "description": "The name of the application.", - "type": "string", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the application?", - "pattern": "^[a-zA-Z][^:]*$", - "x-priority": "important" - }, "directory": { "description": "The directory of the new application.", "type": "string", "alias": "dir", - "x-priority": "important" + "$default": { "$source": "argv", "index": 0 }, + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { + "description": "The name of the application.", "type": "string", - "enum": ["as-provided", "derived"] + "x-priority": "important" }, "linter": { "description": "The tool to use for running lint checks.", @@ -105,7 +99,7 @@ "default": false } }, - "required": [], + "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 myapp --directory=apps/nested/myapp\n```\n\n{% /tab %}\n\n{% tab label=\"Create app with vitest configured\" %}\n\n```shell\nnx g @nx/nuxt:app myapp --directory=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 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 --directory=my-app/src/pages --name=my-page\n```\n\n{% /tab %}\n\n{% tab label=\"New component\" %}\n\n```shell\nnx g @nx/nuxt:component --directory=my-app/src/components/my-cmp --name=my-cmp\n```\n\n{% /tab %}\n{% /tabs %}\n", "presets": [] }, diff --git a/docs/generated/packages/plugin/generators/create-package.json b/docs/generated/packages/plugin/generators/create-package.json index 63c1daa77d45c..41132b0b023b4 100644 --- a/docs/generated/packages/plugin/generators/create-package.json +++ b/docs/generated/packages/plugin/generators/create-package.json @@ -35,11 +35,6 @@ "type": "string", "description": "A directory where the app is placed." }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "linter": { "description": "The tool to use for running lint checks.", "type": "string", diff --git a/docs/generated/packages/plugin/generators/e2e-project.json b/docs/generated/packages/plugin/generators/e2e-project.json index 6956a0e498ffa..32c73bff79ba0 100644 --- a/docs/generated/packages/plugin/generators/e2e-project.json +++ b/docs/generated/packages/plugin/generators/e2e-project.json @@ -24,11 +24,6 @@ "type": "string", "description": "the directory where the plugin is placed." }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "pluginOutputPath": { "type": "string", "description": "the output path of the plugin after it builds.", diff --git a/docs/generated/packages/plugin/generators/plugin.json b/docs/generated/packages/plugin/generators/plugin.json index e48665c9a6c74..59dbf062793fb 100644 --- a/docs/generated/packages/plugin/generators/plugin.json +++ b/docs/generated/packages/plugin/generators/plugin.json @@ -15,22 +15,17 @@ } ], "properties": { - "name": { - "type": "string", - "description": "Plugin name", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the plugin?", - "x-priority": "important", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$" - }, "directory": { "type": "string", - "description": "A directory where the plugin is placed." + "description": "A directory where the plugin is placed.", + "$default": { "$source": "argv", "index": 0 }, + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the plugin in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { "type": "string", - "enum": ["as-provided", "derived"] + "description": "Plugin name", + "x-priority": "important" }, "importPath": { "type": "string", @@ -100,7 +95,7 @@ "default": false } }, - "required": ["name"], + "required": ["directory"], "presets": [] }, "description": "Create a Nx Plugin.", diff --git a/docs/generated/packages/react-native/generators/application.json b/docs/generated/packages/react-native/generators/application.json index bf6339be6147f..d9358b1145afa 100644 --- a/docs/generated/packages/react-native/generators/application.json +++ b/docs/generated/packages/react-native/generators/application.json @@ -19,26 +19,21 @@ ], "type": "object", "properties": { - "name": { - "description": "The name of the application.", + "directory": { + "description": "The directory of the new application.", "type": "string", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the application?", - "pattern": "^[a-zA-Z][^:]*$" + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "displayName": { - "description": "The display name to show in the application. Defaults to name.", + "name": { + "description": "The name of the application.", "type": "string" }, - "directory": { - "description": "The directory of the new application.", + "displayName": { + "description": "The display name to show in the application. Defaults to name.", "type": "string" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "skipFormat": { "description": "Skip formatting files", "type": "boolean", @@ -99,7 +94,7 @@ "x-priority": "important" } }, - "required": [], + "required": ["directory"], "presets": [] }, "aliases": ["app"], diff --git a/docs/generated/packages/react-native/generators/library.json b/docs/generated/packages/react-native/generators/library.json index 00e67ac13216b..754ffafd018e9 100644 --- a/docs/generated/packages/react-native/generators/library.json +++ b/docs/generated/packages/react-native/generators/library.json @@ -15,23 +15,18 @@ } ], "properties": { - "name": { - "type": "string", - "description": "Library name.", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$" - }, "directory": { "type": "string", "description": "A directory where the lib is placed.", "alias": "dir", - "x-priority": "important" + "$default": { "$source": "argv", "index": 0 }, + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the library in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { "type": "string", - "enum": ["as-provided", "derived"] + "description": "Library name.", + "x-priority": "important" }, "linter": { "description": "The tool to use for running lint checks.", @@ -97,7 +92,7 @@ "x-priority": "internal" } }, - "required": ["name"], + "required": ["directory"], "presets": [] }, "aliases": ["lib"], diff --git a/docs/generated/packages/react/generators/application.json b/docs/generated/packages/react/generators/application.json index 8052e62d02ce5..2e3a56e00661a 100644 --- a/docs/generated/packages/react/generators/application.json +++ b/docs/generated/packages/react/generators/application.json @@ -9,37 +9,32 @@ "description": "Create a React application for Nx.", "examples": [ { - "command": "nx g app myapp --directory=myorg", + "command": "nx g app apps/myorg/myapp", "description": "Generate `apps/myorg/myapp` and `apps/myorg/myapp-e2e`" }, { - "command": "nx g app myapp --classComponent", + "command": "nx g app apps/myapp --classComponent", "description": "Use class components instead of functional components" }, { - "command": "nx g app myapp --routing", + "command": "nx g app apps/myapp --routing", "description": "Set up React Router" } ], "type": "object", "properties": { - "name": { - "description": "The name of the application.", - "type": "string", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the application?", - "pattern": "^[a-zA-Z][^:]*$" - }, "directory": { "description": "The directory of the new application.", "type": "string", "alias": "dir", - "x-priority": "important" + "$default": { "$source": "argv", "index": 0 }, + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { + "description": "The name of the application.", "type": "string", - "enum": ["as-provided", "derived"] + "x-priority": "important" }, "style": { "description": "The file extension to be used for style files.", @@ -184,7 +179,7 @@ "default": false } }, - "required": ["name"], + "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 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 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 my-app --directory=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 my-app --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n", "presets": [] }, diff --git a/docs/generated/packages/react/generators/federate-module.json b/docs/generated/packages/react/generators/federate-module.json index 147ad0c03a7da..9a045541050f4 100644 --- a/docs/generated/packages/react/generators/federate-module.json +++ b/docs/generated/packages/react/generators/federate-module.json @@ -37,11 +37,6 @@ "description": "The directory of the new remote application if one needs to be created.", "type": "string" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "style": { "description": "The file extension to be used for style files.", "type": "string", diff --git a/docs/generated/packages/react/generators/host.json b/docs/generated/packages/react/generators/host.json index 56b555af58a9d..a161643476335 100644 --- a/docs/generated/packages/react/generators/host.json +++ b/docs/generated/packages/react/generators/host.json @@ -9,24 +9,18 @@ "description": "Create Module Federation configuration files for given React Host Application.", "type": "object", "properties": { - "name": { - "type": "string", - "description": "The name of the host application to generate the Module Federation configuration", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use as the host application?", - "pattern": "^[a-zA-Z][^:]*$", - "x-priority": "important" - }, "directory": { "description": "The directory of the new application.", "type": "string", "alias": "dir", - "x-priority": "important" + "$default": { "$source": "argv", "index": 0 }, + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { "type": "string", - "enum": ["as-provided", "derived"] + "description": "The name of the host application to generate the Module Federation configuration", + "x-priority": "important" }, "style": { "description": "The file extension to be used for style files.", @@ -181,7 +175,7 @@ "x-priority": "important" } }, - "required": ["name"], + "required": ["directory"], "additionalProperties": false, "presets": [] }, diff --git a/docs/generated/packages/react/generators/library.json b/docs/generated/packages/react/generators/library.json index 1509cb577fedf..8fa00442af58d 100644 --- a/docs/generated/packages/react/generators/library.json +++ b/docs/generated/packages/react/generators/library.json @@ -19,24 +19,18 @@ } ], "properties": { - "name": { - "type": "string", - "description": "Library name", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", - "x-priority": "important" - }, "directory": { "type": "string", "description": "A directory where the lib is placed.", "alias": "dir", - "x-priority": "important" + "$default": { "$source": "argv", "index": 0 }, + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the library in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { "type": "string", - "enum": ["as-provided", "derived"] + "description": "Library name", + "x-priority": "important" }, "style": { "description": "The file extension to be used for style files.", @@ -185,7 +179,7 @@ "default": false } }, - "required": ["name"], + "required": ["directory"], "presets": [] }, "aliases": ["lib"], diff --git a/docs/generated/packages/react/generators/remote.json b/docs/generated/packages/react/generators/remote.json index 576a47290fc0a..2b7127f9bfdd4 100644 --- a/docs/generated/packages/react/generators/remote.json +++ b/docs/generated/packages/react/generators/remote.json @@ -9,24 +9,18 @@ "description": "Create Module Federation configuration files for given React Remote Application.", "type": "object", "properties": { - "name": { - "type": "string", - "description": "The name of the remote application to generate the Module Federation configuration", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use as the remote application?", - "pattern": "^[a-zA-Z][^:]*$", - "x-priority": "important" - }, "directory": { "description": "The directory of the new application.", "type": "string", "alias": "dir", - "x-priority": "important" + "$default": { "$source": "argv", "index": 0 }, + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { "type": "string", - "enum": ["as-provided", "derived"] + "description": "The name of the remote application to generate the Module Federation configuration", + "x-priority": "important" }, "dynamic": { "type": "boolean", @@ -180,7 +174,7 @@ "x-priority": "important" } }, - "required": ["name"], + "required": ["directory"], "additionalProperties": false, "presets": [] }, diff --git a/docs/generated/packages/remix/generators/application.json b/docs/generated/packages/remix/generators/application.json index 9ca0db27d70f9..431fe31f8d75e 100644 --- a/docs/generated/packages/remix/generators/application.json +++ b/docs/generated/packages/remix/generators/application.json @@ -8,28 +8,23 @@ "description": "Generate a new Remix application.", "type": "object", "properties": { - "name": { + "directory": { "type": "string", - "description": "", + "description": "A directory where the app is placed.", + "alias": "dir", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What is the name of the application?" + "x-prompt": "Which directory do you want to create the application in?" + }, + "name": { + "type": "string", + "description": "The name of the application.", + "x-priority": "important" }, "js": { "type": "boolean", "description": "Generate JavaScript files rather than TypeScript files.", "default": false }, - "directory": { - "type": "string", - "description": "A directory where the app is placed.", - "alias": "dir", - "x-priority": "important" - }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "linter": { "description": "The tool to use for running lint checks.", "type": "string", @@ -66,6 +61,7 @@ "default": false } }, + "required": ["directory"], "presets": [] }, "description": "Generate a new Remix application", diff --git a/docs/generated/packages/remix/generators/library.json b/docs/generated/packages/remix/generators/library.json index 4a4b6dc7708e8..234fe3995ea63 100644 --- a/docs/generated/packages/remix/generators/library.json +++ b/docs/generated/packages/remix/generators/library.json @@ -14,23 +14,18 @@ } ], "properties": { - "name": { - "type": "string", - "description": "Library name", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "^[a-zA-Z].*$" - }, "directory": { "type": "string", "description": "A directory where the lib is placed.", "alias": "dir", - "x-priority": "important" + "$default": { "$source": "argv", "index": 0 }, + "pattern": "^[a-zA-Z].*$", + "x-prompt": "Which directory do you want to create the library in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { "type": "string", - "enum": ["as-provided", "derived"] + "description": "Library name", + "x-priority": "important" }, "tags": { "type": "string", @@ -70,7 +65,7 @@ "x-priority": "internal" } }, - "required": ["name"], + "required": ["directory"], "presets": [] }, "description": "Generate a new library", diff --git a/docs/generated/packages/storybook/generators/cypress-project.json b/docs/generated/packages/storybook/generators/cypress-project.json index 6ad6af0e5ff60..38fd06719f4b6 100644 --- a/docs/generated/packages/storybook/generators/cypress-project.json +++ b/docs/generated/packages/storybook/generators/cypress-project.json @@ -44,11 +44,6 @@ "type": "boolean", "default": false, "x-priority": "internal" - }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] } }, "required": ["name"], diff --git a/docs/generated/packages/vue/generators/application.json b/docs/generated/packages/vue/generators/application.json index 27b8189f4ad55..a39009f5e72c6 100644 --- a/docs/generated/packages/vue/generators/application.json +++ b/docs/generated/packages/vue/generators/application.json @@ -19,23 +19,18 @@ ], "type": "object", "properties": { - "name": { - "description": "The name of the application.", - "type": "string", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the application?", - "pattern": "^[a-zA-Z][^:]*$" - }, "directory": { "description": "The directory of the new application.", "type": "string", "alias": "dir", - "x-priority": "important" + "$default": { "$source": "argv", "index": 0 }, + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { + "description": "The name of the application.", "type": "string", - "enum": ["as-provided", "derived"] + "x-priority": "important" }, "style": { "description": "The file extension to be used for style files.", @@ -129,7 +124,7 @@ "hidden": true } }, - "required": ["name"], + "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 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 my-app --directory=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 my-app --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n", "presets": [] }, diff --git a/docs/generated/packages/vue/generators/library.json b/docs/generated/packages/vue/generators/library.json index 9635e3ac10fa8..e8d3dd09f071b 100644 --- a/docs/generated/packages/vue/generators/library.json +++ b/docs/generated/packages/vue/generators/library.json @@ -19,24 +19,18 @@ } ], "properties": { - "name": { - "type": "string", - "description": "Library name", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", - "x-priority": "important" - }, "directory": { "type": "string", "description": "A directory where the lib is placed.", "alias": "dir", - "x-priority": "important" + "$default": { "$source": "argv", "index": 0 }, + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the library in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { "type": "string", - "enum": ["as-provided", "derived"] + "description": "Library name", + "x-priority": "important" }, "linter": { "description": "The tool to use for running lint checks.", @@ -129,7 +123,7 @@ "default": false } }, - "required": ["name"], + "required": ["directory"], "presets": [] }, "aliases": ["lib"], diff --git a/docs/generated/packages/web/generators/application.json b/docs/generated/packages/web/generators/application.json index 94d166cd45a83..eda727628aace 100644 --- a/docs/generated/packages/web/generators/application.json +++ b/docs/generated/packages/web/generators/application.json @@ -9,21 +9,17 @@ "description": "Create a web application using `swc` or `babel` as compiler.", "type": "object", "properties": { - "name": { - "description": "The name of the application.", - "type": "string", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the application?", - "pattern": "^[a-zA-Z][^:]*$" - }, "directory": { "description": "The directory of the new application.", - "type": "string" + "type": "string", + "$default": { "$source": "argv", "index": 0 }, + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { + "description": "The name of the application.", "type": "string", - "enum": ["as-provided", "derived"] + "x-priority": "important" }, "style": { "description": "The file extension to be used for style files.", @@ -110,7 +106,7 @@ "x-deprecated": "Nx only supports standaloneConfig" } }, - "required": ["name"], + "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 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 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 my-app --directory=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 my-app --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n", "presets": [] }, diff --git a/docs/generated/packages/workspace/generators/move.json b/docs/generated/packages/workspace/generators/move.json index 7b7675c53a2ef..44d0664e7e7f2 100644 --- a/docs/generated/packages/workspace/generators/move.json +++ b/docs/generated/packages/workspace/generators/move.json @@ -33,11 +33,6 @@ "description": "The folder to move the project into.", "$default": { "$source": "argv", "index": 0 } }, - "projectNameAndRootFormat": { - "description": "Whether to generate the new project name and destination as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "importPath": { "type": "string", "description": "The new import path to use in the `tsconfig.base.json`." diff --git a/docs/generated/packages/workspace/generators/npm-package.json b/docs/generated/packages/workspace/generators/npm-package.json index 62a4d8f769533..626b9f292b5a5 100644 --- a/docs/generated/packages/workspace/generators/npm-package.json +++ b/docs/generated/packages/workspace/generators/npm-package.json @@ -9,25 +9,17 @@ "cli": "nx", "type": "object", "properties": { - "name": { - "type": "string", - "description": "Package name.", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name of your npm package?", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$" - }, "directory": { "type": "string", "description": "A directory where the package is placed.", - "alias": "dir" + "alias": "dir", + "$default": { "$source": "argv", "index": 0 }, + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the package in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - } + "name": { "type": "string", "description": "Package name." } }, - "required": ["name"], + "required": ["directory"], "presets": [] }, "description": "Create a minimal NPM package.", diff --git a/docs/shared/recipes/module-federation/federate-a-module.md b/docs/shared/recipes/module-federation/federate-a-module.md index 0d7958c84610b..9d11377f1bb66 100644 --- a/docs/shared/recipes/module-federation/federate-a-module.md +++ b/docs/shared/recipes/module-federation/federate-a-module.md @@ -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 --name=hello --unitTestRunner=jest --projectNameAndRootFormat=as-provided +nx generate @nx/js:library --name=hello --unitTestRunner=jest ``` Update the `hello.ts` file with the following code: @@ -46,14 +46,14 @@ Now that we have created the module, we need to configure it to be federated. {%tab label="React"%} ```shell -nx generate @nx/react:federate-module hello/src/index.ts --name=hello --remote=greeting --projectNameAndRootFormat=as-provided +nx generate @nx/react:federate-module hello/src/index.ts --name=hello --remote=greeting ``` {% /tab %} {%tab label="Angular"%} ```shell -nx generate @nx/angular:federate-module hello/src/index.ts --name=hello --remote=greeting --projectNameAndRootFormat=as-provided +nx generate @nx/angular:federate-module hello/src/index.ts --name=hello --remote=greeting ``` {% /tab %} diff --git a/docs/shared/recipes/storybook/one-storybook-for-all.md b/docs/shared/recipes/storybook/one-storybook-for-all.md index bb57be27b6bf6..df28da83592df 100644 --- a/docs/shared/recipes/storybook/one-storybook-for-all.md +++ b/docs/shared/recipes/storybook/one-storybook-for-all.md @@ -25,7 +25,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d {% /callout %} ```shell -nx g @nx/react:library storybook-host --directory=libs/storybook-host --bundler=none --unitTestRunner=none --projectNameAndRootFormat=as-provided +nx g @nx/react:library storybook-host --directory=libs/storybook-host --bundler=none --unitTestRunner=none ``` Now, you have a new library, which will act as a shell/host for all your stories. diff --git a/docs/shared/recipes/storybook/one-storybook-per-scope.md b/docs/shared/recipes/storybook/one-storybook-per-scope.md index ce14e8330495c..76e479d30b924 100644 --- a/docs/shared/recipes/storybook/one-storybook-per-scope.md +++ b/docs/shared/recipes/storybook/one-storybook-per-scope.md @@ -91,15 +91,15 @@ The commands below uses the `as-provided` directory flag behavior, which is the {% /callout %} ```shell -nx g @nx/angular:lib storybook-host-client --directory=libs/storybook-host-client --projectNameAndRootFormat=as-provided +nx g @nx/angular:lib storybook-host-client --directory=libs/storybook-host-client ``` ```shell -nx g @nx/angular:lib storybook-host-admin --directory=libs/storybook-host-admin --projectNameAndRootFormat=as-provided +nx g @nx/angular:lib storybook-host-admin --directory=libs/storybook-host-admin ``` ```shell -nx g @nx/angular:lib storybook-host-shared --directory=libs/storybook-host-shared --projectNameAndRootFormat=as-provided +nx g @nx/angular:lib storybook-host-shared --directory=libs/storybook-host-shared ``` ### Generate the Storybook configuration for the libraries diff --git a/docs/shared/recipes/storybook/one-storybook-with-composition.md b/docs/shared/recipes/storybook/one-storybook-with-composition.md index 76fb4e50fd476..b9329d139d46b 100644 --- a/docs/shared/recipes/storybook/one-storybook-with-composition.md +++ b/docs/shared/recipes/storybook/one-storybook-with-composition.md @@ -35,7 +35,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d So, let’s use React for the Storybook Composition host library: ```shell -nx g @nx/react:lib storybook-host --directory=libs/storybook-host --bundler=none --unitTestRunner=none --projectNameAndRootFormat=as-provided +nx g @nx/react:lib storybook-host --directory=libs/storybook-host --bundler=none --unitTestRunner=none ``` Now that your library is generated, you can write your intro in the generated component (you can also do this later, it does not matter). diff --git a/e2e/angular/src/module-federation.test.ts b/e2e/angular/src/module-federation.test.ts index deaaa562c2a1f..a7a4174ddd8c5 100644 --- a/e2e/angular/src/module-federation.test.ts +++ b/e2e/angular/src/module-federation.test.ts @@ -283,12 +283,10 @@ test('renders remotes', async ({ page }) => { const hostPort = 4200; runCLI( - `generate @nx/angular:host ${host} --remotes=${remote} --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided` + `generate @nx/angular:host ${host} --remotes=${remote} --e2eTestRunner=cypress --no-interactive` ); - runCLI( - `generate @nx/js:lib ${lib} --no-interactive --projectNameAndRootFormat=as-provided` - ); + runCLI(`generate @nx/js:lib ${lib} --no-interactive`); // Federate Module runCLI( @@ -357,12 +355,10 @@ test('renders remotes', async ({ page }) => { const hostPort = 4200; runCLI( - `generate @nx/angular:host ${host} --remotes=${remote} --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided` + `generate @nx/angular:host ${host} --remotes=${remote} --e2eTestRunner=cypress --no-interactive` ); - runCLI( - `generate @nx/js:lib ${lib} --no-interactive --projectNameAndRootFormat=as-provided` - ); + runCLI(`generate @nx/js:lib ${lib} --no-interactive`); // Federate Module runCLI( diff --git a/e2e/angular/src/plugin.test.ts b/e2e/angular/src/plugin.test.ts index bf9b2e1910930..dc80e58868130 100644 --- a/e2e/angular/src/plugin.test.ts +++ b/e2e/angular/src/plugin.test.ts @@ -25,7 +25,6 @@ describe('Angular Crystal Plugin', () => { beforeAll(() => { proj = newProject({ packages: ['@nx/angular'], - unsetProjectNameAndRootFormat: false, }); if (getSelectedPackageManager() === 'pnpm') { diff --git a/e2e/cypress/src/cypress.test.ts b/e2e/cypress/src/cypress.test.ts index e8e65d391143b..4e25de1e2d7d9 100644 --- a/e2e/cypress/src/cypress.test.ts +++ b/e2e/cypress/src/cypress.test.ts @@ -155,7 +155,7 @@ export default defineConfig({ async () => { const appName = uniq('next-cy-app'); runCLI( - `generate @nx/next:app ${appName} --directory=apps/${appName} --e2eTestRunner=none --no-interactive --projectNameAndRootFormat=as-provided` + `generate @nx/next:app ${appName} --directory=apps/${appName} --e2eTestRunner=none --no-interactive ` ); runCLI( `generate @nx/next:component btn --project=${appName} --directory=apps/${appName}/components --nameAndDirectoryFormat=as-provided --no-interactive` diff --git a/e2e/eslint/src/linter-legacy.test.ts b/e2e/eslint/src/linter-legacy.test.ts index 5402d9118374e..a496dad57a52d 100644 --- a/e2e/eslint/src/linter-legacy.test.ts +++ b/e2e/eslint/src/linter-legacy.test.ts @@ -138,18 +138,12 @@ describe('Linter (legacy)', () => { bundler: 'vite', e2eTestRunner: 'none', }); - runCLI( - `generate @nx/js:lib ${mylib} --directory libs/${mylib} --projectNameAndRootFormat as-provided`, - { - env: { NX_ADD_PLUGINS: 'false' }, - } - ); - runCLI( - `generate @nx/js:lib ${mylib2} --directory libs/${mylib2} --projectNameAndRootFormat as-provided`, - { - env: { NX_ADD_PLUGINS: 'false' }, - } - ); + runCLI(`generate @nx/js:lib ${mylib} --directory libs/${mylib}`, { + env: { NX_ADD_PLUGINS: 'false' }, + }); + runCLI(`generate @nx/js:lib ${mylib2} --directory libs/${mylib2}`, { + env: { NX_ADD_PLUGINS: 'false' }, + }); // migrate to flat structure runCLI(`generate @nx/eslint:convert-to-flat-config`, { diff --git a/e2e/eslint/src/linter.test.ts b/e2e/eslint/src/linter.test.ts index 84f00c9b6ce09..9aa666642257c 100644 --- a/e2e/eslint/src/linter.test.ts +++ b/e2e/eslint/src/linter.test.ts @@ -602,12 +602,8 @@ describe('Linter', () => { const reactLib = uniq('react-lib'); const jsLib = uniq('js-lib'); - runCLI( - `generate @nx/react:lib ${reactLib} --directory=${reactLib} --projectNameAndRootFormat=as-provided` - ); - runCLI( - `generate @nx/js:lib ${jsLib} --directory=${jsLib} --projectNameAndRootFormat=as-provided` - ); + runCLI(`generate @nx/react:lib ${reactLib} --directory=${reactLib}`); + runCLI(`generate @nx/js:lib ${jsLib} --directory=${jsLib}`); checkFilesExist( `${reactLib}/eslint.config.js`, diff --git a/e2e/gradle/src/gradle-import.test.ts b/e2e/gradle/src/gradle-import.test.ts index 6f618d8cbc819..18f14d75d6a70 100644 --- a/e2e/gradle/src/gradle-import.test.ts +++ b/e2e/gradle/src/gradle-import.test.ts @@ -22,7 +22,6 @@ describe('Nx Import Gradle', () => { beforeAll(() => { proj = newProject({ packages: ['@nx/js'], - unsetProjectNameAndRootFormat: false, }); if (getSelectedPackageManager() === 'pnpm') { diff --git a/e2e/jest/src/jest-root.test.ts b/e2e/jest/src/jest-root.test.ts index 151c9eba6673b..c58a06ac370d5 100644 --- a/e2e/jest/src/jest-root.test.ts +++ b/e2e/jest/src/jest-root.test.ts @@ -8,10 +8,9 @@ describe('Jest root projects', () => { beforeAll(() => { newProject({ packages: ['@nx/angular'], - unsetProjectNameAndRootFormat: false, }); runCLI( - `generate @nx/angular:app ${myapp} --directory . --rootProject --projectNameAndRootFormat as-provided --no-interactive` + `generate @nx/angular:app ${myapp} --directory . --rootProject --no-interactive` ); }); @@ -20,9 +19,7 @@ describe('Jest root projects', () => { }, 300_000); it('should add lib project and tests should still work', async () => { - runCLI( - `generate @nx/angular:lib ${mylib} --projectNameAndRootFormat as-provided --no-interactive` - ); + runCLI(`generate @nx/angular:lib ${mylib} --no-interactive`); expect(() => runCLI(`test ${mylib}`)).not.toThrow(); expect(() => runCLI(`test ${myapp}`)).not.toThrow(); @@ -33,11 +30,8 @@ describe('Jest root projects', () => { beforeAll(() => { newProject({ packages: ['@nx/react'], - unsetProjectNameAndRootFormat: false, }); - runCLI( - `generate @nx/react:app ${myapp} --directory . --rootProject --projectNameAndRootFormat as-provided` - ); + runCLI(`generate @nx/react:app ${myapp} --directory . --rootProject`); }); it('should test root level app projects', async () => { @@ -45,9 +39,7 @@ describe('Jest root projects', () => { }, 300_000); it('should add lib project and tests should still work', async () => { - runCLI( - `generate @nx/react:lib ${mylib} --unitTestRunner=jest --projectNameAndRootFormat as-provided` - ); + runCLI(`generate @nx/react:lib ${mylib} --unitTestRunner=jest`); expect(() => runCLI(`test ${mylib}`)).not.toThrow(); expect(() => runCLI(`test ${myapp}`)).not.toThrow(); diff --git a/e2e/next/src/next-component-tests.test.ts b/e2e/next/src/next-component-tests.test.ts index 9f7e4a619fd57..fe3a993264062 100644 --- a/e2e/next/src/next-component-tests.test.ts +++ b/e2e/next/src/next-component-tests.test.ts @@ -118,7 +118,7 @@ function addBabelSupport(path: string) { function createAppWithCt(appName: string) { runCLI( - `generate @nx/next:app ${appName} --directory=apps/${appName} --no-interactive --appDir=false --src=false --projectNameAndRootFormat=as-provided` + `generate @nx/next:app ${appName} --directory=apps/${appName} --no-interactive --appDir=false --src=false` ); runCLI( `generate @nx/next:component button --project=${appName} --directory=apps/${appName}/components --nameAndDirectoryFormat=as-provided --no-interactive` @@ -213,9 +213,7 @@ export default Button; } function createLibWithCtCypress(libName: string) { - runCLI( - `generate @nx/next:lib ${libName} --no-interactive --projectNameAndRootFormat=as-provided` - ); + runCLI(`generate @nx/next:lib ${libName} --no-interactive`); runCLI( `generate @nx/next:cypress-component-configuration --project=${libName} --no-interactive` diff --git a/e2e/next/src/next-playwright.test.ts b/e2e/next/src/next-playwright.test.ts index 30d3dc16632a3..833012b77d2f9 100644 --- a/e2e/next/src/next-playwright.test.ts +++ b/e2e/next/src/next-playwright.test.ts @@ -18,7 +18,7 @@ describe('Next Playwright e2e tests', () => { packages: ['@nx/next'], }); runCLI( - `generate @nx/next:app ${appName} --e2eTestRunner=playwright --projectNameAndRootFormat=as-provided --no-interactive` + `generate @nx/next:app ${appName} --e2eTestRunner=playwright --no-interactive` ); }); @@ -35,7 +35,7 @@ describe('Next Playwright e2e tests', () => { it('should execute e2e tests using playwright with a library used in the app', () => { runCLI( - `generate @nx/js:library ${usedInAppLibName} --unitTestRunner=none --importPath=@mylib --projectNameAndRootFormat=as-provided --no-interactive` + `generate @nx/js:library ${usedInAppLibName} --unitTestRunner=none --importPath=@mylib --no-interactive` ); updateFile( diff --git a/e2e/nuxt/src/nuxt.test.ts b/e2e/nuxt/src/nuxt.test.ts index ad44b51c6b240..62771273ec398 100644 --- a/e2e/nuxt/src/nuxt.test.ts +++ b/e2e/nuxt/src/nuxt.test.ts @@ -14,10 +14,9 @@ describe('Nuxt Plugin', () => { beforeAll(() => { newProject({ packages: ['@nx/nuxt'], - unsetProjectNameAndRootFormat: false, }); runCLI( - `generate @nx/nuxt:app ${app} --unitTestRunner=vitest --projectNameAndRootFormat=as-provided --e2eTestRunner=cypress` + `generate @nx/nuxt:app ${app} --unitTestRunner=vitest --e2eTestRunner=cypress` ); runCLI( `generate @nx/nuxt:component --directory=${app}/src/components/one --name=one --nameAndDirectoryFormat=as-provided --unitTestRunner=vitest` diff --git a/e2e/nx/src/import.test.ts b/e2e/nx/src/import.test.ts index 116839a5ee4ae..1ede6f69683bb 100644 --- a/e2e/nx/src/import.test.ts +++ b/e2e/nx/src/import.test.ts @@ -19,7 +19,6 @@ describe('Nx Import', () => { beforeAll(() => { proj = newProject({ packages: ['@nx/js'], - unsetProjectNameAndRootFormat: false, }); if (getSelectedPackageManager() === 'pnpm') { diff --git a/e2e/nx/src/nx-cloud.test.ts b/e2e/nx/src/nx-cloud.test.ts index 6ae66cff749b8..34d7e357b9864 100644 --- a/e2e/nx/src/nx-cloud.test.ts +++ b/e2e/nx/src/nx-cloud.test.ts @@ -3,7 +3,6 @@ import { cleanupProject, newProject, runCLI } from '@nx/e2e/utils'; describe('Nx Cloud', () => { beforeAll(() => newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/js'], }) ); diff --git a/e2e/playwright/src/playwright.test.ts b/e2e/playwright/src/playwright.test.ts index 62c54b1e2f5d1..93dc170f433c9 100644 --- a/e2e/playwright/src/playwright.test.ts +++ b/e2e/playwright/src/playwright.test.ts @@ -76,7 +76,6 @@ describe('Playwright E2E Test Runner - legacy', () => { env = process.env.NX_ADD_PLUGINS; newProject({ name: uniq('playwright'), - unsetProjectNameAndRootFormat: false, }); process.env.NX_ADD_PLUGINS = 'false'; }); @@ -98,7 +97,7 @@ describe('Playwright E2E Test Runner - legacy', () => { const pmc = getPackageManagerCommand(); runCLI( - `g @nx/web:app demo-e2e --directory apps/demo-e2e --unitTestRunner=none --bundler=vite --e2eTestRunner=none --style=css --no-interactive --projectNameAndRootFormat=as-provided` + `g @nx/web:app demo-e2e --directory apps/demo-e2e --unitTestRunner=none --bundler=vite --e2eTestRunner=none --style=css --no-interactive` ); runCLI( `g @nx/playwright:configuration --project demo-e2e --webServerCommand="${pmc.runNx} serve demo-e2e" --webServerAddress="http://localhost:4200"` @@ -121,7 +120,7 @@ describe('Playwright E2E Test Runner - legacy', () => { const pmc = getPackageManagerCommand(); runCLI( - `g @nx/web:app demo-js-e2e --directory apps/demo-js-e2e --unitTestRunner=none --bundler=vite --e2eTestRunner=none --style=css --no-interactive --projectNameAndRootFormat=as-provided` + `g @nx/web:app demo-js-e2e --directory apps/demo-js-e2e --unitTestRunner=none --bundler=vite --e2eTestRunner=none --style=css --no-interactive` ); runCLI( `g @nx/playwright:configuration --project demo-js-e2e --js --webServerCommand="${pmc.runNx} serve demo-e2e" --webServerAddress="http://localhost:4200"` diff --git a/e2e/react/src/playwright.test.ts b/e2e/react/src/playwright.test.ts index 9bd7894c96664..4686d33163a3e 100644 --- a/e2e/react/src/playwright.test.ts +++ b/e2e/react/src/playwright.test.ts @@ -18,7 +18,7 @@ describe('React Playwright e2e tests', () => { packages: ['@nx/react'], }); runCLI( - `generate @nx/react:app ${appName} --e2eTestRunner=playwright --bundler=vite --projectNameAndRootFormat=as-provided --no-interactive` + `generate @nx/react:app ${appName} --e2eTestRunner=playwright --bundler=vite --no-interactive` ); }); @@ -35,7 +35,7 @@ describe('React Playwright e2e tests', () => { it('should execute e2e tests using playwright with a library used in the app', () => { runCLI( - `generate @nx/js:library ${usedInAppLibName} --unitTestRunner=none --importPath=@mylib --projectNameAndRootFormat=as-provided --no-interactive` + `generate @nx/js:library ${usedInAppLibName} --unitTestRunner=none --importPath=@mylib --no-interactive` ); updateFile( diff --git a/e2e/react/src/react-module-federation.rspack.test.ts b/e2e/react/src/react-module-federation.rspack.test.ts index 40b03d3bee57f..6a5003e2f4b10 100644 --- a/e2e/react/src/react-module-federation.rspack.test.ts +++ b/e2e/react/src/react-module-federation.rspack.test.ts @@ -494,12 +494,10 @@ describe('React Rspack Module Federation', () => { const host = uniq('host'); runCLI( - `generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --skipFormat` + `generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --skipFormat` ); - runCLI( - `generate @nx/js:lib ${lib} --no-interactive --projectNameAndRootFormat=as-provided --skipFormat` - ); + runCLI(`generate @nx/js:lib ${lib} --no-interactive --skipFormat`); // Federate Module runCLI( @@ -595,12 +593,10 @@ describe('React Rspack Module Federation', () => { const host = uniq('host'); runCLI( - `generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --skipFormat` + `generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --skipFormat` ); - runCLI( - `generate @nx/js:lib ${lib} --no-interactive --projectNameAndRootFormat=as-provided --skipFormat` - ); + runCLI(`generate @nx/js:lib ${lib} --no-interactive --skipFormat`); // Federate Module runCLI( @@ -703,7 +699,7 @@ describe('React Rspack Module Federation', () => { const host = uniq('host'); runCLI( - `generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --typescriptConfiguration=false --skipFormat` + `generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --typescriptConfiguration=false --skipFormat` ); // Update remote to be loaded via script @@ -837,11 +833,11 @@ describe('React Rspack Module Federation', () => { const lib = uniq('lib'); runCLI( - `generate @nx/react:host ${shell} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --skipFormat` + `generate @nx/react:host ${shell} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --skipFormat` ); runCLI( - `generate @nx/js:lib ${lib} --importPath=@acme/${lib} --publishable=true --no-interactive --projectNameAndRootFormat=as-provided --skipFormat` + `generate @nx/js:lib ${lib} --importPath=@acme/${lib} --publishable=true --no-interactive --skipFormat` ); const shellPort = readPort(shell); diff --git a/e2e/react/src/react-module-federation.test.ts b/e2e/react/src/react-module-federation.test.ts index 2dd9130991f11..d59714a61db99 100644 --- a/e2e/react/src/react-module-federation.test.ts +++ b/e2e/react/src/react-module-federation.test.ts @@ -368,12 +368,10 @@ describe('React Module Federation', () => { const host = uniq('host'); runCLI( - `generate @nx/react:host ${host} --bundler=webpack --remotes=${remote} --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --skipFormat` + `generate @nx/react:host ${host} --bundler=webpack --remotes=${remote} --e2eTestRunner=cypress --no-interactive --skipFormat` ); - runCLI( - `generate @nx/js:lib ${lib} --no-interactive --projectNameAndRootFormat=as-provided --skipFormat` - ); + runCLI(`generate @nx/js:lib ${lib} --no-interactive --skipFormat`); // Federate Module runCLI( @@ -469,12 +467,10 @@ describe('React Module Federation', () => { const host = uniq('host'); runCLI( - `generate @nx/react:host ${host} --remotes=${remote} --bundler=webpack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --skipFormat` + `generate @nx/react:host ${host} --remotes=${remote} --bundler=webpack --e2eTestRunner=cypress --no-interactive --skipFormat` ); - runCLI( - `generate @nx/js:lib ${lib} --no-interactive --projectNameAndRootFormat=as-provided --skipFormat` - ); + runCLI(`generate @nx/js:lib ${lib} --no-interactive --skipFormat`); // Federate Module runCLI( @@ -577,7 +573,7 @@ describe('React Module Federation', () => { const host = uniq('host'); runCLI( - `generate @nx/react:host ${host} --remotes=${remote} --bundler=webpack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --typescriptConfiguration=false --skipFormat` + `generate @nx/react:host ${host} --remotes=${remote} --bundler=webpack --e2eTestRunner=cypress --no-interactive --typescriptConfiguration=false --skipFormat` ); // Update remote to be loaded via script @@ -711,11 +707,11 @@ describe('React Module Federation', () => { const lib = uniq('lib'); runCLI( - `generate @nx/react:host ${shell} --remotes=${remote} --bundler=webpack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --skipFormat` + `generate @nx/react:host ${shell} --remotes=${remote} --bundler=webpack --e2eTestRunner=cypress --no-interactive --skipFormat` ); runCLI( - `generate @nx/js:lib ${lib} --importPath=@acme/${lib} --publishable=true --no-interactive --projectNameAndRootFormat=as-provided --skipFormat` + `generate @nx/js:lib ${lib} --importPath=@acme/${lib} --publishable=true --no-interactive --skipFormat` ); const shellPort = readPort(shell); diff --git a/e2e/release/src/circular-dependencies.test.ts b/e2e/release/src/circular-dependencies.test.ts index 6d858e94ce9b0..7e5556225bd79 100644 --- a/e2e/release/src/circular-dependencies.test.ts +++ b/e2e/release/src/circular-dependencies.test.ts @@ -50,7 +50,6 @@ describe('nx release circular dependencies', () => { beforeAll(async () => { newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/js'], }); diff --git a/e2e/release/src/conventional-commits-config.test.ts b/e2e/release/src/conventional-commits-config.test.ts index a8e3e8b8c79eb..1f081101bbae2 100644 --- a/e2e/release/src/conventional-commits-config.test.ts +++ b/e2e/release/src/conventional-commits-config.test.ts @@ -50,7 +50,6 @@ describe('nx release conventional commits config', () => { beforeAll(async () => { newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/js'], }); diff --git a/e2e/release/src/create-github-release.test.ts b/e2e/release/src/create-github-release.test.ts index de6c4cfe0f291..c00c90c652686 100644 --- a/e2e/release/src/create-github-release.test.ts +++ b/e2e/release/src/create-github-release.test.ts @@ -46,7 +46,6 @@ describe('nx release create github release', () => { beforeAll(async () => { newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/js'], }); diff --git a/e2e/release/src/custom-registries.test.ts b/e2e/release/src/custom-registries.test.ts index e273b81bcee1b..3afd01b5f5f8f 100644 --- a/e2e/release/src/custom-registries.test.ts +++ b/e2e/release/src/custom-registries.test.ts @@ -24,7 +24,6 @@ describe('nx release - custom npm registries', () => { // We are testing some more advanced scoped registry features that only npm has within this file process.env.SELECTED_PM = 'npm'; newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/js'], }); }, 60000); diff --git a/e2e/release/src/first-release.test.ts b/e2e/release/src/first-release.test.ts index 86f35fbd799fa..653104a76ea62 100644 --- a/e2e/release/src/first-release.test.ts +++ b/e2e/release/src/first-release.test.ts @@ -46,7 +46,6 @@ describe('nx release first run', () => { beforeAll(async () => { newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/js'], }); diff --git a/e2e/release/src/independent-projects.test.ts b/e2e/release/src/independent-projects.test.ts index 16f547da391d0..80196a8402de6 100644 --- a/e2e/release/src/independent-projects.test.ts +++ b/e2e/release/src/independent-projects.test.ts @@ -65,7 +65,6 @@ describe('nx release - independent projects', () => { beforeAll(() => { newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/js'], }); diff --git a/e2e/release/src/lock-file-updates.test.ts b/e2e/release/src/lock-file-updates.test.ts index 55da4e278105a..28fc24633ffe7 100644 --- a/e2e/release/src/lock-file-updates.test.ts +++ b/e2e/release/src/lock-file-updates.test.ts @@ -58,7 +58,6 @@ describe('nx release lock file updates', () => { process.env.SELECTED_PM = packageManager; newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/js'], packageManager, }); diff --git a/e2e/release/src/multiple-release-branches.test.ts b/e2e/release/src/multiple-release-branches.test.ts index 18935443ef65e..0c2a2ea257db2 100644 --- a/e2e/release/src/multiple-release-branches.test.ts +++ b/e2e/release/src/multiple-release-branches.test.ts @@ -61,7 +61,6 @@ describe('nx release multiple release branches', () => { beforeEach(() => { newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/js'], }); diff --git a/e2e/release/src/nx-release-git-operations.test.ts b/e2e/release/src/nx-release-git-operations.test.ts index dfa34edcbc728..1ac784ccdbbd1 100644 --- a/e2e/release/src/nx-release-git-operations.test.ts +++ b/e2e/release/src/nx-release-git-operations.test.ts @@ -46,7 +46,6 @@ describe('nx release git operations', () => { beforeAll(async () => { newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/js'], }); diff --git a/e2e/release/src/pre-version-command.test.ts b/e2e/release/src/pre-version-command.test.ts index 5dbab07f15768..de2f449293a41 100644 --- a/e2e/release/src/pre-version-command.test.ts +++ b/e2e/release/src/pre-version-command.test.ts @@ -42,7 +42,6 @@ describe('nx release pre-version command', () => { beforeAll(() => { newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/js'], }); diff --git a/e2e/release/src/private-js-packages.test.ts b/e2e/release/src/private-js-packages.test.ts index d095fd43537b0..47351dc545dd2 100644 --- a/e2e/release/src/private-js-packages.test.ts +++ b/e2e/release/src/private-js-packages.test.ts @@ -47,7 +47,6 @@ describe('nx release - private JS packages', () => { beforeAll(() => { newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/js'], }); diff --git a/e2e/release/src/release.test.ts b/e2e/release/src/release.test.ts index 9d5bae1dc2f88..62db28b99b9ff 100644 --- a/e2e/release/src/release.test.ts +++ b/e2e/release/src/release.test.ts @@ -53,7 +53,6 @@ describe('nx release', () => { beforeAll(() => { newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/js'], }); diff --git a/e2e/release/src/version-plans-check.test.ts b/e2e/release/src/version-plans-check.test.ts index d93093d8b0102..f42c90422ed72 100644 --- a/e2e/release/src/version-plans-check.test.ts +++ b/e2e/release/src/version-plans-check.test.ts @@ -52,7 +52,6 @@ describe('nx release version plans check command', () => { beforeEach(async () => { newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/js'], }); diff --git a/e2e/release/src/version-plans-only-touched.test.ts b/e2e/release/src/version-plans-only-touched.test.ts index afad362d641f3..ec193dae4ed84 100644 --- a/e2e/release/src/version-plans-only-touched.test.ts +++ b/e2e/release/src/version-plans-only-touched.test.ts @@ -49,7 +49,6 @@ describe('nx release version plans only touched', () => { beforeEach(async () => { newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/js'], }); diff --git a/e2e/release/src/version-plans.test.ts b/e2e/release/src/version-plans.test.ts index e8d2a7cf00af1..c94bf7a72df09 100644 --- a/e2e/release/src/version-plans.test.ts +++ b/e2e/release/src/version-plans.test.ts @@ -54,7 +54,6 @@ describe('nx release version plans', () => { beforeEach(async () => { newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/js'], }); diff --git a/e2e/remix/src/nx-remix.test.ts b/e2e/remix/src/nx-remix.test.ts index 88da1de8d1ca2..d3d433e00a946 100644 --- a/e2e/remix/src/nx-remix.test.ts +++ b/e2e/remix/src/nx-remix.test.ts @@ -26,9 +26,7 @@ describe('Remix E2E Tests', () => { it('should not cause peer dependency conflicts', async () => { const plugin = uniq('remix'); - runCLI( - `generate @nx/remix:app ${plugin} --projectNameAndRootFormat=as-provided` - ); + runCLI(`generate @nx/remix:app ${plugin}`); await runCommandAsync('npm install'); }, 120000); @@ -55,10 +53,10 @@ describe('Remix E2E Tests', () => { }, 120000); describe('--directory', () => { - it('should create src in the specified directory --projectNameAndRootFormat=as-provided', async () => { + it('should create src in the specified directory', async () => { const plugin = uniq('remix'); runCLI( - `generate @nx/remix:app ${plugin} --directory=subdir --projectNameAndRootFormat=as-provided --rootProject=false --no-interactive` + `generate @nx/remix:app ${plugin} --directory=subdir --rootProject=false --no-interactive` ); const result = runCLI(`build ${plugin}`); diff --git a/e2e/storybook/src/storybook-angular.test.ts b/e2e/storybook/src/storybook-angular.test.ts index 738ca5bc94f26..cb937c2342548 100644 --- a/e2e/storybook/src/storybook-angular.test.ts +++ b/e2e/storybook/src/storybook-angular.test.ts @@ -13,7 +13,6 @@ describe('Storybook executors for Angular', () => { beforeAll(() => { newProject({ packages: ['@nx/angular'], - unsetProjectNameAndRootFormat: false, }); runCLI( `g @nx/angular:library ${angularStorybookLib} --project-name-and-root-format=as-provided --no-interactive` diff --git a/e2e/storybook/src/storybook.test.ts b/e2e/storybook/src/storybook.test.ts index 4c22b6ee7f3c1..e520e1c89d8e4 100644 --- a/e2e/storybook/src/storybook.test.ts +++ b/e2e/storybook/src/storybook.test.ts @@ -20,7 +20,6 @@ describe('Storybook generators and executors for monorepos', () => { beforeAll(async () => { proj = newProject({ packages: ['@nx/react'], - unsetProjectNameAndRootFormat: false, }); runCLI( `generate @nx/react:app ${reactStorybookApp} --bundler=webpack --project-name-and-root-format=as-provided --no-interactive` diff --git a/e2e/utils/create-project-utils.ts b/e2e/utils/create-project-utils.ts index ff89a41e51b19..20f7995bdb2d5 100644 --- a/e2e/utils/create-project-utils.ts +++ b/e2e/utils/create-project-utils.ts @@ -74,12 +74,10 @@ type NxPackage = (typeof nxPackages)[number]; export function newProject({ name = uniq('proj'), packageManager = getSelectedPackageManager(), - unsetProjectNameAndRootFormat = true, packages, }: { name?: string; packageManager?: 'npm' | 'yarn' | 'pnpm' | 'bun'; - unsetProjectNameAndRootFormat?: boolean; readonly packages?: Array; } = {}): string { const newProjectStart = performance.mark('new-project:start'); @@ -104,14 +102,6 @@ export function newProject({ createNxWorkspaceEnd.name ); - if (unsetProjectNameAndRootFormat) { - console.warn( - 'ATTENTION: The workspace generated for this e2e test does not use the new as-provided project name/root format. Please update this test' - ); - createFile('apps/.gitkeep'); - createFile('libs/.gitkeep'); - } - // Temporary hack to prevent installing with `--frozen-lockfile` if (isCI && packageManager === 'pnpm') { updateFile( diff --git a/e2e/vite/src/vite-esm.test.ts b/e2e/vite/src/vite-esm.test.ts index fa19cb0311ce5..5e4975b4e26c4 100644 --- a/e2e/vite/src/vite-esm.test.ts +++ b/e2e/vite/src/vite-esm.test.ts @@ -12,7 +12,6 @@ import { describe('Vite ESM tests', () => { beforeAll(() => newProject({ - unsetProjectNameAndRootFormat: false, packages: ['@nx/react'], }) ); diff --git a/e2e/vite/src/vite-legacy.test.ts b/e2e/vite/src/vite-legacy.test.ts index b64dae09dcd75..c34543ec70e23 100644 --- a/e2e/vite/src/vite-legacy.test.ts +++ b/e2e/vite/src/vite-legacy.test.ts @@ -49,7 +49,7 @@ describe('Vite Plugin', () => { beforeAll(() => { myApp = uniq('my-app'); runCLI( - `generate @nx/react:app ${myApp} --bundler=vite --directory=${myApp} --projectNameAndRootFormat=as-provided` + `generate @nx/react:app ${myApp} --bundler=vite --directory=${myApp}` ); }); @@ -97,7 +97,7 @@ describe('Vite Plugin', () => { beforeEach(() => { myApp = uniq('my-app'); runCLI( - `generate @nx/web:app ${myApp} --bundler=vite --directory=${myApp} --projectNameAndRootFormat=as-provided` + `generate @nx/web:app ${myApp} --bundler=vite --directory=${myApp}` ); }); it('should build application', async () => { @@ -189,22 +189,22 @@ describe('Vite Plugin', () => { packages: ['@nx/react'], }); runCLI( - `generate @nx/react:app ${app} --bundler=vite --no-interactive --directory=${app} --projectNameAndRootFormat=as-provided` + `generate @nx/react:app ${app} --bundler=vite --no-interactive --directory=${app}` ); // only this project will be directly used from dist runCLI( - `generate @nx/react:lib ${lib}-buildable --unitTestRunner=none --bundler=vite --importPath="@acme/buildable" --no-interactive --directory=${lib}-buildable --projectNameAndRootFormat=as-provided` + `generate @nx/react:lib ${lib}-buildable --unitTestRunner=none --bundler=vite --importPath="@acme/buildable" --no-interactive --directory=${lib}-buildable` ); runCLI( - `generate @nx/react:lib ${lib} --unitTestRunner=none --bundler=none --importPath="@acme/non-buildable" --no-interactive --directory=${lib} --projectNameAndRootFormat=as-provided` + `generate @nx/react:lib ${lib} --unitTestRunner=none --bundler=none --importPath="@acme/non-buildable" --no-interactive --directory=${lib}` ); // because the default js lib builds as cjs it cannot be loaded from dist // so the paths plugin should always resolve to the libs source runCLI( - `generate @nx/js:lib ${lib}-js --bundler=tsc --importPath="@acme/js-lib" --no-interactive --directory=${lib}-js --projectNameAndRootFormat=as-provided` + `generate @nx/js:lib ${lib}-js --bundler=tsc --importPath="@acme/js-lib" --no-interactive --directory=${lib}-js` ); const buildableLibCmp = names(`${lib}-buildable`).className; const nonBuildableLibCmp = names(lib).className; diff --git a/e2e/vite/src/vite.test.ts b/e2e/vite/src/vite.test.ts index 28ec3e3a9df40..0015f9f33d604 100644 --- a/e2e/vite/src/vite.test.ts +++ b/e2e/vite/src/vite.test.ts @@ -187,7 +187,7 @@ describe('@nx/vite/plugin', () => { packages: ['@nx/vite', '@nx/react'], }); runCLI( - `generate @nx/react:app ${reactVitest} --bundler=webpack --unitTestRunner=vitest --e2eTestRunner=none --projectNameAndRootFormat=as-provided` + `generate @nx/react:app ${reactVitest} --bundler=webpack --unitTestRunner=vitest --e2eTestRunner=none` ); }); diff --git a/e2e/vue/src/vue-legacy.test.ts b/e2e/vue/src/vue-legacy.test.ts index 4d92318a772b3..851fb7620266a 100644 --- a/e2e/vue/src/vue-legacy.test.ts +++ b/e2e/vue/src/vue-legacy.test.ts @@ -6,7 +6,6 @@ describe('Vue Plugin (legacy)', () => { beforeAll(() => { proj = newProject({ packages: ['@nx/vue'], - unsetProjectNameAndRootFormat: false, }); }); diff --git a/e2e/vue/src/vue-storybook.test.ts b/e2e/vue/src/vue-storybook.test.ts index a68fbf7b2aa1d..d492f08c1a185 100644 --- a/e2e/vue/src/vue-storybook.test.ts +++ b/e2e/vue/src/vue-storybook.test.ts @@ -16,7 +16,6 @@ describe('Storybook generators and executors for Vue projects', () => { process.env.NX_ADD_PLUGINS = 'true'; proj = newProject({ packages: ['@nx/vue'], - unsetProjectNameAndRootFormat: false, }); runCLI( `generate @nx/vue:app ${vueStorybookApp} --project-name-and-root-format=as-provided --no-interactive` diff --git a/e2e/vue/src/vue-tailwind.test.ts b/e2e/vue/src/vue-tailwind.test.ts index b174ab57f3e71..604a385fbe89c 100644 --- a/e2e/vue/src/vue-tailwind.test.ts +++ b/e2e/vue/src/vue-tailwind.test.ts @@ -10,7 +10,7 @@ import { describe('vue tailwind support', () => { beforeAll(() => { - newProject({ unsetProjectNameAndRootFormat: false, packages: ['@nx/vue'] }); + newProject({ packages: ['@nx/vue'] }); }); afterAll(() => { diff --git a/e2e/vue/src/vue.test.ts b/e2e/vue/src/vue.test.ts index a9c65bf97dc32..2857d081d57a1 100644 --- a/e2e/vue/src/vue.test.ts +++ b/e2e/vue/src/vue.test.ts @@ -6,7 +6,6 @@ describe('Vue Plugin', () => { beforeAll(() => { proj = newProject({ packages: ['@nx/vue'], - unsetProjectNameAndRootFormat: false, }); }); diff --git a/e2e/webpack/src/webpack.legacy.test.ts b/e2e/webpack/src/webpack.legacy.test.ts index a96f5c87edeba..f1e5b9b63701c 100644 --- a/e2e/webpack/src/webpack.legacy.test.ts +++ b/e2e/webpack/src/webpack.legacy.test.ts @@ -22,7 +22,6 @@ describe('Webpack Plugin (legacy)', () => { process.env.NX_ADD_PLUGINS = 'false'; newProject({ packages: ['@nx/react'], - unsetProjectNameAndRootFormat: false, }); runCLI( `generate @nx/react:app ${appName} --bundler webpack --e2eTestRunner=cypress --rootProject --no-interactive` @@ -154,7 +153,7 @@ describe('Webpack Plugin (legacy)', () => { it('should convert withNx webpack config to a standard config using NxWebpackPlugin', () => { const appName = 'app3224373'; // Needs to be reserved so that the snapshot projectName matches runCLI( - `generate @nx/web:app ${appName} --bundler webpack --e2eTestRunner=playwright --projectNameAndRootFormat=as-provided` + `generate @nx/web:app ${appName} --bundler webpack --e2eTestRunner=playwright` ); updateFile( `${appName}/src/main.ts`, diff --git a/e2e/webpack/src/webpack.test.ts b/e2e/webpack/src/webpack.test.ts index de70314cc9d5d..b57164a5321d3 100644 --- a/e2e/webpack/src/webpack.test.ts +++ b/e2e/webpack/src/webpack.test.ts @@ -137,7 +137,7 @@ describe('Webpack Plugin', () => { it('should be able to build with NxWebpackPlugin and a standard webpack config file', () => { const appName = uniq('app'); runCLI( - `generate @nx/web:app ${appName} --bundler webpack --directory=apps/${appName} --projectNameAndRootFormat=as-provided` + `generate @nx/web:app ${appName} --bundler webpack --directory=apps/${appName}` ); updateFile(`apps/${appName}/src/main.ts`, `console.log('Hello');\n`); updateFile(`apps/${appName}/src/foo.ts`, `console.log('Foo');\n`); diff --git a/e2e/workspace-create/src/create-nx-workspace-npm.test.ts b/e2e/workspace-create/src/create-nx-workspace-npm.test.ts index 5343b5ebffea9..1bd60c0fa7069 100644 --- a/e2e/workspace-create/src/create-nx-workspace-npm.test.ts +++ b/e2e/workspace-create/src/create-nx-workspace-npm.test.ts @@ -53,9 +53,7 @@ describe('create-nx-workspace --preset=npm', () => { const appName = uniq('my-app'); expect(() => { - runCLI( - `generate @nx/angular:app packages/${appName} --projectNameAndRootFormat as-provided --no-interactive` - ); + runCLI(`generate @nx/angular:app packages/${appName} --no-interactive`); }).not.toThrowError(); checkFilesExist('tsconfig.base.json'); }, 1_000_000); @@ -65,9 +63,7 @@ describe('create-nx-workspace --preset=npm', () => { const libName = uniq('lib'); expect(() => { - runCLI( - `generate @nx/angular:lib packages/${libName} --projectNameAndRootFormat as-provided --no-interactive` - ); + runCLI(`generate @nx/angular:lib packages/${libName} --no-interactive`); }).not.toThrowError(); checkFilesExist('tsconfig.base.json'); const tsconfig = readJson(`tsconfig.base.json`); @@ -82,9 +78,7 @@ describe('create-nx-workspace --preset=npm', () => { const libName = uniq('lib'); expect(() => - runCLI( - `generate @nx/js:library packages/${libName} --projectNameAndRootFormat as-provided --no-interactive` - ) + runCLI(`generate @nx/js:library packages/${libName} --no-interactive`) ).not.toThrowError(); checkFilesExist('tsconfig.base.json'); const tsconfig = readJson(`tsconfig.base.json`); @@ -99,9 +93,7 @@ describe('create-nx-workspace --preset=npm', () => { const appName = uniq('my-app'); expect(() => - runCLI( - `generate @nx/web:app packages/${appName} --projectNameAndRootFormat as-provided --no-interactive` - ) + runCLI(`generate @nx/web:app packages/${appName} --no-interactive`) ).not.toThrowError(); checkFilesExist('tsconfig.base.json'); }); @@ -112,9 +104,7 @@ describe('create-nx-workspace --preset=npm', () => { const appName = uniq('my-app'); expect(() => { - runCLI( - `generate @nx/react:app packages/${appName} --projectNameAndRootFormat as-provided --no-interactive` - ); + runCLI(`generate @nx/react:app packages/${appName} --no-interactive`); }).not.toThrowError(); checkFilesExist('tsconfig.base.json'); }); @@ -125,9 +115,7 @@ describe('create-nx-workspace --preset=npm', () => { const libName = uniq('lib'); expect(() => { - runCLI( - `generate @nx/react:lib packages/${libName} --projectNameAndRootFormat as-provided --no-interactive` - ); + runCLI(`generate @nx/react:lib packages/${libName} --no-interactive`); }).not.toThrowError(); checkFilesExist('tsconfig.base.json'); const tsconfig = readJson(`tsconfig.base.json`); @@ -142,9 +130,7 @@ describe('create-nx-workspace --preset=npm', () => { const appName = uniq('my-app'); expect(() => { - runCLI( - `generate @nx/next:app packages/${appName} --projectNameAndRootFormat as-provided --no-interactive` - ); + runCLI(`generate @nx/next:app packages/${appName} --no-interactive`); }).not.toThrowError(); checkFilesExist('tsconfig.base.json'); }); @@ -155,9 +141,7 @@ describe('create-nx-workspace --preset=npm', () => { const libName = uniq('lib'); expect(() => { - runCLI( - `generate @nx/next:lib packages/${libName} --projectNameAndRootFormat as-provided --no-interactive` - ); + runCLI(`generate @nx/next:lib packages/${libName} --no-interactive`); }).not.toThrowError(); checkFilesExist('tsconfig.base.json'); const tsconfig = readJson(`tsconfig.base.json`); @@ -174,7 +158,7 @@ describe('create-nx-workspace --preset=npm', () => { expect(() => { runCLI( - `generate @nx/react-native:app packages/${appName} --install=false --projectNameAndRootFormat as-provided --no-interactive` + `generate @nx/react-native:app packages/${appName} --install=false --no-interactive` ); }).not.toThrowError(); checkFilesExist('tsconfig.base.json'); @@ -187,7 +171,7 @@ describe('create-nx-workspace --preset=npm', () => { expect(() => { runCLI( - `generate @nx/react-native:lib packages/${libName} --projectNameAndRootFormat as-provided --no-interactive` + `generate @nx/react-native:lib packages/${libName} --no-interactive` ); }).not.toThrowError(); checkFilesExist('tsconfig.base.json'); @@ -203,9 +187,7 @@ describe('create-nx-workspace --preset=npm', () => { const appName = uniq('my-app'); expect(() => { - runCLI( - `generate @nx/node:app packages/${appName} --projectNameAndRootFormat as-provided --no-interactive` - ); + runCLI(`generate @nx/node:app packages/${appName} --no-interactive`); }).not.toThrowError(); checkFilesExist('tsconfig.base.json'); }); @@ -216,9 +198,7 @@ describe('create-nx-workspace --preset=npm', () => { const libName = uniq('lib'); expect(() => { - runCLI( - `generate @nx/node:lib packages/${libName} --projectNameAndRootFormat as-provided --no-interactive` - ); + runCLI(`generate @nx/node:lib packages/${libName} --no-interactive`); }).not.toThrowError(); checkFilesExist('tsconfig.base.json'); const tsconfig = readJson(`tsconfig.base.json`); @@ -233,9 +213,7 @@ describe('create-nx-workspace --preset=npm', () => { const appName = uniq('my-app'); expect(() => { - runCLI( - `generate @nx/nest:app packages/${appName} --projectNameAndRootFormat as-provided --no-interactive` - ); + runCLI(`generate @nx/nest:app packages/${appName} --no-interactive`); }).not.toThrowError(); checkFilesExist('tsconfig.base.json'); }); @@ -246,9 +224,7 @@ describe('create-nx-workspace --preset=npm', () => { const libName = uniq('lib'); expect(() => { - runCLI( - `generate @nx/nest:lib packages/${libName} --projectNameAndRootFormat as-provided --no-interactive` - ); + runCLI(`generate @nx/nest:lib packages/${libName} --no-interactive`); }).not.toThrowError(); checkFilesExist('tsconfig.base.json'); const tsconfig = readJson(`tsconfig.base.json`); @@ -263,9 +239,7 @@ describe('create-nx-workspace --preset=npm', () => { const appName = uniq('my-app'); expect(() => { - runCLI( - `generate @nx/express:app packages/${appName} --projectNameAndRootFormat as-provided --no-interactive` - ); + runCLI(`generate @nx/express:app packages/${appName} --no-interactive`); }).not.toThrowError(); checkFilesExist('tsconfig.base.json'); }); diff --git a/packages/angular/src/generators/application/lib/normalize-options.ts b/packages/angular/src/generators/application/lib/normalize-options.ts index 1dcb86042d401..d8d6150480247 100644 --- a/packages/angular/src/generators/application/lib/normalize-options.ts +++ b/packages/angular/src/generators/application/lib/normalize-options.ts @@ -45,6 +45,7 @@ export async function normalizeOptions( linter: Linter.EsLint, strict: true, standalone: true, + directory: appProjectRoot, ...options, prefix: options.prefix || 'app', name: appProjectName, diff --git a/packages/angular/src/generators/application/schema.d.ts b/packages/angular/src/generators/application/schema.d.ts index ad14d65145275..855f9e718f014 100644 --- a/packages/angular/src/generators/application/schema.d.ts +++ b/packages/angular/src/generators/application/schema.d.ts @@ -1,10 +1,10 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; import type { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners'; import type { Styles } from '../utils/types'; export interface Schema { - name: string; + directory: string; + name?: string; addTailwind?: boolean; skipFormat?: boolean; inlineStyle?: boolean; @@ -14,8 +14,6 @@ export interface Schema { prefix?: string; style?: Styles; skipTests?: boolean; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; tags?: string; linter?: Linter | LinterType; unitTestRunner?: UnitTestRunner; diff --git a/packages/angular/src/generators/application/schema.json b/packages/angular/src/generators/application/schema.json index f3d3a47a9fb7f..b11a287215bd4 100644 --- a/packages/angular/src/generators/application/schema.json +++ b/packages/angular/src/generators/application/schema.json @@ -21,11 +21,6 @@ "type": "string", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "style": { "description": "The file extension to be used for style files.", "type": "string", diff --git a/packages/angular/src/generators/component/schema.d.ts b/packages/angular/src/generators/component/schema.d.ts index 1a4e195574329..3ab6ef0825d70 100644 --- a/packages/angular/src/generators/component/schema.d.ts +++ b/packages/angular/src/generators/component/schema.d.ts @@ -1,8 +1,8 @@ import type { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils'; export interface Schema { - name: string; - directory?: string; + directory: string; + name?: string; nameAndDirectoryFormat?: NameAndDirectoryFormat; displayBlock?: boolean; inlineStyle?: boolean; diff --git a/packages/angular/src/generators/federate-module/lib/add-remote.ts b/packages/angular/src/generators/federate-module/lib/add-remote.ts index ad4ec186e7a95..17164bf5a32bf 100644 --- a/packages/angular/src/generators/federate-module/lib/add-remote.ts +++ b/packages/angular/src/generators/federate-module/lib/add-remote.ts @@ -17,7 +17,6 @@ export async function addRemote(tree: Tree, schema: Schema) { directory: schema.remoteDirectory, host: schema.host, standalone: schema.standalone, - projectNameAndRootFormat: schema.projectNameAndRootFormat, unitTestRunner: schema.unitTestRunner ?? UnitTestRunner.Jest, e2eTestRunner: schema.e2eTestRunner ?? E2eTestRunner.Cypress, skipFormat: true, diff --git a/packages/angular/src/generators/federate-module/schema.d.ts b/packages/angular/src/generators/federate-module/schema.d.ts index 3a60ea70eba4a..fcd19cc8dcf22 100644 --- a/packages/angular/src/generators/federate-module/schema.d.ts +++ b/packages/angular/src/generators/federate-module/schema.d.ts @@ -1,4 +1,3 @@ -import { type ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import { UnitTestRunner, E2eTestRunner } from '../utils/testing'; export interface Schema { @@ -7,7 +6,6 @@ export interface Schema { remote: string; remoteDirectory?: string; host?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; unitTestRunner?: UnitTestRunner; e2eTestRunner?: E2eTestRunner; standalone?: boolean; diff --git a/packages/angular/src/generators/federate-module/schema.json b/packages/angular/src/generators/federate-module/schema.json index a9807819c7923..8abbcde9663c7 100644 --- a/packages/angular/src/generators/federate-module/schema.json +++ b/packages/angular/src/generators/federate-module/schema.json @@ -37,11 +37,6 @@ "description": "The directory of the new remote application if one needs to be created.", "type": "string" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "style": { "description": "The file extension to be used for style files for the remote if one needs to be created.", "type": "string", diff --git a/packages/angular/src/generators/host/host.spec.ts b/packages/angular/src/generators/host/host.spec.ts index 936368a23f275..6c271774fd688 100644 --- a/packages/angular/src/generators/host/host.spec.ts +++ b/packages/angular/src/generators/host/host.spec.ts @@ -570,7 +570,6 @@ describe('Host App Generator', () => { name: 'myhostapp', remotes: [remote], dynamic: true, - projectNameAndRootFormat: 'as-provided', e2eTestRunner: E2eTestRunner.None, linter: Linter.None, style: 'css', diff --git a/packages/angular/src/generators/host/schema.d.ts b/packages/angular/src/generators/host/schema.d.ts index 402f3af46d507..7269786bed725 100644 --- a/packages/angular/src/generators/host/schema.d.ts +++ b/packages/angular/src/generators/host/schema.d.ts @@ -1,10 +1,10 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; import type { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners'; import type { Styles } from '../utils/types'; export interface Schema { - name: string; + directory: string; + name?: string; remotes?: string[]; dynamic?: boolean; setParserOptionsProject?: boolean; @@ -14,8 +14,6 @@ export interface Schema { prefix?: string; style?: Styles; skipTests?: boolean; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; tags?: string; linter?: Linter | LinterType; unitTestRunner?: UnitTestRunner; diff --git a/packages/angular/src/generators/host/schema.json b/packages/angular/src/generators/host/schema.json index 9e23a200ecfbf..b52c3e7e41f9f 100644 --- a/packages/angular/src/generators/host/schema.json +++ b/packages/angular/src/generators/host/schema.json @@ -12,14 +12,20 @@ } ], "properties": { - "name": { + "directory": { + "description": "The directory of the new application.", "type": "string", - "description": "The name to give to the host Angular application.", "$default": { "$source": "argv", "index": 0 }, - "pattern": "^[a-zA-Z][^:]*$" + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" + }, + "name": { + "type": "string", + "description": "The name to give to the host Angular application.", + "x-priority": "important" }, "remotes": { "type": "array", @@ -31,15 +37,6 @@ "description": "Should the host application use dynamic federation?", "default": false }, - "directory": { - "description": "The directory of the new application.", - "type": "string" - }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "style": { "description": "The file extension to be used for style files.", "type": "string", @@ -181,5 +178,5 @@ } }, "additionalProperties": false, - "required": ["name"] + "required": ["directory"] } diff --git a/packages/angular/src/generators/library/lib/normalized-schema.ts b/packages/angular/src/generators/library/lib/normalized-schema.ts index 7cce213ec03c3..706be2c9c4315 100644 --- a/packages/angular/src/generators/library/lib/normalized-schema.ts +++ b/packages/angular/src/generators/library/lib/normalized-schema.ts @@ -3,12 +3,12 @@ import type { Linter, LinterType } from '@nx/eslint'; export interface NormalizedSchema { libraryOptions: { - name: string; + directory: string; + name?: string; addTailwind?: boolean; skipFormat?: boolean; simpleName?: boolean; addModuleSpec?: boolean; - directory?: string; sourceDir?: string; buildable?: boolean; publishable?: boolean; diff --git a/packages/angular/src/generators/library/schema.d.ts b/packages/angular/src/generators/library/schema.d.ts index 042ccda988a79..5b75bcefda355 100644 --- a/packages/angular/src/generators/library/schema.d.ts +++ b/packages/angular/src/generators/library/schema.d.ts @@ -1,15 +1,13 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; import type { UnitTestRunner } from '../../utils/test-runners'; export interface Schema { - name: string; + directory: string; + name?: string; addTailwind?: boolean; skipFormat?: boolean; simpleName?: boolean; addModuleSpec?: boolean; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; sourceDir?: string; buildable?: boolean; publishable?: boolean; diff --git a/packages/angular/src/generators/library/schema.json b/packages/angular/src/generators/library/schema.json index a3f47f1b03573..81781a1c74e54 100644 --- a/packages/angular/src/generators/library/schema.json +++ b/packages/angular/src/generators/library/schema.json @@ -9,22 +9,17 @@ "name": { "type": "string", "description": "The name of the library.", - "$default": { - "$source": "argv", - "index": 0 - }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$" + "x-priority": "important" }, "directory": { "type": "string", "description": "A directory where the library is placed.", - "x-priority": "important" - }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] + "$default": { + "$source": "argv", + "index": 0 + }, + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the library in?" }, "publishable": { "type": "boolean", @@ -203,6 +198,6 @@ } }, "additionalProperties": false, - "required": ["name"], + "required": ["directory"], "examplesFile": "../../../docs/library-examples.md" } diff --git a/packages/angular/src/generators/move/move.spec.ts b/packages/angular/src/generators/move/move.spec.ts index e44e5a1985415..4e595d61a2e2f 100644 --- a/packages/angular/src/generators/move/move.spec.ts +++ b/packages/angular/src/generators/move/move.spec.ts @@ -57,7 +57,6 @@ describe('@nx/angular:move', () => { newProjectName: 'mynewlib', destination: 'mynewlib', updateImportPath: true, - projectNameAndRootFormat: 'as-provided', skipFormat: true, }); @@ -76,7 +75,6 @@ describe('@nx/angular:move', () => { projectName: 'mylib2', destination: 'mynewlib2', updateImportPath: true, - projectNameAndRootFormat: 'as-provided', skipFormat: true, }); @@ -102,7 +100,6 @@ describe('@nx/angular:move', () => { newProjectName: 'mynewlib2', destination: 'mynewlib2', updateImportPath: true, - projectNameAndRootFormat: 'as-provided', skipFormat: true, }); @@ -122,7 +119,6 @@ describe('@nx/angular:move', () => { projectName: 'my-lib', destination: 'my/lib', updateImportPath: true, - projectNameAndRootFormat: 'as-provided', skipFormat: true, }); @@ -187,7 +183,6 @@ describe('@nx/angular:move', () => { newProjectName: 'shared-my-lib', destination: 'shared/my-lib', updateImportPath: true, - projectNameAndRootFormat: 'as-provided', skipFormat: true, }); @@ -226,7 +221,6 @@ describe('@nx/angular:move', () => { newProjectName: 'shared-my-lib', destination: 'shared/my-lib', updateImportPath: true, - projectNameAndRootFormat: 'as-provided', skipFormat: true, }); @@ -250,7 +244,6 @@ describe('@nx/angular:move', () => { newProjectName: 'shared-my-lib', destination: 'shared/my-lib', updateImportPath: true, - projectNameAndRootFormat: 'as-provided', skipFormat: true, }); @@ -289,7 +282,6 @@ describe('@nx/angular:move', () => { newProjectName: 'my-destination', destination: 'my-destination', updateImportPath: true, - projectNameAndRootFormat: 'as-provided', skipFormat: true, }); @@ -312,7 +304,6 @@ describe('@nx/angular:move', () => { newProjectName: 'my-destination', destination: 'my-destination', updateImportPath: true, - projectNameAndRootFormat: 'as-provided', skipFormat: true, }); @@ -336,7 +327,6 @@ describe('@nx/angular:move', () => { newProjectName: 'my-destination', destination: 'my-destination', updateImportPath: true, - projectNameAndRootFormat: 'as-provided', skipFormat: true, }); @@ -366,7 +356,6 @@ describe('@nx/angular:move', () => { newProjectName: 'my-destination', destination: 'my-destination', updateImportPath: true, - projectNameAndRootFormat: 'as-provided', skipFormat: true, }); diff --git a/packages/angular/src/generators/move/schema.d.ts b/packages/angular/src/generators/move/schema.d.ts index dff7858362f85..dfdefc742c3e7 100644 --- a/packages/angular/src/generators/move/schema.d.ts +++ b/packages/angular/src/generators/move/schema.d.ts @@ -1,5 +1,3 @@ -import { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; - export interface Schema { projectName: string; destination: string; @@ -7,5 +5,4 @@ export interface Schema { importPath?: string; skipFormat?: boolean; newProjectName?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; } diff --git a/packages/angular/src/generators/move/schema.json b/packages/angular/src/generators/move/schema.json index 87f1c441d6515..b1ad8d7328304 100644 --- a/packages/angular/src/generators/move/schema.json +++ b/packages/angular/src/generators/move/schema.json @@ -35,11 +35,6 @@ }, "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the new project name and destination as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "importPath": { "type": "string", "description": "The new import path to use in the `tsconfig.base.json`." diff --git a/packages/angular/src/generators/remote/schema.d.ts b/packages/angular/src/generators/remote/schema.d.ts index 345e5944782a6..36e9fac09b841 100644 --- a/packages/angular/src/generators/remote/schema.d.ts +++ b/packages/angular/src/generators/remote/schema.d.ts @@ -1,10 +1,10 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; import type { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners'; import type { Styles } from '../utils/types'; export interface Schema { - name: string; + directory: string; + name?: string; host?: string; port?: number; setParserOptionsProject?: boolean; @@ -13,8 +13,6 @@ export interface Schema { prefix?: string; style?: Styles; skipTests?: boolean; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; tags?: string; linter?: Linter | LinterType; unitTestRunner?: UnitTestRunner; diff --git a/packages/angular/src/generators/remote/schema.json b/packages/angular/src/generators/remote/schema.json index 65454c2ea9ea5..5b4b8f63134df 100644 --- a/packages/angular/src/generators/remote/schema.json +++ b/packages/angular/src/generators/remote/schema.json @@ -12,14 +12,20 @@ } ], "properties": { - "name": { + "directory": { + "description": "The directory of the new application.", "type": "string", - "description": "The name to give to the remote Angular app.", "$default": { "$source": "argv", "index": 0 }, - "pattern": "^[a-zA-Z][^:]*$" + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" + }, + "name": { + "type": "string", + "description": "The name to give to the remote Angular app.", + "x-priority": "important" }, "host": { "type": "string", @@ -31,15 +37,6 @@ "type": "number", "description": "The port on which this app should be served." }, - "directory": { - "description": "The directory of the new application.", - "type": "string" - }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "style": { "description": "The file extension to be used for style files.", "type": "string", @@ -174,5 +171,5 @@ } }, "additionalProperties": false, - "required": ["name"] + "required": ["directory"] } diff --git a/packages/angular/src/generators/utils/testing.ts b/packages/angular/src/generators/utils/testing.ts index 369bd46a9b249..0562158772a3c 100644 --- a/packages/angular/src/generators/utils/testing.ts +++ b/packages/angular/src/generators/utils/testing.ts @@ -19,7 +19,6 @@ export async function generateTestApplication( ): Promise { tree.write('.gitignore', ''); await applicationGenerator(tree, { - projectNameAndRootFormat: 'as-provided', ...options, }); } @@ -29,7 +28,7 @@ export async function generateTestHostApplication( options: HostOptions ): Promise { tree.write('.gitignore', ''); - await host(tree, { projectNameAndRootFormat: 'as-provided', ...options }); + await host(tree, { ...options }); } export async function generateTestRemoteApplication( @@ -37,7 +36,7 @@ export async function generateTestRemoteApplication( options: RemoteOptions ): Promise { tree.write('.gitignore', ''); - await remote(tree, { projectNameAndRootFormat: 'as-provided', ...options }); + await remote(tree, { ...options }); } export async function generateTestLibrary( @@ -46,7 +45,6 @@ export async function generateTestLibrary( ): Promise { tree.write('.gitignore', ''); await libraryGenerator(tree, { - projectNameAndRootFormat: 'as-provided', ...options, }); } @@ -58,14 +56,13 @@ export async function createStorybookTestWorkspaceForLib( tree.write('.gitignore', ''); await libraryGenerator(tree, { - name: libName, + directory: libName, buildable: false, linter: Linter.EsLint, publishable: false, simpleName: false, skipFormat: true, unitTestRunner: UnitTestRunner.Jest, - projectNameAndRootFormat: 'as-provided', standalone: false, }); diff --git a/packages/detox/src/generators/application/application.spec.ts b/packages/detox/src/generators/application/application.spec.ts index 1bca1d9098cb3..dc4be9606c5e0 100644 --- a/packages/detox/src/generators/application/application.spec.ts +++ b/packages/detox/src/generators/application/application.spec.ts @@ -30,7 +30,6 @@ describe('detox application generator', () => { appProject: 'my-app', linter: Linter.None, framework: 'react-native', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); }); @@ -102,7 +101,6 @@ describe('detox application generator', () => { appProject: 'my-dir-my-app', linter: Linter.None, framework: 'react-native', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); }); @@ -174,7 +172,6 @@ describe('detox application generator', () => { appProject: 'my-dir-my-app', linter: Linter.None, framework: 'react-native', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); }); @@ -245,7 +242,6 @@ describe('detox application generator', () => { appProject: 'my-dir-my-app', linter: Linter.None, framework: 'react-native', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); }); @@ -315,7 +311,6 @@ describe('detox application generator', () => { appProject: 'my-dir-my-app', linter: Linter.None, framework: 'expo', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); }); diff --git a/packages/detox/src/generators/application/schema.d.ts b/packages/detox/src/generators/application/schema.d.ts index 0c52d2d96fab9..a46f389a8ac5b 100644 --- a/packages/detox/src/generators/application/schema.d.ts +++ b/packages/detox/src/generators/application/schema.d.ts @@ -1,4 +1,3 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; export interface Schema { @@ -6,7 +5,6 @@ export interface Schema { appDisplayName?: string; // display name of the app to be tested appName?: string; // name of app to be tested if different form appProject, case insensitive e2eDirectory?: string; // the directory where e2e app going to be located - projectNameAndRootFormat?: ProjectNameAndRootFormat; e2eName: string; // name of the e2e app linter?: Linter | LinterType; js?: boolean; diff --git a/packages/detox/src/generators/application/schema.json b/packages/detox/src/generators/application/schema.json index a62b3353afaf1..e83e22cb76b79 100644 --- a/packages/detox/src/generators/application/schema.json +++ b/packages/detox/src/generators/application/schema.json @@ -12,15 +12,19 @@ }, "x-prompt": "What is the name of the frontend project to test?" }, - "e2eName": { + "e2eDirectory": { "type": "string", - "description": "Name of the E2E Project.", + "description": "A directory where the project is placed relative current working directory (CWD).", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the E2E project?", - "pattern": "^[a-zA-Z][^:]*$" + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the E2E project in?" + }, + "e2eName": { + "type": "string", + "description": "Name of the E2E Project." }, "appName": { "type": "string", @@ -36,15 +40,6 @@ "enum": ["react-native", "expo"], "x-prompt": "What app framework should detox test?" }, - "e2eDirectory": { - "type": "string", - "description": "A directory where the project is placed relative to apps directory." - }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "linter": { "description": "The tool to use for running lint checks.", "type": "string", @@ -68,5 +63,5 @@ "default": false } }, - "required": ["e2eName", "appProject", "framework"] + "required": ["e2eDirectory", "appProject", "framework"] } diff --git a/packages/expo/src/generators/application/application.spec.ts b/packages/expo/src/generators/application/application.spec.ts index 6e1942d03259c..be8c767bd4476 100644 --- a/packages/expo/src/generators/application/application.spec.ts +++ b/packages/expo/src/generators/application/application.spec.ts @@ -28,7 +28,6 @@ describe('app', () => { skipFormat: false, js: false, unitTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', }); const projects = getProjects(appTree); @@ -45,7 +44,6 @@ describe('app', () => { skipFormat: false, js: false, unitTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', }); const projectConfiguration = readProjectConfiguration(appTree, 'my-app'); @@ -63,7 +61,6 @@ describe('app', () => { skipFormat: false, js: false, unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', }); expect(appTree.exists('my-app/src/app/App.tsx')).toBeTruthy(); expect(appTree.exists('my-app/src/app/App.spec.tsx')).toBeTruthy(); @@ -83,7 +80,6 @@ describe('app', () => { skipFormat: false, js: true, unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', }); expect(appTree.exists('my-app/src/app/App.js')).toBeTruthy(); expect(appTree.exists('my-app/src/app/App.spec.js')).toBeTruthy(); @@ -104,7 +100,6 @@ describe('app', () => { js: false, skipFormat: false, unitTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', }); expect(appTree.exists('my-dir-e2e/.detoxrc.json')).toBeTruthy(); @@ -166,7 +161,6 @@ describe('app', () => { js: false, skipFormat: false, unitTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', }); expect(appTree.exists('my-app-e2e/.detoxrc.json')).toBeTruthy(); @@ -294,7 +288,6 @@ describe('app', () => { js: false, skipFormat: false, unitTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); @@ -320,7 +313,6 @@ describe('app', () => { js: false, skipFormat: false, unitTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); diff --git a/packages/expo/src/generators/application/lib/add-e2e.ts b/packages/expo/src/generators/application/lib/add-e2e.ts index 71f0242024133..67d16a84e15c5 100644 --- a/packages/expo/src/generators/application/lib/add-e2e.ts +++ b/packages/expo/src/generators/application/lib/add-e2e.ts @@ -167,7 +167,6 @@ export async function addE2e( ...options, e2eName: options.e2eProjectName, e2eDirectory: options.e2eProjectRoot, - projectNameAndRootFormat: 'as-provided', appProject: options.projectName, appDisplayName: options.displayName, appName: options.name, diff --git a/packages/expo/src/generators/application/lib/normalize-options.spec.ts b/packages/expo/src/generators/application/lib/normalize-options.spec.ts index 5ceeb32822f3b..3f6f4a69187c9 100644 --- a/packages/expo/src/generators/application/lib/normalize-options.spec.ts +++ b/packages/expo/src/generators/application/lib/normalize-options.spec.ts @@ -19,7 +19,6 @@ describe('Normalize Options', () => { skipFormat: false, js: true, unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', }; const options = await normalizeOptions(appTree, schema); expect(options).toEqual({ @@ -31,7 +30,6 @@ describe('Normalize Options', () => { name: 'my-app', parsedTags: [], projectName: 'my-app', - projectNameAndRootFormat: 'as-provided', linter: Linter.EsLint, e2eTestRunner: 'none', unitTestRunner: 'jest', @@ -51,7 +49,6 @@ describe('Normalize Options', () => { skipFormat: false, js: true, unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', }; const options = await normalizeOptions(appTree, schema); expect(options).toEqual({ @@ -63,7 +60,6 @@ describe('Normalize Options', () => { name: 'myApp', parsedTags: [], projectName: 'myApp', - projectNameAndRootFormat: 'as-provided', linter: Linter.EsLint, e2eTestRunner: 'none', skipFormat: false, @@ -84,7 +80,6 @@ describe('Normalize Options', () => { skipFormat: false, js: true, unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', }; const options = await normalizeOptions(appTree, schema); expect(options).toEqual({ @@ -97,7 +92,6 @@ describe('Normalize Options', () => { directory: 'directory', parsedTags: [], projectName: 'my-app', - projectNameAndRootFormat: 'as-provided', e2eTestRunner: 'none', unitTestRunner: 'jest', linter: Linter.EsLint, @@ -117,7 +111,6 @@ describe('Normalize Options', () => { skipFormat: false, js: true, unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', }; const options = await normalizeOptions(appTree, schema); expect(options).toEqual({ @@ -129,7 +122,6 @@ describe('Normalize Options', () => { name: 'my-app', parsedTags: [], projectName: 'my-app', - projectNameAndRootFormat: 'as-provided', e2eTestRunner: 'none', unitTestRunner: 'jest', linter: Linter.EsLint, @@ -150,7 +142,6 @@ describe('Normalize Options', () => { skipFormat: false, js: true, unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', }; const options = await normalizeOptions(appTree, schema); expect(options).toEqual({ @@ -162,7 +153,6 @@ describe('Normalize Options', () => { name: 'my-app', parsedTags: [], projectName: 'my-app', - projectNameAndRootFormat: 'as-provided', e2eTestRunner: 'none', unitTestRunner: 'jest', linter: Linter.EsLint, diff --git a/packages/expo/src/generators/application/schema.d.ts b/packages/expo/src/generators/application/schema.d.ts index 242f6db05677f..d62942760e071 100644 --- a/packages/expo/src/generators/application/schema.d.ts +++ b/packages/expo/src/generators/application/schema.d.ts @@ -1,13 +1,11 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; export interface Schema { - name: string; + directory: string; + name?: string; displayName?: string; style?: string; skipFormat: boolean; // default is false - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; tags?: string; unitTestRunner: 'jest' | 'none'; // default is jest classComponent?: boolean; diff --git a/packages/expo/src/generators/application/schema.json b/packages/expo/src/generators/application/schema.json index d4358034acc75..6f50033e785c4 100644 --- a/packages/expo/src/generators/application/schema.json +++ b/packages/expo/src/generators/application/schema.json @@ -15,29 +15,24 @@ ], "type": "object", "properties": { - "name": { - "description": "The name of the application.", + "directory": { + "description": "The directory of the new application.", "type": "string", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the application?", - "pattern": "^[a-zA-Z][^:]*$" - }, - "displayName": { - "description": "The display name to show in the application. Defaults to name.", - "type": "string" + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "directory": { - "description": "The directory of the new application.", + "name": { + "description": "The name of the application.", "type": "string", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] + "displayName": { + "description": "The display name to show in the application. Defaults to name.", + "type": "string" }, "skipFormat": { "description": "Skip formatting files", @@ -90,5 +85,5 @@ "default": false } }, - "required": ["name"] + "required": ["directory"] } diff --git a/packages/expo/src/generators/component/component.spec.ts b/packages/expo/src/generators/component/component.spec.ts index 1bc02038cad05..e04abf86fec44 100644 --- a/packages/expo/src/generators/component/component.spec.ts +++ b/packages/expo/src/generators/component/component.spec.ts @@ -35,7 +35,6 @@ describe('component', () => { skipFormat: false, js: true, unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', }); await expoLibraryGenerator(appTree, { name: projectName, @@ -45,7 +44,6 @@ describe('component', () => { unitTestRunner: 'jest', strict: true, js: false, - projectNameAndRootFormat: 'as-provided', }); jest.spyOn(logger, 'warn').mockImplementation(() => {}); jest.spyOn(logger, 'debug').mockImplementation(() => {}); diff --git a/packages/expo/src/generators/library/schema.d.ts b/packages/expo/src/generators/library/schema.d.ts index 7ffb5dc8439c2..83ccb2a7cbfe0 100644 --- a/packages/expo/src/generators/library/schema.d.ts +++ b/packages/expo/src/generators/library/schema.d.ts @@ -1,13 +1,11 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; /** * Same as the @nx/react library schema, except it removes keys: style, component, routing, appProject */ export interface Schema { - name: string; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; + directory: string; + name?: string; skipTsConfig: boolean; // default is false skipFormat: boolean; // default is false tags?: string; diff --git a/packages/expo/src/generators/library/schema.json b/packages/expo/src/generators/library/schema.json index 0f03862cff891..21de3e34b8653 100644 --- a/packages/expo/src/generators/library/schema.json +++ b/packages/expo/src/generators/library/schema.json @@ -11,26 +11,21 @@ } ], "properties": { - "name": { + "directory": { "type": "string", - "description": "Library name", + "description": "A directory where the lib is placed.", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$" + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the library in?" }, - "directory": { + "name": { "type": "string", - "description": "A directory where the lib is placed.", + "description": "Library name", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "linter": { "description": "The tool to use for running lint checks.", "type": "string", @@ -94,5 +89,5 @@ "default": false } }, - "required": ["name"] + "required": ["directory"] } diff --git a/packages/expo/src/utils/add-linting.spec.ts b/packages/expo/src/utils/add-linting.spec.ts index e6c8cac411c1e..fd4bac0980667 100644 --- a/packages/expo/src/utils/add-linting.spec.ts +++ b/packages/expo/src/utils/add-linting.spec.ts @@ -14,7 +14,6 @@ describe('Add Linting', () => { await libraryGenerator(tree, { name: 'my-lib', linter: Linter.None, - projectNameAndRootFormat: 'as-provided', }); }); diff --git a/packages/express/src/generators/application/application.spec.ts b/packages/express/src/generators/application/application.spec.ts index cbda2842afdd1..3517c2a29ae1e 100644 --- a/packages/express/src/generators/application/application.spec.ts +++ b/packages/express/src/generators/application/application.spec.ts @@ -13,7 +13,6 @@ describe('app', () => { it('should generate files', async () => { await applicationGenerator(appTree, { name: 'my-node-app', - projectNameAndRootFormat: 'as-provided', } as Schema); const mainFile = appTree.read('my-node-app/src/main.ts').toString(); @@ -80,7 +79,6 @@ describe('app', () => { it('should add types to the tsconfig.app.json', async () => { await applicationGenerator(appTree, { name: 'my-node-app', - projectNameAndRootFormat: 'as-provided', } as Schema); const tsconfig = readJson(appTree, 'my-node-app/tsconfig.app.json'); expect(tsconfig.compilerOptions.types).toContain('express'); @@ -112,7 +110,6 @@ describe('app', () => { await applicationGenerator(appTree, { name: 'my-node-app', js: true, - projectNameAndRootFormat: 'as-provided', } as Schema); expect(appTree.exists('my-node-app/src/main.js')).toBeTruthy(); diff --git a/packages/express/src/generators/application/schema.d.ts b/packages/express/src/generators/application/schema.d.ts index 1aabb58b411a1..7c0353b2bbd9b 100644 --- a/packages/express/src/generators/application/schema.d.ts +++ b/packages/express/src/generators/application/schema.d.ts @@ -1,13 +1,11 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; import type { UnitTestRunner } from '../../utils/test-runners'; export interface Schema { - name: string; + directory: string; + name?: string; skipFormat: boolean; skipPackageJson: boolean; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; unitTestRunner: UnitTestRunner; tags?: string; linter: Linter | LinterType; diff --git a/packages/express/src/generators/application/schema.json b/packages/express/src/generators/application/schema.json index 1b50eaae85320..38566ae17b8cd 100644 --- a/packages/express/src/generators/application/schema.json +++ b/packages/express/src/generators/application/schema.json @@ -6,25 +6,20 @@ "description": "Nx Application Options Schema.", "type": "object", "properties": { - "name": { - "description": "The name of the application.", + "directory": { + "description": "The directory of the new application.", "type": "string", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the node application?", - "pattern": "^[a-zA-Z][^:]*$" + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "directory": { - "description": "The directory of the new application.", + "name": { + "description": "The name of the application.", "type": "string" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "skipFormat": { "description": "Skip formatting files.", "type": "boolean", @@ -71,17 +66,11 @@ "description": "Generate JavaScript files rather than TypeScript files.", "default": false }, - "standaloneConfig": { - "description": "Split the project configuration into `/project.json` rather than including it inside `workspace.json`.", - "type": "boolean", - "default": true, - "x-deprecated": "Nx only supports standaloneConfig" - }, "setParserOptionsProject": { "type": "boolean", "description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.", "default": false } }, - "required": [] + "required": ["directory"] } diff --git a/packages/js/src/generators/convert-to-swc/convert-to-swc.spec.ts b/packages/js/src/generators/convert-to-swc/convert-to-swc.spec.ts index affc6f43c2fd3..c6171734c943e 100644 --- a/packages/js/src/generators/convert-to-swc/convert-to-swc.spec.ts +++ b/packages/js/src/generators/convert-to-swc/convert-to-swc.spec.ts @@ -33,7 +33,6 @@ describe('convert to swc', () => { ...defaultLibGenerationOptions, name: 'tsc-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); expect( diff --git a/packages/js/src/generators/library/library.spec.ts b/packages/js/src/generators/library/library.spec.ts index c5c4bc66d8d3c..b68970a91ea5f 100644 --- a/packages/js/src/generators/library/library.spec.ts +++ b/packages/js/src/generators/library/library.spec.ts @@ -39,7 +39,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', config: 'npm-scripts', - projectNameAndRootFormat: 'as-provided', }); expect(readJson(tree, '/my-lib/package.json')).toEqual({ name: '@proj/my-lib', @@ -65,7 +64,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', config: 'project', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-lib'); expect(projectConfig.root).toEqual('my-lib'); @@ -76,7 +74,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', config: 'workspace', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-lib'); expect(projectConfig.root).toEqual('my-lib'); @@ -90,7 +87,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', tags: 'one,two', - projectNameAndRootFormat: 'as-provided', }); const projects = Object.fromEntries(getProjects(tree)); expect(projects).toMatchObject({ @@ -104,7 +100,6 @@ describe('lib', () => { await libraryGenerator(tree, { ...defaultOptions, name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, '/tsconfig.base.json'); expect(tsconfigJson.compilerOptions.paths['@proj/my-lib']).toEqual([ @@ -118,7 +113,6 @@ describe('lib', () => { await libraryGenerator(tree, { ...defaultOptions, name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, 'tsconfig.json'); @@ -136,7 +130,6 @@ describe('lib', () => { await libraryGenerator(tree, { ...defaultOptions, name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, '/tsconfig.base.json'); expect(tsconfigJson.compilerOptions.paths['@proj/my-lib']).toEqual([ @@ -148,7 +141,6 @@ describe('lib', () => { await libraryGenerator(tree, { ...defaultOptions, name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, 'my-lib/tsconfig.json'); expect(tsconfigJson).toMatchInlineSnapshot(` @@ -183,7 +175,6 @@ describe('lib', () => { await libraryGenerator(tree, { ...defaultOptions, name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, 'my-lib/tsconfig.json'); @@ -198,7 +189,6 @@ describe('lib', () => { name: 'my-lib', directory: 'my-dir/my-lib', tags: 'one', - projectNameAndRootFormat: 'as-provided', }); let projects = Object.fromEntries(getProjects(tree)); expect(projects).toMatchObject({ @@ -212,7 +202,6 @@ describe('lib', () => { name: 'my-lib2', directory: 'my-dir/my-lib-2', tags: 'one,two', - projectNameAndRootFormat: 'as-provided', }); projects = Object.fromEntries(getProjects(tree)); expect(projects).toMatchObject({ @@ -230,7 +219,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', directory: 'my-dir/my-lib', - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists(`my-dir/my-lib/jest.config.ts`)).toBeTruthy(); expect(tree.exists('my-dir/my-lib/src/index.ts')).toBeTruthy(); @@ -249,7 +237,6 @@ describe('lib', () => { name: 'my-lib', directory: 'my-dir/my-lib', config: 'workspace', - projectNameAndRootFormat: 'as-provided', }); expect(readProjectConfiguration(tree, 'my-lib').root).toEqual( @@ -262,7 +249,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', directory: 'my-dir/my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, '/tsconfig.base.json'); expect(tsconfigJson.compilerOptions.paths['@proj/my-lib']).toEqual([ @@ -278,7 +264,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', directory: 'my-dir/my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, '/tsconfig.json'); @@ -293,7 +278,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', directory: 'my-dir/my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, 'my-dir/my-lib/tsconfig.json'); @@ -312,7 +296,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', directory: 'my-dir/my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, 'my-dir/my-lib/tsconfig.json'); @@ -326,7 +309,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', directory: 'my-dir/my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, 'my-dir/my-lib/tsconfig.json'); @@ -340,7 +322,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', strict: false, - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, '/my-lib/tsconfig.json'); @@ -366,7 +347,6 @@ describe('lib', () => { await libraryGenerator(tree, { ...defaultOptions, name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, '/my-lib/tsconfig.json'); @@ -388,7 +368,6 @@ describe('lib', () => { name: 'my-lib', directory: 'my-dir/my-lib', importPath: '@myorg/lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, '/tsconfig.base.json'); @@ -400,7 +379,6 @@ describe('lib', () => { ...defaultOptions, name: 'myLib1', importPath: '@myorg/lib', - projectNameAndRootFormat: 'as-provided', }); try { @@ -408,7 +386,6 @@ describe('lib', () => { ...defaultOptions, name: 'myLib2', importPath: '@myorg/lib', - projectNameAndRootFormat: 'as-provided', }); } catch (e) { expect(e.message).toContain( @@ -423,7 +400,6 @@ describe('lib', () => { await libraryGenerator(tree, { ...defaultOptions, name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, '/tsconfig.base.json'); @@ -441,7 +417,6 @@ describe('lib', () => { ...defaultOptions, rootProject: true, name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, '/tsconfig.base.json'); @@ -455,7 +430,6 @@ describe('lib', () => { await libraryGenerator(tree, { ...defaultOptions, name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const packageJson = readJson(tree, 'package.json'); @@ -469,7 +443,6 @@ describe('lib', () => { await libraryGenerator(tree, { ...defaultOptions, name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const eslintJson = readJson(tree, 'my-lib/.eslintrc.json'); @@ -533,7 +506,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', directory: 'my-dir/my-lib', - projectNameAndRootFormat: 'as-provided', }); const eslintJson = readJson(tree, 'my-dir/my-lib/.eslintrc.json'); @@ -597,7 +569,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', js: true, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists(`my-lib/jest.config.js`)).toBeTruthy(); expect(tree.exists('my-lib/src/index.js')).toBeTruthy(); @@ -610,7 +581,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', js: true, - projectNameAndRootFormat: 'as-provided', }); expect( readJson(tree, 'my-lib/tsconfig.json').compilerOptions.allowJs @@ -622,7 +592,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', js: true, - projectNameAndRootFormat: 'as-provided', }); expect(readJson(tree, 'my-lib/tsconfig.lib.json').include).toEqual([ 'src/**/*.ts', @@ -635,7 +604,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', js: true, - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, '/tsconfig.base.json'); expect(tsconfigJson.compilerOptions.paths['@proj/my-lib']).toEqual([ @@ -649,7 +617,6 @@ describe('lib', () => { name: 'my-lib', directory: 'my-dir/my-lib', js: true, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists(`my-dir/my-lib/jest.config.js`)).toBeTruthy(); expect(tree.exists('my-dir/my-lib/src/index.js')).toBeTruthy(); @@ -666,7 +633,6 @@ describe('lib', () => { name: 'my-lib', directory: 'my-dir/my-lib', js: true, - projectNameAndRootFormat: 'as-provided', }); expect(readJson(tree, 'my-dir/my-lib/.eslintrc.json')) .toMatchInlineSnapshot(` @@ -730,7 +696,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('my-lib/tsconfig.spec.json')).toBeTruthy(); @@ -762,7 +727,6 @@ describe('lib', () => { unitTestRunner: 'jest', bundler: 'swc', js: true, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('my-lib/tsconfig.spec.json')).toBeTruthy(); @@ -781,7 +745,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', bundler: 'none', - projectNameAndRootFormat: 'as-provided', }); const config = readProjectConfiguration(tree, 'my-lib'); @@ -792,7 +755,6 @@ describe('lib', () => { await libraryGenerator(tree, { ...defaultOptions, name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const config = readProjectConfiguration(tree, 'my-lib'); @@ -804,7 +766,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); const config = readProjectConfiguration(tree, 'my-lib'); @@ -825,7 +786,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', bundler: 'swc', - projectNameAndRootFormat: 'as-provided', }); const config = readProjectConfiguration(tree, 'my-lib'); @@ -846,7 +806,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', bundler: 'swc', - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('my-lib/.swcrc')).toBeTruthy(); @@ -857,7 +816,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', bundler: 'swc', - projectNameAndRootFormat: 'as-provided', }); const jestConfig = tree.read('my-lib/jest.config.ts').toString(); @@ -869,7 +827,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('my-lib/package.json')).toBeTruthy(); @@ -883,7 +840,6 @@ describe('lib', () => { name: 'my-lib', buildable: true, compiler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); const config = readProjectConfiguration(tree, 'my-lib'); @@ -905,7 +861,6 @@ describe('lib', () => { name: 'my-lib', buildable: true, compiler: 'swc', - projectNameAndRootFormat: 'as-provided', }); const config = readProjectConfiguration(tree, 'my-lib'); @@ -927,7 +882,6 @@ describe('lib', () => { name: 'my-lib', buildable: true, compiler: 'swc', - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('my-lib/.swcrc')).toBeTruthy(); @@ -939,7 +893,6 @@ describe('lib', () => { name: 'my-lib', buildable: true, compiler: 'swc', - projectNameAndRootFormat: 'as-provided', }); const jestConfig = tree.read('my-lib/jest.config.ts').toString(); @@ -952,7 +905,6 @@ describe('lib', () => { name: 'my-lib', buildable: true, compiler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('my-lib/package.json')).toBeTruthy(); @@ -965,7 +917,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', bundler: 'rollup', - projectNameAndRootFormat: 'as-provided', }); const pkgJson = readJson(tree, 'my-lib/package.json'); @@ -977,7 +928,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', bundler: 'rollup', - projectNameAndRootFormat: 'as-provided', }); }); }); @@ -990,7 +940,6 @@ describe('lib', () => { publishable: true, importPath: '@proj/my-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); const config = readProjectConfiguration(tree, 'my-lib'); @@ -1013,7 +962,6 @@ describe('lib', () => { publishable: true, importPath: '@proj/my-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); const config = readProjectConfiguration(tree, 'my-lib'); @@ -1041,7 +989,6 @@ describe('lib', () => { publishable: true, importPath: '@proj/my-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); const nxJson = readJson(tree, 'nx.json'); @@ -1064,7 +1011,6 @@ describe('lib', () => { publishable: true, importPath: '@proj/my-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); const nxJson = readJson(tree, 'nx.json'); @@ -1097,7 +1043,6 @@ describe('lib', () => { publishable: true, importPath: '@proj/my-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); const nxJson = readJson(tree, 'nx.json'); @@ -1126,7 +1071,6 @@ describe('lib', () => { publishable: true, importPath: '@proj/my-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); const nxJson = readJson(tree, 'nx.json'); @@ -1154,7 +1098,6 @@ describe('lib', () => { publishable: true, importPath: '@proj/my-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); const nxJson = readJson(tree, 'nx.json'); @@ -1182,7 +1125,6 @@ describe('lib', () => { publishable: true, importPath: '@proj/my-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', tags: 'one,two', }); @@ -1211,7 +1153,6 @@ describe('lib', () => { publishable: true, importPath: '@proj/my-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', directory: 'packages/my-lib', }); @@ -1240,7 +1181,6 @@ describe('lib', () => { publishable: true, importPath: '@proj/my-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); const nxJson = readJson(tree, 'nx.json'); @@ -1268,7 +1208,6 @@ describe('lib', () => { publishable: true, importPath: '@proj/my-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); const nxJson = readJson(tree, 'nx.json'); @@ -1304,7 +1243,6 @@ describe('lib', () => { publishable: true, importPath: '@proj/my-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); const nxJson = readJson(tree, 'nx.json'); @@ -1346,7 +1284,6 @@ describe('lib', () => { publishable: true, importPath: '@proj/my-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); const nxJson = readJson(tree, 'nx.json'); @@ -1376,7 +1313,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', includeBabelRc: true, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('my-lib/.babelrc')).toBeTruthy(); @@ -1387,7 +1323,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', includeBabelRc: false, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('my-lib/.babelrc')).toBeFalsy(); @@ -1399,7 +1334,6 @@ describe('lib', () => { name: 'my-lib', bundler: 'swc', includeBabelRc: true, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('my-lib/.babelrc')).toBeFalsy(); @@ -1415,7 +1349,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', includeBabelRc: true, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('my-lib/.babelrc')).toBeTruthy(); @@ -1448,7 +1381,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', includeBabelRc: undefined, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('my-lib/.babelrc')).toBeFalsy(); @@ -1463,7 +1395,6 @@ describe('lib', () => { name: 'my-lib', bundler: 'esbuild', unitTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', }); const project = readProjectConfiguration(tree, 'my-lib'); @@ -1495,7 +1426,6 @@ describe('lib', () => { name: 'my-lib', bundler: 'rollup', unitTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', }); expect(readJson(tree, 'my-lib/.eslintrc.json').overrides).toContainEqual({ @@ -1522,7 +1452,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', minimal: false, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('my-lib/README.md')).toBeTruthy(); @@ -1533,7 +1462,6 @@ describe('lib', () => { ...defaultOptions, name: 'my-lib', minimal: true, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('my-lib/README.md')).toBeFalsy(); @@ -1545,7 +1473,6 @@ describe('lib', () => { name: 'my-lib', bundler: 'tsc', minimal: false, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('my-lib/README.md')).toBeTruthy(); @@ -1562,7 +1489,6 @@ describe('lib', () => { name: 'my-lib', bundler: 'tsc', minimal: true, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('my-lib/README.md')).toBeFalsy(); @@ -1579,7 +1505,6 @@ describe('lib', () => { name: 'my-lib', simpleName: true, directory: 'web/my-lib', - projectNameAndRootFormat: 'as-provided', }); expect(tree.read('web/my-lib/src/index.ts', 'utf-8')).toContain( diff --git a/packages/js/src/generators/library/schema.json b/packages/js/src/generators/library/schema.json index 5d7980782f12e..90eaf59a964a6 100644 --- a/packages/js/src/generators/library/schema.json +++ b/packages/js/src/generators/library/schema.json @@ -21,11 +21,6 @@ "description": "Library name.", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "linter": { "description": "The tool to use for running lint checks.", "type": "string", diff --git a/packages/js/src/utils/schema.d.ts b/packages/js/src/utils/schema.d.ts index 9f37dc5211ef3..55f7cb4daa111 100644 --- a/packages/js/src/utils/schema.d.ts +++ b/packages/js/src/utils/schema.d.ts @@ -1,4 +1,3 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { AssetGlob, FileInputOutput } from './assets/assets'; import { TransformerEntry } from './typescript/types'; // nx-ignore-next-line @@ -8,9 +7,8 @@ export type Compiler = 'tsc' | 'swc'; export type Bundler = 'swc' | 'tsc' | 'rollup' | 'vite' | 'esbuild' | 'none'; export interface LibraryGeneratorSchema { - name: string; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; + directory: string; + name?: string; skipFormat?: boolean; tags?: string; skipTsConfig?: boolean; diff --git a/packages/nest/src/generators/application/application.spec.ts b/packages/nest/src/generators/application/application.spec.ts index 9d07d119fff43..ebd8cfcb34bb5 100644 --- a/packages/nest/src/generators/application/application.spec.ts +++ b/packages/nest/src/generators/application/application.spec.ts @@ -16,7 +16,6 @@ describe('application generator', () => { it('should generate project configurations', async () => { await applicationGenerator(tree, { name: appName, - projectNameAndRootFormat: 'as-provided', }); const projectConfigurations = devkit.getProjects(tree); @@ -28,7 +27,6 @@ describe('application generator', () => { it('should generate files', async () => { await applicationGenerator(tree, { name: appName, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists(`${appDirectory}/src/main.ts`)).toBeTruthy(); @@ -48,7 +46,6 @@ describe('application generator', () => { it('should configure tsconfig correctly', async () => { await applicationGenerator(tree, { name: appName, - projectNameAndRootFormat: 'as-provided', }); const tsConfig = devkit.readJson(tree, `${appDirectory}/tsconfig.app.json`); @@ -65,7 +62,6 @@ describe('application generator', () => { await applicationGenerator(tree, { name: appName, strict: true, - projectNameAndRootFormat: 'as-provided', }); const tsConfig = devkit.readJson(tree, `${appDirectory}/tsconfig.app.json`); @@ -84,7 +80,6 @@ describe('application generator', () => { await applicationGenerator(tree, { name: appName, - projectNameAndRootFormat: 'as-provided', }); expect(devkit.formatFiles).toHaveBeenCalled(); @@ -96,7 +91,6 @@ describe('application generator', () => { await applicationGenerator(tree, { name: appName, skipFormat: true, - projectNameAndRootFormat: 'as-provided', }); expect(devkit.formatFiles).not.toHaveBeenCalled(); @@ -108,7 +102,6 @@ describe('application generator', () => { await applicationGenerator(tree, { name: appName, e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', }); const projectConfigurations = devkit.getProjects(tree); diff --git a/packages/nest/src/generators/application/lib/normalize-options.ts b/packages/nest/src/generators/application/lib/normalize-options.ts index 8ec4863cccc67..0109097b715a0 100644 --- a/packages/nest/src/generators/application/lib/normalize-options.ts +++ b/packages/nest/src/generators/application/lib/normalize-options.ts @@ -41,7 +41,6 @@ export function toNodeApplicationGeneratorOptions( name: options.name, directory: options.directory, frontendProject: options.frontendProject, - projectNameAndRootFormat: options.projectNameAndRootFormat, linter: options.linter, skipFormat: true, skipPackageJson: options.skipPackageJson, diff --git a/packages/nest/src/generators/application/schema.d.ts b/packages/nest/src/generators/application/schema.d.ts index 79f86a024e0bb..05d781e9d612f 100644 --- a/packages/nest/src/generators/application/schema.d.ts +++ b/packages/nest/src/generators/application/schema.d.ts @@ -1,10 +1,8 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; export interface ApplicationGeneratorOptions { - name: string; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; + directory: string; + name?: string; frontendProject?: string; linter?: Linter | LinterType; skipFormat?: boolean; diff --git a/packages/nest/src/generators/application/schema.json b/packages/nest/src/generators/application/schema.json index f75c0487da7eb..97ff13816cebd 100644 --- a/packages/nest/src/generators/application/schema.json +++ b/packages/nest/src/generators/application/schema.json @@ -6,24 +6,20 @@ "cli": "nx", "type": "object", "properties": { - "name": { - "description": "The name of the application.", + "directory": { + "description": "The directory of the new application.", "type": "string", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the node application?", - "pattern": "^[a-zA-Z][^:]*$" + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "directory": { - "description": "The directory of the new application.", - "type": "string" - }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { + "description": "The name of the application.", "type": "string", - "enum": ["as-provided", "derived"] + "x-priority": "important" }, "skipFormat": { "description": "Skip formatting files.", @@ -82,5 +78,5 @@ } }, "additionalProperties": false, - "required": ["name"] + "required": ["directory"] } diff --git a/packages/nest/src/generators/library/lib/normalize-options.ts b/packages/nest/src/generators/library/lib/normalize-options.ts index 47a883d7f6fcb..2269af7d33e8e 100644 --- a/packages/nest/src/generators/library/lib/normalize-options.ts +++ b/packages/nest/src/generators/library/lib/normalize-options.ts @@ -74,7 +74,6 @@ export function toJsLibraryGeneratorOptions( unitTestRunner: options.unitTestRunner, config: options.standaloneConfig ? 'project' : 'workspace', setParserOptionsProject: options.setParserOptionsProject, - projectNameAndRootFormat: options.projectNameAndRootFormat, addPlugin: options.addPlugin, }; } diff --git a/packages/nest/src/generators/library/library.spec.ts b/packages/nest/src/generators/library/library.spec.ts index cec5efab34155..4c3883b7faa52 100644 --- a/packages/nest/src/generators/library/library.spec.ts +++ b/packages/nest/src/generators/library/library.spec.ts @@ -16,7 +16,6 @@ describe('lib', () => { it('should update project configuration', async () => { await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); @@ -38,7 +37,6 @@ describe('lib', () => { await libraryGenerator(tree, { name: 'my-lib', controller: true, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists(`my-lib/src/lib/my-lib.controller.ts`)).toBeTruthy(); @@ -48,7 +46,6 @@ describe('lib', () => { await libraryGenerator(tree, { name: 'my-lib', service: true, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists(`my-lib/src/lib/my-lib.service.ts`)).toBeTruthy(); @@ -58,7 +55,6 @@ describe('lib', () => { await libraryGenerator(tree, { name: 'my-lib', global: true, - projectNameAndRootFormat: 'as-provided', }); expect( @@ -70,7 +66,6 @@ describe('lib', () => { await libraryGenerator(tree, { name: 'my-lib', global: true, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists(`my-lib/src/lib/my-lib.spec.ts`)).toBeFalsy(); @@ -82,7 +77,6 @@ describe('lib', () => { name: 'my-lib', controller: true, service: true, - projectNameAndRootFormat: 'as-provided', }); expect( @@ -98,7 +92,6 @@ describe('lib', () => { await libraryGenerator(tree, { name: 'my-lib', tags: 'one,two', - projectNameAndRootFormat: 'as-provided', }); const projects = Object.fromEntries(devkit.getProjects(tree)); @@ -112,7 +105,6 @@ describe('lib', () => { it('should update root tsconfig.json', async () => { await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, '/tsconfig.base.json'); @@ -124,7 +116,6 @@ describe('lib', () => { it('should create a local tsconfig.json', async () => { await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, `my-lib/tsconfig.json`); @@ -134,7 +125,6 @@ describe('lib', () => { it('should extend the local tsconfig.json with tsconfig.spec.json', async () => { await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, `my-lib/tsconfig.spec.json`); @@ -144,7 +134,6 @@ describe('lib', () => { it('should extend the local tsconfig.json with tsconfig.lib.json', async () => { await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, `my-lib/tsconfig.lib.json`); @@ -159,7 +148,6 @@ describe('lib', () => { it('should generate files', async () => { await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists(`my-lib/jest.config.ts`)).toBeTruthy(); @@ -175,7 +163,6 @@ describe('lib', () => { name: 'my-lib', directory: 'my-dir/my-lib', tags: 'one,two', - projectNameAndRootFormat: 'as-provided', }); const projects = Object.fromEntries(devkit.getProjects(tree)); @@ -190,7 +177,6 @@ describe('lib', () => { await libraryGenerator(tree, { name: 'my-lib', directory: 'my-dir/my-lib', - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists(`my-dir/my-lib/jest.config.ts`)).toBeTruthy(); @@ -202,7 +188,6 @@ describe('lib', () => { await libraryGenerator(tree, { name: 'my-lib', directory: 'my-dir/my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, '/tsconfig.base.json'); @@ -216,7 +201,6 @@ describe('lib', () => { await libraryGenerator(tree, { name: 'my-lib', directory: 'my-dir/my-lib', - projectNameAndRootFormat: 'as-provided', }); expect(readJson(tree, `my-dir/my-lib/tsconfig.json`)).toMatchSnapshot(); @@ -228,7 +212,6 @@ describe('lib', () => { await libraryGenerator(tree, { name: 'my-lib', strict: true, - projectNameAndRootFormat: 'as-provided', }); const tsConfig = readJson(tree, `/my-lib/tsconfig.lib.json`); @@ -247,7 +230,6 @@ describe('lib', () => { await libraryGenerator(tree, { name: 'my-lib', unitTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists(`my-lib/tsconfig.spec.json`)).toBeFalsy(); @@ -265,7 +247,6 @@ describe('lib', () => { name: 'my-lib', publishable: true, importPath, - projectNameAndRootFormat: 'as-provided', }); const packageJson = readJson(tree, `my-lib/package.json`); @@ -277,7 +258,6 @@ describe('lib', () => { it('should set target to es6 in tsconfig.lib.json by default', async () => { await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, `my-lib/tsconfig.lib.json`); @@ -288,7 +268,6 @@ describe('lib', () => { await libraryGenerator(tree, { name: 'my-lib', target: 'es2021', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, `my-lib/tsconfig.lib.json`); @@ -302,7 +281,6 @@ describe('lib', () => { await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); expect(devkit.formatFiles).toHaveBeenCalled(); @@ -314,7 +292,6 @@ describe('lib', () => { await libraryGenerator(tree, { name: 'my-lib', skipFormat: true, - projectNameAndRootFormat: 'as-provided', }); expect(devkit.formatFiles).not.toHaveBeenCalled(); @@ -325,7 +302,6 @@ describe('lib', () => { it('should set target jest testEnvironment to node by default', async () => { await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); expect(tree.read(`my-lib/jest.config.ts`, 'utf-8')).toMatchSnapshot(); @@ -335,7 +311,6 @@ describe('lib', () => { await libraryGenerator(tree, { name: 'my-lib', testEnvironment: 'jsdom', - projectNameAndRootFormat: 'as-provided', }); expect(tree.read(`my-lib/jest.config.ts`, 'utf-8')).toMatchSnapshot(); @@ -350,7 +325,6 @@ describe('lib', () => { directory: 'api/my-lib', service: true, controller: true, - projectNameAndRootFormat: 'as-provided', }); const indexFile = tree.read('api/my-lib/src/index.ts', 'utf-8'); diff --git a/packages/nest/src/generators/library/schema.d.ts b/packages/nest/src/generators/library/schema.d.ts index 32e2c032198b1..1339b791f8cb6 100644 --- a/packages/nest/src/generators/library/schema.d.ts +++ b/packages/nest/src/generators/library/schema.d.ts @@ -1,13 +1,11 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; import type { UnitTestRunner } from '../utils'; export interface LibraryGeneratorOptions { - name: string; + directory: string; + name?: string; buildable?: boolean; controller?: boolean; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; global?: boolean; importPath?: string; linter?: Linter | LinterType; diff --git a/packages/nest/src/generators/library/schema.json b/packages/nest/src/generators/library/schema.json index 3af2b19519e0c..0b8fda5617747 100644 --- a/packages/nest/src/generators/library/schema.json +++ b/packages/nest/src/generators/library/schema.json @@ -12,25 +12,20 @@ } ], "properties": { - "name": { - "description": "Library name.", + "directory": { + "description": "A directory where the library is placed.", "type": "string", + "alias": "dir", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$" - }, - "directory": { - "description": "A directory where the library is placed.", - "type": "string", - "alias": "dir" + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the library in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided"] + "name": { + "description": "Library name.", + "type": "string" }, "linter": { "description": "The tool to use for running lint checks.", @@ -143,5 +138,5 @@ } }, "additionalProperties": false, - "required": ["name"] + "required": ["directory"] } diff --git a/packages/next/src/generators/application/application.spec.ts b/packages/next/src/generators/application/application.spec.ts index b9027724515bf..6a3e8c8c5cda7 100644 --- a/packages/next/src/generators/application/application.spec.ts +++ b/packages/next/src/generators/application/application.spec.ts @@ -23,7 +23,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: 'css', - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists(`${name}/public/.gitkeep`)).toBe(true); @@ -35,7 +34,6 @@ describe('app', () => { name, style: 'css', tags: 'one,two', - projectNameAndRootFormat: 'as-provided', }); const projects = Object.fromEntries(getProjects(tree)); @@ -58,7 +56,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: 'css', - projectNameAndRootFormat: 'as-provided', }); const tsConfig = readJson(tree, `${name}/tsconfig.json`); @@ -71,7 +68,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: 'css', - projectNameAndRootFormat: 'as-provided', }); const tsConfig = readJson(tree, `${name}/tsconfig.json`); @@ -100,7 +96,6 @@ describe('app', () => { style: 'css', appDir: true, rootProject: true, - projectNameAndRootFormat: 'as-provided', }); const tsConfig = readJson(tree, 'tsconfig.json'); @@ -122,7 +117,6 @@ describe('app', () => { style: 'none', appDir: true, rootProject: true, - projectNameAndRootFormat: 'as-provided', }); const content = tree.read('src/app/page.tsx').toString(); @@ -141,7 +135,6 @@ describe('app', () => { style: 'css', appDir: false, src: false, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists(`${name}/tsconfig.json`)).toBeTruthy(); expect(tree.exists(`${name}/pages/index.tsx`)).toBeTruthy(); @@ -154,7 +147,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: 'css', - projectNameAndRootFormat: 'as-provided', }); expect(readProjectConfiguration(tree, name).root).toEqual(name); @@ -170,7 +162,6 @@ describe('app', () => { style: 'none', appDir: false, src: false, - projectNameAndRootFormat: 'as-provided', }); const content = tree.read(`${name}/pages/index.tsx`).toString(); @@ -187,7 +178,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: 'scss', - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists(`${name}/src/app/page.module.scss`)).toBeTruthy(); @@ -226,7 +216,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: 'less', - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists(`${name}/src/app/page.module.less`)).toBeTruthy(); @@ -265,7 +254,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: 'styled-components', - projectNameAndRootFormat: 'as-provided', }); expect( @@ -349,7 +337,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: '@emotion/styled', - projectNameAndRootFormat: 'as-provided', }); expect( @@ -371,7 +358,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: '@emotion/styled', - projectNameAndRootFormat: 'as-provided', }); const tsconfigJson = readJson(tree, `${name}/tsconfig.json`); @@ -389,7 +375,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: 'styled-jsx', - projectNameAndRootFormat: 'as-provided', }); const indexContent = tree.read(`${name}/src/app/page.tsx`, 'utf-8'); @@ -454,7 +439,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: 'css', - projectNameAndRootFormat: 'as-provided', }); expect(tree.read(`${name}/jest.config.ts`, 'utf-8')).toContain( @@ -468,7 +452,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: 'css', - projectNameAndRootFormat: 'as-provided', }); expect(tree.read(`${name}/jest.config.ts`, 'utf-8')).toContain( @@ -482,7 +465,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: 'css', - projectNameAndRootFormat: 'as-provided', }); expect(tree.read(join(name, 'next.config.js'), 'utf-8')) @@ -520,7 +502,6 @@ describe('app', () => { name, style: 'css', unitTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('jest.config.ts')).toBeFalsy(); expect(tree.exists(`${name}/specs/index.spec.tsx`)).toBeFalsy(); @@ -535,7 +516,6 @@ describe('app', () => { name, style: 'css', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists(`${name}-e2e`)).toBeFalsy(); }); @@ -549,7 +529,6 @@ describe('app', () => { name, style: 'css', e2eTestRunner: 'cypress', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect(readNxJson(tree).targetDefaults['e2e-ci--**/*']) @@ -571,7 +550,6 @@ describe('app', () => { name, style: 'css', e2eTestRunner: 'playwright', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect(readNxJson(tree).targetDefaults['e2e-ci--**/*']) @@ -591,7 +569,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: 'css', - projectNameAndRootFormat: 'as-provided', }); const appContent = tree.read(`${name}/src/app/page.tsx`, 'utf-8'); @@ -608,7 +585,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: 'css', - projectNameAndRootFormat: 'as-provided', }); expect(tree.read(`${name}/eslint.config.js`, 'utf-8')) @@ -639,7 +615,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: 'css', - projectNameAndRootFormat: 'as-provided', }); const packageJson = readJson(tree, '/package.json'); @@ -707,7 +682,6 @@ describe('app', () => { style: 'css', appDir: true, rootProject: true, - projectNameAndRootFormat: 'as-provided', }); const eslintJSON = readJson(tree, '.eslintrc.json'); @@ -732,7 +706,6 @@ describe('app', () => { style: 'css', appDir: true, rootProject: true, - projectNameAndRootFormat: 'as-provided', src: true, }); @@ -757,7 +730,6 @@ describe('app', () => { style: 'css', appDir: true, rootProject: true, - projectNameAndRootFormat: 'as-provided', src: false, }); @@ -782,7 +754,6 @@ describe('app', () => { style: 'css', appDir: false, rootProject: true, - projectNameAndRootFormat: 'as-provided', src: false, }); @@ -833,7 +804,6 @@ describe('app (legacy)', () => { unitTestRunner: 'jest', style: 'css', e2eTestRunner: 'cypress', - projectNameAndRootFormat: 'as-provided', }; beforeAll(() => { diff --git a/packages/next/src/generators/application/lib/add-linting.spec.ts b/packages/next/src/generators/application/lib/add-linting.spec.ts index 7bda2d12d6ad1..275e812469ba1 100644 --- a/packages/next/src/generators/application/lib/add-linting.spec.ts +++ b/packages/next/src/generators/application/lib/add-linting.spec.ts @@ -27,7 +27,6 @@ describe('updateEslint', () => { fileName: 'index', e2eTestRunner: 'cypress', styledModule: null, - projectNameAndRootFormat: 'as-provided', }; tree = createTreeWithEmptyWorkspace(); const project: ProjectConfiguration = { diff --git a/packages/next/src/generators/application/schema.d.ts b/packages/next/src/generators/application/schema.d.ts index b1e865f2fe7d0..205f3ed4d1467 100644 --- a/packages/next/src/generators/application/schema.d.ts +++ b/packages/next/src/generators/application/schema.d.ts @@ -1,13 +1,11 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; import type { SupportedStyles } from '@nx/react'; export interface Schema { - name: string; + directory: string; + name?: string; style?: SupportedStyles; skipFormat?: boolean; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; tags?: string; unitTestRunner?: 'jest' | 'none'; e2eTestRunner?: 'cypress' | 'playwright' | 'none'; diff --git a/packages/next/src/generators/application/schema.json b/packages/next/src/generators/application/schema.json index 57fa43c312f86..68316a4fe1bd0 100644 --- a/packages/next/src/generators/application/schema.json +++ b/packages/next/src/generators/application/schema.json @@ -6,28 +6,22 @@ "description": "Create a Next.js Application for Nx.", "type": "object", "properties": { - "name": { - "description": "The name of the application.", + "directory": { + "description": "The directory of the new application.", "type": "string", + "alias": "dir", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the application?", "pattern": "^[a-zA-Z][^:]*$", - "x-priority": "important" + "x-prompt": "Which directory do you want to create the application in?" }, - "directory": { - "description": "The directory of the new application.", + "name": { + "description": "The name of the application.", "type": "string", - "alias": "dir", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "style": { "description": "The file extension to be used for style files.", "type": "string", @@ -145,6 +139,6 @@ "x-priority": "internal" } }, - "required": [], + "required": ["directory"], "examplesFile": "../../../docs/application-examples.md" } diff --git a/packages/next/src/generators/component/component.spec.ts b/packages/next/src/generators/component/component.spec.ts index 834adf996de4a..d84c2505c3901 100644 --- a/packages/next/src/generators/component/component.spec.ts +++ b/packages/next/src/generators/component/component.spec.ts @@ -15,7 +15,6 @@ describe('component', () => { await applicationGenerator(tree, { name: appName, style: 'css', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: libName, @@ -24,7 +23,6 @@ describe('component', () => { skipFormat: true, skipTsConfig: false, unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', }); }); diff --git a/packages/next/src/generators/custom-server/custom-server.spec.ts b/packages/next/src/generators/custom-server/custom-server.spec.ts index 46d082189610b..1d5dffe275d5f 100644 --- a/packages/next/src/generators/custom-server/custom-server.spec.ts +++ b/packages/next/src/generators/custom-server/custom-server.spec.ts @@ -15,7 +15,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: 'css', - projectNameAndRootFormat: 'as-provided', customServer: true, }); @@ -33,7 +32,6 @@ describe('app', () => { await applicationGenerator(tree, { name, style: 'css', - projectNameAndRootFormat: 'as-provided', customServer: true, swc: true, }); diff --git a/packages/next/src/generators/cypress-component-configuration/cypress-component-configuration.spec.ts b/packages/next/src/generators/cypress-component-configuration/cypress-component-configuration.spec.ts index 40feba723bb82..208831cd15db6 100644 --- a/packages/next/src/generators/cypress-component-configuration/cypress-component-configuration.spec.ts +++ b/packages/next/src/generators/cypress-component-configuration/cypress-component-configuration.spec.ts @@ -18,7 +18,6 @@ describe('cypress-component-configuration generator', () => { await applicationGenerator(tree, { name: 'demo', style: 'css', - projectNameAndRootFormat: 'as-provided', }); await cypressComponentConfiguration(tree, { generateTests: true, @@ -109,7 +108,6 @@ describe('cypress-component-configuration generator', () => { await applicationGenerator(tree, { name: 'demo', style: 'css', - projectNameAndRootFormat: 'as-provided', }); await setupTailwindGenerator(tree, { project: 'demo' }); await cypressComponentConfiguration(tree, { @@ -137,7 +135,6 @@ describe('cypress-component-configuration generator', () => { style: 'css', unitTestRunner: 'jest', component: true, - projectNameAndRootFormat: 'as-provided', }); await cypressComponentConfiguration(tree, { generateTests: true, diff --git a/packages/next/src/generators/library/library.spec.ts b/packages/next/src/generators/library/library.spec.ts index d5ee8da5f8fa0..06a58c9f55c2c 100644 --- a/packages/next/src/generators/library/library.spec.ts +++ b/packages/next/src/generators/library/library.spec.ts @@ -22,7 +22,6 @@ describe('next library', () => { unitTestRunner: 'jest', style: 'css', component: true, - projectNameAndRootFormat: 'as-provided', }; const appTree = createTreeWithEmptyWorkspace(); @@ -45,7 +44,6 @@ describe('next library', () => { unitTestRunner: 'jest', style: 'css', component: true, - projectNameAndRootFormat: 'as-provided', }; const appTree = createTreeWithEmptyWorkspace(); @@ -79,7 +77,6 @@ describe('next library', () => { unitTestRunner: 'jest', style: 'css', component: true, - projectNameAndRootFormat: 'as-provided', }); expect(appTree.read('my-lib/src/index.ts', 'utf-8')).toContain( @@ -107,7 +104,6 @@ describe('next library', () => { unitTestRunner: 'jest', style: 'css', component: false, - projectNameAndRootFormat: 'as-provided', }); expect( diff --git a/packages/next/src/generators/library/schema.d.ts b/packages/next/src/generators/library/schema.d.ts index 9bc9a4b159025..72c7a282a4504 100644 --- a/packages/next/src/generators/library/schema.d.ts +++ b/packages/next/src/generators/library/schema.d.ts @@ -1,11 +1,9 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; import type { SupportedStyles } from '@nx/react'; export interface Schema { - name: string; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; + directory: string; + name?: string; style: SupportedStyles; skipTsConfig?: boolean; skipFormat?: boolean; diff --git a/packages/next/src/generators/library/schema.json b/packages/next/src/generators/library/schema.json index 16e0933003c00..6786dc493f740 100644 --- a/packages/next/src/generators/library/schema.json +++ b/packages/next/src/generators/library/schema.json @@ -6,28 +6,22 @@ "description": "Create a React Library for an Nx workspace.", "type": "object", "properties": { - "name": { + "directory": { "type": "string", - "description": "Library name", + "description": "A directory where the lib is placed.", + "alias": "dir", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", - "x-priority": "important" + "x-prompt": "Which directory do you want to create the library in?" }, - "directory": { + "name": { "type": "string", - "description": "A directory where the lib is placed.", - "alias": "dir", + "description": "Library name", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "style": { "description": "The file extension to be used for style files.", "type": "string", @@ -145,6 +139,6 @@ "x-priority": "internal" } }, - "required": ["name"], + "required": ["directory"], "examplesFile": "../../../docs/library-examples.md" } diff --git a/packages/next/src/generators/page/page.spec.ts b/packages/next/src/generators/page/page.spec.ts index c153da548a931..ec150e5f20a2b 100644 --- a/packages/next/src/generators/page/page.spec.ts +++ b/packages/next/src/generators/page/page.spec.ts @@ -16,13 +16,11 @@ describe('component', () => { name: projectName, style: 'css', appDir: false, - projectNameAndRootFormat: 'as-provided', }); await applicationGenerator(tree, { name: appRouterProjectName, style: 'css', - projectNameAndRootFormat: 'as-provided', }); }); diff --git a/packages/node/src/generators/application/application.legacy.spec.ts b/packages/node/src/generators/application/application.legacy.spec.ts index 21044e90c13f4..09d36a882da8d 100644 --- a/packages/node/src/generators/application/application.legacy.spec.ts +++ b/packages/node/src/generators/application/application.legacy.spec.ts @@ -24,7 +24,6 @@ describe('node app generator (legacy)', () => { await applicationGenerator(tree, { name: 'my-node-app', bundler: 'webpack', - projectNameAndRootFormat: 'as-provided', addPlugin: false, }); const project = readProjectConfiguration(tree, 'my-node-app'); diff --git a/packages/node/src/generators/application/application.spec.ts b/packages/node/src/generators/application/application.spec.ts index 164c31c95eab2..4137c97f0f708 100644 --- a/packages/node/src/generators/application/application.spec.ts +++ b/packages/node/src/generators/application/application.spec.ts @@ -28,7 +28,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-node-app', bundler: 'webpack', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); const project = readProjectConfiguration(tree, 'my-node-app'); @@ -96,7 +95,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-node-app', tags: 'one,two', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); const projects = Object.fromEntries(getProjects(tree)); @@ -110,7 +108,6 @@ describe('app', () => { it('should generate files', async () => { await applicationGenerator(tree, { name: 'my-node-app', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect(tree.exists(`my-node-app/jest.config.ts`)).toBeTruthy(); @@ -187,7 +184,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-node-app', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); @@ -201,7 +197,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-node-app', directory: 'my-dir/my-node-app', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); const project = readProjectConfiguration(tree, 'my-node-app'); diff --git a/packages/node/src/generators/application/application.ts b/packages/node/src/generators/application/application.ts index 9092525b9c903..ec4800ee7a100 100644 --- a/packages/node/src/generators/application/application.ts +++ b/packages/node/src/generators/application/application.ts @@ -489,7 +489,6 @@ export async function applicationGeneratorInternal(tree: Tree, schema: Schema) { projectType: options.framework === 'none' ? 'cli' : 'server', name: options.rootProject ? 'e2e' : `${options.name}-e2e`, directory: options.rootProject ? 'e2e' : `${options.appProjectRoot}-e2e`, - projectNameAndRootFormat: 'as-provided', project: options.name, port: options.port, isNest: options.isNest, diff --git a/packages/node/src/generators/application/schema.d.ts b/packages/node/src/generators/application/schema.d.ts index 22a7074ec7a4a..e5a15e8a94968 100644 --- a/packages/node/src/generators/application/schema.d.ts +++ b/packages/node/src/generators/application/schema.d.ts @@ -1,12 +1,10 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; export interface Schema { - name: string; + directory: string; + name?: string; skipFormat?: boolean; skipPackageJson?: boolean; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; unitTestRunner?: 'jest' | 'none'; e2eTestRunner?: 'jest' | 'none'; linter?: Linter | LinterType; diff --git a/packages/node/src/generators/application/schema.json b/packages/node/src/generators/application/schema.json index ed0f3aa67a1df..84309625d819d 100644 --- a/packages/node/src/generators/application/schema.json +++ b/packages/node/src/generators/application/schema.json @@ -6,27 +6,21 @@ "description": "Nx Application Options Schema.", "type": "object", "properties": { - "name": { - "description": "The name of the application.", + "directory": { + "description": "The directory of the new application.", "type": "string", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the node application?", - "x-priority": "important", - "pattern": "^[a-zA-Z][^:]*$" + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "directory": { - "description": "The directory of the new application.", + "name": { + "description": "The name of the application.", "type": "string", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "skipFormat": { "description": "Skip formatting files", "type": "boolean", @@ -126,5 +120,5 @@ "description": "Add a docker build target" } }, - "required": ["name"] + "required": ["directory"] } diff --git a/packages/node/src/generators/e2e-project/e2e-project.spec.ts b/packages/node/src/generators/e2e-project/e2e-project.spec.ts index b2b142c03a6a5..943e660d97a16 100644 --- a/packages/node/src/generators/e2e-project/e2e-project.spec.ts +++ b/packages/node/src/generators/e2e-project/e2e-project.spec.ts @@ -16,7 +16,6 @@ describe('e2eProjectGenerator', () => { name: 'api', framework: 'express', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); await e2eProjectGenerator(tree, { @@ -34,7 +33,6 @@ describe('e2eProjectGenerator', () => { framework: 'express', e2eTestRunner: 'none', rootProject: true, - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); await e2eProjectGenerator(tree, { @@ -52,7 +50,6 @@ describe('e2eProjectGenerator', () => { name: 'api', framework: 'none', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); await e2eProjectGenerator(tree, { diff --git a/packages/node/src/generators/e2e-project/schema.d.ts b/packages/node/src/generators/e2e-project/schema.d.ts index 84553f19a0e62..de6eeaee1f455 100644 --- a/packages/node/src/generators/e2e-project/schema.d.ts +++ b/packages/node/src/generators/e2e-project/schema.d.ts @@ -1,10 +1,7 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; - export interface Schema { project: string; projectType: 'server' | 'cli'; directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; name?: string; port?: number; linter?: 'eslint' | 'none'; diff --git a/packages/node/src/generators/e2e-project/schema.json b/packages/node/src/generators/e2e-project/schema.json index 35171878fdb78..7add1fb212098 100644 --- a/packages/node/src/generators/e2e-project/schema.json +++ b/packages/node/src/generators/e2e-project/schema.json @@ -18,11 +18,6 @@ "type": "string", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "name": { "description": "The name of the e2e project. Defaults to the project name with '-e2e' suffix.", "type": "string" diff --git a/packages/node/src/generators/library/library.spec.ts b/packages/node/src/generators/library/library.spec.ts index e2cc0c8155ae5..aa96e8e3f1870 100644 --- a/packages/node/src/generators/library/library.spec.ts +++ b/packages/node/src/generators/library/library.spec.ts @@ -14,7 +14,6 @@ import { libraryGenerator } from './library'; const baseLibraryConfig = { name: 'my-lib', compiler: 'tsc' as const, - projectNameAndRootFormat: 'as-provided' as const, addPlugin: true, }; @@ -511,7 +510,6 @@ describe('lib', () => { name: 'my-lib', directory: 'my-dir/my-lib', js: true, - projectNameAndRootFormat: 'as-provided', } as Schema); expect(tree.exists(`my-dir/my-lib/jest.config.js`)).toBeTruthy(); expect(tree.exists('my-dir/my-lib/src/index.js')).toBeTruthy(); diff --git a/packages/node/src/generators/library/schema.d.ts b/packages/node/src/generators/library/schema.d.ts index 927b59c3e9fa2..ffe32d161a35d 100644 --- a/packages/node/src/generators/library/schema.d.ts +++ b/packages/node/src/generators/library/schema.d.ts @@ -1,10 +1,8 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; export interface Schema { - name: string; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; + directory: string; + name?: string; simpleModuleName?: boolean; skipTsConfig?: boolean; skipFormat?: boolean; diff --git a/packages/node/src/generators/library/schema.json b/packages/node/src/generators/library/schema.json index 55ab62c5542f6..5ffd6a8ef3f52 100644 --- a/packages/node/src/generators/library/schema.json +++ b/packages/node/src/generators/library/schema.json @@ -12,29 +12,24 @@ } ], "properties": { - "name": { + "directory": { "type": "string", - "description": "Library name", + "description": "A directory where the lib is placed", + "alias": "dir", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$" + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the library in?" }, - "directory": { + "name": { "type": "string", - "description": "A directory where the lib is placed", - "alias": "dir", + "description": "Library name", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "simpleModuleName": { - "description": "Keep the module name simple (when using `--directory`).", + "description": "Keep the module name simple.", "type": "boolean", "default": false }, @@ -126,5 +121,5 @@ "default": false } }, - "required": ["name"] + "required": ["directory"] } diff --git a/packages/node/src/generators/setup-docker/setup-docker.spec.ts b/packages/node/src/generators/setup-docker/setup-docker.spec.ts index 7f344b7feea78..e482bcc12583e 100644 --- a/packages/node/src/generators/setup-docker/setup-docker.spec.ts +++ b/packages/node/src/generators/setup-docker/setup-docker.spec.ts @@ -19,7 +19,6 @@ describe('setupDockerGenerator', () => { framework: 'express', e2eTestRunner: 'none', docker: true, - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); @@ -48,7 +47,6 @@ describe('setupDockerGenerator', () => { framework: 'fastify', rootProject: true, docker: true, - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); diff --git a/packages/nuxt/src/generators/application/application.spec.ts b/packages/nuxt/src/generators/application/application.spec.ts index d59e487fe07bb..f35d3ca41429a 100644 --- a/packages/nuxt/src/generators/application/application.spec.ts +++ b/packages/nuxt/src/generators/application/application.spec.ts @@ -18,7 +18,6 @@ describe('app', () => { it('should not add targets', async () => { await applicationGenerator(tree, { name, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'vitest', }); @@ -33,7 +32,6 @@ describe('app', () => { it('should create all new files in the correct location', async () => { await applicationGenerator(tree, { name, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'vitest', }); @@ -44,7 +42,6 @@ describe('app', () => { it('should add nuxt entries in .gitignore', async () => { await applicationGenerator(tree, { name, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'vitest', }); @@ -54,7 +51,6 @@ describe('app', () => { it('should configure nuxt correctly', async () => { await applicationGenerator(tree, { name, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'vitest', }); @@ -68,7 +64,6 @@ describe('app', () => { await applicationGenerator(tree, { name, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'vitest', }); @@ -80,7 +75,6 @@ describe('app', () => { it('should configure eslint correctly (eslintrc)', async () => { await applicationGenerator(tree, { name, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'vitest', }); @@ -92,7 +86,6 @@ describe('app', () => { it('should configure vitest correctly', async () => { await applicationGenerator(tree, { name, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'vitest', }); @@ -110,7 +103,6 @@ describe('app', () => { it('should configure tsconfig and project.json correctly', async () => { await applicationGenerator(tree, { name, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'vitest', }); @@ -121,7 +113,6 @@ describe('app', () => { it('should add the nuxt and vitest plugins', async () => { await applicationGenerator(tree, { name, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'vitest', }); @@ -164,7 +155,6 @@ describe('app', () => { it('should configure css', async () => { await applicationGenerator(tree, { name: 'myapp1', - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'none', style: 'css', }); @@ -175,7 +165,6 @@ describe('app', () => { it('should configure scss', async () => { await applicationGenerator(tree, { name: 'myapp2', - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'none', style: 'scss', }); @@ -186,7 +175,6 @@ describe('app', () => { it('should configure less', async () => { await applicationGenerator(tree, { name: 'myapp3', - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'none', style: 'less', }); @@ -197,7 +185,6 @@ describe('app', () => { it('should not configure styles', async () => { await applicationGenerator(tree, { name: 'myapp4', - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'none', style: 'none', }); diff --git a/packages/nuxt/src/generators/application/schema.d.ts b/packages/nuxt/src/generators/application/schema.d.ts index 596b214406539..a758930a817ad 100644 --- a/packages/nuxt/src/generators/application/schema.d.ts +++ b/packages/nuxt/src/generators/application/schema.d.ts @@ -1,10 +1,8 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; export interface Schema { - name: string; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; + directory: string; + name?: string; linter?: Linter | LinterType; skipFormat?: boolean; unitTestRunner?: 'vitest' | 'none'; diff --git a/packages/nuxt/src/generators/application/schema.json b/packages/nuxt/src/generators/application/schema.json index ab2e6a12bf841..5505f48d363e7 100644 --- a/packages/nuxt/src/generators/application/schema.json +++ b/packages/nuxt/src/generators/application/schema.json @@ -6,28 +6,22 @@ "description": "Create a Nuxt Application for Nx.", "type": "object", "properties": { - "name": { - "description": "The name of the application.", + "directory": { + "description": "The directory of the new application.", "type": "string", + "alias": "dir", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the application?", "pattern": "^[a-zA-Z][^:]*$", - "x-priority": "important" + "x-prompt": "Which directory do you want to create the application in?" }, - "directory": { - "description": "The directory of the new application.", + "name": { + "description": "The name of the application.", "type": "string", - "alias": "dir", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "linter": { "description": "The tool to use for running lint checks.", "type": "string", @@ -105,6 +99,6 @@ "default": false } }, - "required": [], + "required": ["directory"], "examplesFile": "../../../docs/application-examples.md" } diff --git a/packages/nuxt/src/generators/storybook-configuration/configuration.spec.ts b/packages/nuxt/src/generators/storybook-configuration/configuration.spec.ts index 0aa17450c27ce..a6c521b407a16 100644 --- a/packages/nuxt/src/generators/storybook-configuration/configuration.spec.ts +++ b/packages/nuxt/src/generators/storybook-configuration/configuration.spec.ts @@ -90,7 +90,6 @@ export async function createTestApp( unitTestRunner: 'none', name: appName, js: plainJS, - projectNameAndRootFormat: 'as-provided', }); await componentGenerator(appTree, { diff --git a/packages/nx/src/migrations/update-16-9-0/remove-project-name-and-root-format.spec.ts b/packages/nx/src/migrations/update-16-9-0/remove-project-name-and-root-format.spec.ts index 40398573651f6..598cc9c72c8ca 100644 --- a/packages/nx/src/migrations/update-16-9-0/remove-project-name-and-root-format.spec.ts +++ b/packages/nx/src/migrations/update-16-9-0/remove-project-name-and-root-format.spec.ts @@ -24,7 +24,6 @@ describe('removeProjectNameAndRootFormat', () => { const nxJson: any = { workspaceLayout: { libsDir: 'libs', - projectNameAndRootFormat: 'as-provided', }, }; writeJson(tree, 'nx.json', nxJson); @@ -36,9 +35,7 @@ describe('removeProjectNameAndRootFormat', () => { it('should remove workspaceLayout if it is present', async () => { const nxJson: any = { - workspaceLayout: { - projectNameAndRootFormat: 'as-provided', - }, + workspaceLayout: {}, }; writeJson(tree, 'nx.json', nxJson); await removeProjectNameAndRootFormat(tree); diff --git a/packages/plugin/src/generators/create-package/create-package.spec.ts b/packages/plugin/src/generators/create-package/create-package.spec.ts index e0e497ac11145..2a1cf22537206 100644 --- a/packages/plugin/src/generators/create-package/create-package.spec.ts +++ b/packages/plugin/src/generators/create-package/create-package.spec.ts @@ -28,7 +28,6 @@ const getSchema: ( skipLintChecks: false, linter: Linter.EsLint, unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', ...overrides, }); @@ -47,7 +46,6 @@ describe('NxPlugin Create Package Generator', () => { skipLintChecks: false, linter: Linter.EsLint, unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', }); }); diff --git a/packages/plugin/src/generators/create-package/create-package.ts b/packages/plugin/src/generators/create-package/create-package.ts index c1d927da21a6f..3779b8ae7fbe8 100644 --- a/packages/plugin/src/generators/create-package/create-package.ts +++ b/packages/plugin/src/generators/create-package/create-package.ts @@ -86,6 +86,7 @@ async function createCliPackage( pluginPackageName: string ) { await jsLibraryGenerator(host, { + directory: options.name, ...options, rootProject: false, config: 'project', diff --git a/packages/plugin/src/generators/create-package/schema.d.ts b/packages/plugin/src/generators/create-package/schema.d.ts index 9c25eba17a79a..12e13da16133f 100644 --- a/packages/plugin/src/generators/create-package/schema.d.ts +++ b/packages/plugin/src/generators/create-package/schema.d.ts @@ -1,4 +1,3 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; export interface CreatePackageSchema { @@ -7,7 +6,6 @@ export interface CreatePackageSchema { // options to create cli package, passed to js library generator directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; skipFormat: boolean; tags?: string; unitTestRunner: 'jest' | 'none'; diff --git a/packages/plugin/src/generators/create-package/schema.json b/packages/plugin/src/generators/create-package/schema.json index 5bd26ec53a78d..f954a8b59e347 100644 --- a/packages/plugin/src/generators/create-package/schema.json +++ b/packages/plugin/src/generators/create-package/schema.json @@ -37,11 +37,6 @@ "type": "string", "description": "A directory where the app is placed." }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "linter": { "description": "The tool to use for running lint checks.", "type": "string", diff --git a/packages/plugin/src/generators/e2e-project/schema.d.ts b/packages/plugin/src/generators/e2e-project/schema.d.ts index 98423d1e14689..14d72bef2806d 100644 --- a/packages/plugin/src/generators/e2e-project/schema.d.ts +++ b/packages/plugin/src/generators/e2e-project/schema.d.ts @@ -1,11 +1,9 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; export interface Schema { pluginName: string; npmPackageName: string; projectDirectory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; pluginOutputPath?: string; jestConfig?: string; linter?: Linter | LinterType; diff --git a/packages/plugin/src/generators/e2e-project/schema.json b/packages/plugin/src/generators/e2e-project/schema.json index a5de92ffdbaa2..60b91cdbed8c6 100644 --- a/packages/plugin/src/generators/e2e-project/schema.json +++ b/packages/plugin/src/generators/e2e-project/schema.json @@ -21,11 +21,6 @@ "type": "string", "description": "the directory where the plugin is placed." }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "pluginOutputPath": { "type": "string", "description": "the output path of the plugin after it builds.", diff --git a/packages/plugin/src/generators/executor/executor.spec.ts b/packages/plugin/src/generators/executor/executor.spec.ts index 89f7803565fb4..c1755213e2b55 100644 --- a/packages/plugin/src/generators/executor/executor.spec.ts +++ b/packages/plugin/src/generators/executor/executor.spec.ts @@ -22,7 +22,6 @@ describe('NxPlugin Executor Generator', () => { unitTestRunner: 'jest', linter: Linter.EsLint, compiler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); }); @@ -137,7 +136,6 @@ describe('NxPlugin Executor Generator', () => { await jsLibraryGenerator(tree, { name: 'test-js-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); const libConfig = readProjectConfiguration(tree, 'test-js-lib'); diff --git a/packages/plugin/src/generators/generator/generator.spec.ts b/packages/plugin/src/generators/generator/generator.spec.ts index 2ba0184cc1365..15773c87797dd 100644 --- a/packages/plugin/src/generators/generator/generator.spec.ts +++ b/packages/plugin/src/generators/generator/generator.spec.ts @@ -23,7 +23,6 @@ describe('NxPlugin Generator Generator', () => { setCwd(''); await pluginGenerator(tree, { name: projectName, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'jest', linter: Linter.EsLint, compiler: 'tsc', @@ -193,7 +192,6 @@ describe('NxPlugin Generator Generator', () => { await jsLibraryGenerator(tree, { name: 'test-js-lib', bundler: 'tsc', - projectNameAndRootFormat: 'as-provided', }); const libConfig = readProjectConfiguration(tree, 'test-js-lib'); await generatorGenerator(tree, { diff --git a/packages/plugin/src/generators/migration/migration.spec.ts b/packages/plugin/src/generators/migration/migration.spec.ts index fb4eb44b00ee6..89f91eb0e4e4f 100644 --- a/packages/plugin/src/generators/migration/migration.spec.ts +++ b/packages/plugin/src/generators/migration/migration.spec.ts @@ -19,7 +19,6 @@ describe('NxPlugin migration generator', () => { await pluginGenerator(tree, { name: projectName, directory: 'packages/my-plugin', - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'jest', linter: Linter.EsLint, compiler: 'tsc', diff --git a/packages/plugin/src/generators/plugin/plugin.ts b/packages/plugin/src/generators/plugin/plugin.ts index 7395cbf4cc47e..c5a561226a8f2 100644 --- a/packages/plugin/src/generators/plugin/plugin.ts +++ b/packages/plugin/src/generators/plugin/plugin.ts @@ -86,7 +86,6 @@ export async function pluginGenerator(host: Tree, schema: Schema) { bundler: options.bundler, publishable: options.publishable, importPath: options.npmPackageName, - projectNameAndRootFormat: 'as-provided', skipFormat: true, }) ); @@ -129,7 +128,6 @@ export async function pluginGenerator(host: Tree, schema: Schema) { npmPackageName: options.npmPackageName, skipFormat: true, rootProject: options.rootProject, - projectNameAndRootFormat: options.projectNameAndRootFormat, }) ); } diff --git a/packages/plugin/src/generators/plugin/schema.d.ts b/packages/plugin/src/generators/plugin/schema.d.ts index 1f6a6ae9abc44..3ca1321201740 100644 --- a/packages/plugin/src/generators/plugin/schema.d.ts +++ b/packages/plugin/src/generators/plugin/schema.d.ts @@ -1,10 +1,8 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; export interface Schema { - name: string; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; + directory: string; + name?: string; importPath?: string; skipTsConfig?: boolean; // default is false skipFormat?: boolean; // default is false diff --git a/packages/plugin/src/generators/plugin/schema.json b/packages/plugin/src/generators/plugin/schema.json index 93312df508bde..0d1a223f71a5a 100644 --- a/packages/plugin/src/generators/plugin/schema.json +++ b/packages/plugin/src/generators/plugin/schema.json @@ -12,25 +12,20 @@ } ], "properties": { - "name": { + "directory": { "type": "string", - "description": "Plugin name", + "description": "A directory where the plugin is placed.", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the plugin?", - "x-priority": "important", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$" + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the plugin in?" }, - "directory": { - "type": "string", - "description": "A directory where the plugin is placed." - }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { "type": "string", - "enum": ["as-provided", "derived"] + "description": "Plugin name", + "x-priority": "important" }, "importPath": { "type": "string", @@ -100,5 +95,5 @@ "default": false } }, - "required": ["name"] + "required": ["directory"] } diff --git a/packages/react-native/src/generators/application/application.spec.ts b/packages/react-native/src/generators/application/application.spec.ts index 6b7b5b4be25e8..6056fbee13f79 100644 --- a/packages/react-native/src/generators/application/application.spec.ts +++ b/packages/react-native/src/generators/application/application.spec.ts @@ -25,7 +25,6 @@ describe('app', () => { linter: Linter.EsLint, e2eTestRunner: 'none', install: false, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'none', bundler: 'vite', }); @@ -42,7 +41,6 @@ describe('app', () => { linter: Linter.EsLint, e2eTestRunner: 'none', install: false, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'none', bundler: 'vite', }); @@ -60,7 +58,6 @@ describe('app', () => { linter: Linter.EsLint, e2eTestRunner: 'none', install: false, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'jest', bundler: 'vite', }); @@ -106,7 +103,6 @@ describe('app', () => { linter: Linter.EsLint, e2eTestRunner: 'none', install: false, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'jest', bundler: 'vite', }); @@ -123,7 +119,6 @@ describe('app', () => { linter: Linter.EsLint, e2eTestRunner: 'none', install: false, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'none', bundler: 'vite', }); @@ -140,7 +135,6 @@ describe('app', () => { linter: Linter.EsLint, e2eTestRunner: 'detox', install: false, - projectNameAndRootFormat: 'as-provided', bundler: 'vite', unitTestRunner: 'none', }); @@ -192,7 +186,6 @@ describe('app', () => { linter: Linter.EsLint, e2eTestRunner: 'detox', install: false, - projectNameAndRootFormat: 'as-provided', bundler: 'vite', unitTestRunner: 'none', }); @@ -249,7 +242,6 @@ describe('app', () => { e2eTestRunner: 'none', install: false, skipPackageJson: true, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'none', bundler: 'webpack', }); diff --git a/packages/react-native/src/generators/application/lib/add-e2e.ts b/packages/react-native/src/generators/application/lib/add-e2e.ts index 6aff1fc81dd2f..a1be66b8be745 100644 --- a/packages/react-native/src/generators/application/lib/add-e2e.ts +++ b/packages/react-native/src/generators/application/lib/add-e2e.ts @@ -36,7 +36,6 @@ export async function addE2e( ...options, e2eName: options.e2eProjectName, e2eDirectory: options.e2eProjectRoot, - projectNameAndRootFormat: 'as-provided', appProject: options.projectName, appDisplayName: options.displayName, appName: options.name, diff --git a/packages/react-native/src/generators/application/lib/normalize-options.spec.ts b/packages/react-native/src/generators/application/lib/normalize-options.spec.ts index 7801876477c6b..903727b815355 100644 --- a/packages/react-native/src/generators/application/lib/normalize-options.spec.ts +++ b/packages/react-native/src/generators/application/lib/normalize-options.spec.ts @@ -17,7 +17,6 @@ describe('Normalize Options', () => { linter: Linter.EsLint, e2eTestRunner: 'none', install: false, - projectNameAndRootFormat: 'as-provided', unitTestRunner: 'none', bundler: 'vite', }; @@ -34,7 +33,6 @@ describe('Normalize Options', () => { name: 'my-app', parsedTags: [], projectName: 'my-app', - projectNameAndRootFormat: 'as-provided', linter: Linter.EsLint, entryFile: 'src/main.tsx', e2eTestRunner: 'none', @@ -52,7 +50,6 @@ describe('Normalize Options', () => { name: 'myApp', e2eTestRunner: 'none', install: false, - projectNameAndRootFormat: 'as-provided', linter: Linter.None, unitTestRunner: 'none', bundler: 'vite', @@ -70,7 +67,6 @@ describe('Normalize Options', () => { name: 'myApp', parsedTags: [], projectName: 'myApp', - projectNameAndRootFormat: 'as-provided', entryFile: 'src/main.tsx', e2eTestRunner: 'none', unitTestRunner: 'none', @@ -89,7 +85,6 @@ describe('Normalize Options', () => { directory: 'directory/my-app', e2eTestRunner: 'none', install: false, - projectNameAndRootFormat: 'as-provided', linter: Linter.None, unitTestRunner: 'none', bundler: 'vite', @@ -108,7 +103,6 @@ describe('Normalize Options', () => { directory: 'directory/my-app', parsedTags: [], projectName: 'my-app', - projectNameAndRootFormat: 'as-provided', entryFile: 'src/main.tsx', e2eTestRunner: 'none', unitTestRunner: 'none', @@ -126,7 +120,6 @@ describe('Normalize Options', () => { name: 'directory/my-app', e2eTestRunner: 'none', install: false, - projectNameAndRootFormat: 'as-provided', linter: Linter.None, unitTestRunner: 'none', bundler: 'vite', @@ -144,7 +137,6 @@ describe('Normalize Options', () => { name: 'my-app', parsedTags: [], projectName: 'my-app', - projectNameAndRootFormat: 'as-provided', entryFile: 'src/main.tsx', e2eTestRunner: 'none', unitTestRunner: 'none', @@ -163,7 +155,6 @@ describe('Normalize Options', () => { displayName: 'My App', e2eTestRunner: 'none', install: false, - projectNameAndRootFormat: 'as-provided', linter: Linter.None, unitTestRunner: 'none', bundler: 'vite', @@ -181,7 +172,6 @@ describe('Normalize Options', () => { name: 'my-app', parsedTags: [], projectName: 'my-app', - projectNameAndRootFormat: 'as-provided', entryFile: 'src/main.tsx', e2eTestRunner: 'none', unitTestRunner: 'none', diff --git a/packages/react-native/src/generators/application/schema.d.ts b/packages/react-native/src/generators/application/schema.d.ts index 8559280626967..b0066e4bd8a99 100644 --- a/packages/react-native/src/generators/application/schema.d.ts +++ b/packages/react-native/src/generators/application/schema.d.ts @@ -1,13 +1,11 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; export interface Schema { - name: string; + directory: string; + name?: string; displayName?: string; style?: string; skipFormat?: boolean; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; tags?: string; unitTestRunner: 'jest' | 'none'; // default is jest classComponent?: boolean; diff --git a/packages/react-native/src/generators/application/schema.json b/packages/react-native/src/generators/application/schema.json index ff383d32b2847..feb8b750ac4e7 100644 --- a/packages/react-native/src/generators/application/schema.json +++ b/packages/react-native/src/generators/application/schema.json @@ -16,29 +16,24 @@ ], "type": "object", "properties": { - "name": { - "description": "The name of the application.", + "directory": { + "description": "The directory of the new application.", "type": "string", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the application?", - "pattern": "^[a-zA-Z][^:]*$" + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "displayName": { - "description": "The display name to show in the application. Defaults to name.", + "name": { + "description": "The name of the application.", "type": "string" }, - "directory": { - "description": "The directory of the new application.", + "displayName": { + "description": "The display name to show in the application. Defaults to name.", "type": "string" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "skipFormat": { "description": "Skip formatting files", "type": "boolean", @@ -99,5 +94,5 @@ "x-priority": "important" } }, - "required": [] + "required": ["directory"] } diff --git a/packages/react-native/src/generators/library/library.spec.ts b/packages/react-native/src/generators/library/library.spec.ts index d8aa486ceca00..052903e71b60b 100644 --- a/packages/react-native/src/generators/library/library.spec.ts +++ b/packages/react-native/src/generators/library/library.spec.ts @@ -21,7 +21,6 @@ describe('lib', () => { skipTsConfig: false, unitTestRunner: 'jest', strict: true, - projectNameAndRootFormat: 'as-provided', addPlugin: true, }; diff --git a/packages/react-native/src/generators/library/schema.d.ts b/packages/react-native/src/generators/library/schema.d.ts index a8755a9683d31..63a11185cf23c 100644 --- a/packages/react-native/src/generators/library/schema.d.ts +++ b/packages/react-native/src/generators/library/schema.d.ts @@ -1,13 +1,11 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; /** * Same as the @nx/react library schema, except it removes keys: style, component, routing, appProject */ export interface Schema { - name: string; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; + directory: string; + name?: string; skipTsConfig: boolean; skipFormat: boolean; tags?: string; diff --git a/packages/react-native/src/generators/library/schema.json b/packages/react-native/src/generators/library/schema.json index f7a48eb14dd3e..986dc6d49516c 100644 --- a/packages/react-native/src/generators/library/schema.json +++ b/packages/react-native/src/generators/library/schema.json @@ -12,27 +12,22 @@ } ], "properties": { - "name": { + "directory": { "type": "string", - "description": "Library name.", + "description": "A directory where the lib is placed.", + "alias": "dir", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$" + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the library in?" }, - "directory": { + "name": { "type": "string", - "description": "A directory where the lib is placed.", - "alias": "dir", + "description": "Library name.", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "linter": { "description": "The tool to use for running lint checks.", "type": "string", @@ -97,5 +92,5 @@ "x-priority": "internal" } }, - "required": ["name"] + "required": ["directory"] } diff --git a/packages/react-native/src/utils/testing-generators.ts b/packages/react-native/src/utils/testing-generators.ts index 7592008601ca6..61c00cad55af9 100644 --- a/packages/react-native/src/utils/testing-generators.ts +++ b/packages/react-native/src/utils/testing-generators.ts @@ -8,10 +8,9 @@ export async function createApp(tree: Tree, appName: string): Promise { skipFormat: true, style: 'css', unitTestRunner: 'none', - name: appName, + directory: appName, e2eTestRunner: 'none', install: false, - projectNameAndRootFormat: 'as-provided', bundler: 'webpack', }); } diff --git a/packages/react/src/generators/application/application.legacy.spec.ts b/packages/react/src/generators/application/application.legacy.spec.ts index 0e423d866b132..11bb31b196172 100644 --- a/packages/react/src/generators/application/application.legacy.spec.ts +++ b/packages/react/src/generators/application/application.legacy.spec.ts @@ -19,7 +19,6 @@ describe('react app generator (legacy)', () => { linter: Linter.EsLint, style: 'css', strict: true, - projectNameAndRootFormat: 'as-provided', addPlugin: false, }; let mockedInstalledCypressVersion: jest.Mock< diff --git a/packages/react/src/generators/application/application.spec.ts b/packages/react/src/generators/application/application.spec.ts index b5f5ffb143076..5ace85361850d 100644 --- a/packages/react/src/generators/application/application.spec.ts +++ b/packages/react/src/generators/application/application.spec.ts @@ -29,7 +29,6 @@ describe('app', () => { linter: Linter.EsLint, style: 'css', strict: true, - projectNameAndRootFormat: 'as-provided', addPlugin: true, }; let mockedInstalledCypressVersion: jest.Mock< diff --git a/packages/react/src/generators/application/schema.d.ts b/packages/react/src/generators/application/schema.d.ts index c6a32a5a425e9..c0acac95870e0 100644 --- a/packages/react/src/generators/application/schema.d.ts +++ b/packages/react/src/generators/application/schema.d.ts @@ -1,13 +1,11 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; import type { SupportedStyles } from '../../../typings/style'; export interface Schema { - name: string; + directory: string; + name?: string; style: SupportedStyles; skipFormat?: boolean; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; tags?: string; unitTestRunner?: 'jest' | 'vitest' | 'none'; inSourceTests?: boolean; diff --git a/packages/react/src/generators/application/schema.json b/packages/react/src/generators/application/schema.json index 7d3bd32f70ad9..4ca805d17e9c7 100644 --- a/packages/react/src/generators/application/schema.json +++ b/packages/react/src/generators/application/schema.json @@ -6,41 +6,36 @@ "description": "Create a React application for Nx.", "examples": [ { - "command": "nx g app myapp --directory=myorg", + "command": "nx g app apps/myorg/myapp", "description": "Generate `apps/myorg/myapp` and `apps/myorg/myapp-e2e`" }, { - "command": "nx g app myapp --classComponent", + "command": "nx g app apps/myapp --classComponent", "description": "Use class components instead of functional components" }, { - "command": "nx g app myapp --routing", + "command": "nx g app apps/myapp --routing", "description": "Set up React Router" } ], "type": "object", "properties": { - "name": { - "description": "The name of the application.", + "directory": { + "description": "The directory of the new application.", "type": "string", + "alias": "dir", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the application?", - "pattern": "^[a-zA-Z][^:]*$" + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "directory": { - "description": "The directory of the new application.", + "name": { + "description": "The name of the application.", "type": "string", - "alias": "dir", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "style": { "description": "The file extension to be used for style files.", "type": "string", @@ -190,6 +185,6 @@ "default": false } }, - "required": ["name"], + "required": ["directory"], "examplesFile": "../../../docs/application-examples.md" } diff --git a/packages/react/src/generators/component-story/component-story.spec.ts b/packages/react/src/generators/component-story/component-story.spec.ts index 397a5b6c0bd40..ce0cb93749f4c 100644 --- a/packages/react/src/generators/component-story/component-story.spec.ts +++ b/packages/react/src/generators/component-story/component-story.spec.ts @@ -606,7 +606,6 @@ export async function createTestUILib(libName: string): Promise { skipTsConfig: false, style: 'css', unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', }); const currentWorkspaceJson = getProjects(appTree); diff --git a/packages/react/src/generators/component-test/component-test.spec.ts b/packages/react/src/generators/component-test/component-test.spec.ts index c738c4470f85b..d5890b27fe616 100644 --- a/packages/react/src/generators/component-test/component-test.spec.ts +++ b/packages/react/src/generators/component-test/component-test.spec.ts @@ -202,7 +202,6 @@ export function AnotherCmp() { style: 'scss', unitTestRunner: 'none', component: true, - projectNameAndRootFormat: 'as-provided', }); tree.write( @@ -246,7 +245,6 @@ export function AnotherCmp2() { style: 'scss', unitTestRunner: 'none', component: true, - projectNameAndRootFormat: 'as-provided', }); tree.write( @@ -292,7 +290,6 @@ export function AnotherCmp2() { style: 'scss', unitTestRunner: 'none', component: true, - projectNameAndRootFormat: 'as-provided', }); tree.write( @@ -332,7 +329,6 @@ export function AnotherCmp(props: AnotherCmpProps) { style: 'scss', unitTestRunner: 'none', component: true, - projectNameAndRootFormat: 'as-provided', }); tree.write( @@ -368,7 +364,6 @@ export function AnotherCmp(props: AnotherCmpProps) { style: 'scss', unitTestRunner: 'none', component: true, - projectNameAndRootFormat: 'as-provided', }); tree.write( @@ -405,7 +400,6 @@ export function AnotherCmp(props: AnotherCmpProps) { style: 'scss', unitTestRunner: 'none', component: true, - projectNameAndRootFormat: 'as-provided', }); await componentTestGenerator(tree, { project: 'some-lib', @@ -427,7 +421,6 @@ export function AnotherCmp(props: AnotherCmpProps) { style: 'scss', unitTestRunner: 'none', component: true, - projectNameAndRootFormat: 'as-provided', }); tree.write( @@ -466,7 +459,6 @@ export default function AnotherCmp(props: AnotherCmpProps) { style: 'scss', unitTestRunner: 'none', component: true, - projectNameAndRootFormat: 'as-provided', }); tree.write( diff --git a/packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.spec.ts b/packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.spec.ts index 49f748b4d8351..6a237acc6ce66 100644 --- a/packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.spec.ts +++ b/packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.spec.ts @@ -70,7 +70,6 @@ describe('React:CypressComponentTestConfiguration', () => { unitTestRunner: 'none', name: 'my-app', bundler: 'vite', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { linter: Linter.EsLint, @@ -80,7 +79,6 @@ describe('React:CypressComponentTestConfiguration', () => { style: 'scss', unitTestRunner: 'none', component: true, - projectNameAndRootFormat: 'as-provided', }); projectGraph = { @@ -128,7 +126,6 @@ describe('React:CypressComponentTestConfiguration', () => { unitTestRunner: 'none', name: 'my-app', bundler: 'vite', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { linter: Linter.EsLint, @@ -138,7 +135,6 @@ describe('React:CypressComponentTestConfiguration', () => { style: 'scss', unitTestRunner: 'none', component: true, - projectNameAndRootFormat: 'as-provided', }); // --build-target still needs to build the graph in order for readTargetOptions to work projectGraph = { @@ -197,7 +193,6 @@ describe('React:CypressComponentTestConfiguration', () => { unitTestRunner: 'none', name: 'my-app', bundler: 'vite', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { linter: Linter.EsLint, @@ -207,7 +202,6 @@ describe('React:CypressComponentTestConfiguration', () => { style: 'scss', unitTestRunner: 'none', component: true, - projectNameAndRootFormat: 'as-provided', }); projectGraph = { @@ -265,7 +259,6 @@ describe('React:CypressComponentTestConfiguration', () => { unitTestRunner: 'none', name: 'my-app', bundler: 'webpack', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { linter: Linter.EsLint, @@ -275,7 +268,6 @@ describe('React:CypressComponentTestConfiguration', () => { style: 'scss', unitTestRunner: 'none', component: true, - projectNameAndRootFormat: 'as-provided', }); projectGraph = { @@ -332,7 +324,6 @@ describe('React:CypressComponentTestConfiguration', () => { unitTestRunner: 'none', name: 'my-app', bundler: 'vite', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { linter: Linter.EsLint, @@ -342,7 +333,6 @@ describe('React:CypressComponentTestConfiguration', () => { style: 'scss', unitTestRunner: 'jest', component: true, - projectNameAndRootFormat: 'as-provided', }); await componentGenerator(tree, { name: 'another-cmp', @@ -379,7 +369,6 @@ describe('React:CypressComponentTestConfiguration', () => { unitTestRunner: 'none', name: 'my-app', bundler: 'vite', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { linter: Linter.EsLint, @@ -389,7 +378,6 @@ describe('React:CypressComponentTestConfiguration', () => { style: 'scss', unitTestRunner: 'jest', js: true, - projectNameAndRootFormat: 'as-provided', }); await componentGenerator(tree, { name: 'some-cmp', @@ -436,7 +424,6 @@ describe('React:CypressComponentTestConfiguration', () => { unitTestRunner: 'none', name: 'my-app', bundler: 'vite', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'some-lib', @@ -445,7 +432,6 @@ describe('React:CypressComponentTestConfiguration', () => { linter: Linter.None, skipFormat: false, skipTsConfig: false, - projectNameAndRootFormat: 'as-provided', }); const appConfig = readProjectConfiguration(tree, 'my-app'); appConfig.targets['build'].executor = 'something/else'; @@ -494,7 +480,6 @@ describe('React:CypressComponentTestConfiguration', () => { unitTestRunner: 'none', name: 'my-app', bundler: 'vite', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { linter: Linter.EsLint, @@ -504,7 +489,6 @@ describe('React:CypressComponentTestConfiguration', () => { style: 'scss', unitTestRunner: 'none', component: true, - projectNameAndRootFormat: 'as-provided', }); projectGraph = { diff --git a/packages/react/src/generators/federate-module/schema.d.ts b/packages/react/src/generators/federate-module/schema.d.ts index 2906f803fef3a..afad22612ddb3 100644 --- a/packages/react/src/generators/federate-module/schema.d.ts +++ b/packages/react/src/generators/federate-module/schema.d.ts @@ -5,7 +5,6 @@ export interface Schema { path: string; remote: string; remoteDirectory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; e2eTestRunner?: 'cypress' | 'playwright' | 'none'; host?: string; linter?: Linter | LinterType; diff --git a/packages/react/src/generators/federate-module/schema.json b/packages/react/src/generators/federate-module/schema.json index c2c381ed63c6e..e6fe54eb6ccad 100644 --- a/packages/react/src/generators/federate-module/schema.json +++ b/packages/react/src/generators/federate-module/schema.json @@ -37,11 +37,6 @@ "description": "The directory of the new remote application if one needs to be created.", "type": "string" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "style": { "description": "The file extension to be used for style files.", "type": "string", diff --git a/packages/react/src/generators/host/host.rspack.spec.ts b/packages/react/src/generators/host/host.rspack.spec.ts index 199d5baf01cdd..934ef2224fd4f 100644 --- a/packages/react/src/generators/host/host.rspack.spec.ts +++ b/packages/react/src/generators/host/host.rspack.spec.ts @@ -113,7 +113,6 @@ xdescribe('hostGenerator', () => { linter: Linter.None, unitTestRunner: 'none', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: false, skipFormat: true, js: true, @@ -134,7 +133,6 @@ xdescribe('hostGenerator', () => { linter: Linter.None, unitTestRunner: 'none', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: false, bundler: 'rspack', }); @@ -153,7 +151,6 @@ xdescribe('hostGenerator', () => { linter: Linter.None, unitTestRunner: 'none', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: true, skipFormat: true, bundler: 'rspack', @@ -179,7 +176,6 @@ xdescribe('hostGenerator', () => { linter: Linter.None, unitTestRunner: 'none', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: false, bundler: 'rspack', }); @@ -205,7 +201,6 @@ xdescribe('hostGenerator', () => { linter: Linter.None, unitTestRunner: 'none', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', skipFormat: true, bundler: 'rspack', }); @@ -222,7 +217,6 @@ xdescribe('hostGenerator', () => { linter: Linter.None, unitTestRunner: 'none', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: false, bundler: 'rspack', }); @@ -269,7 +263,6 @@ xdescribe('hostGenerator', () => { linter: Linter.None, unitTestRunner: 'none', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: true, bundler: 'rspack', }); @@ -308,14 +301,13 @@ xdescribe('hostGenerator', () => { ).toMatchSnapshot(); }); - it('should generate a host and remotes in a directory correctly when using --projectNameAndRootFormat=as-provided', async () => { + it('should generate a host and remotes in a directory correctly', async () => { const tree = createTreeWithEmptyWorkspace(); await hostGenerator(tree, { name: 'host-app', directory: 'foo/host-app', remotes: ['remote1', 'remote2', 'remote3'], - projectNameAndRootFormat: 'as-provided', e2eTestRunner: 'none', linter: Linter.None, style: 'css', @@ -332,14 +324,13 @@ xdescribe('hostGenerator', () => { ).toContain(`'remote1', 'remote2', 'remote3'`); }); - it('should generate a host and remotes in a directory correctly when using --projectNameAndRootFormat=as-provided and --typescriptConfiguration=true', async () => { + it('should generate a host and remotes in a directory correctly when using --typescriptConfiguration=true', async () => { const tree = createTreeWithEmptyWorkspace(); await hostGenerator(tree, { name: 'host-app', directory: 'foo/host-app', remotes: ['remote1', 'remote2', 'remote3'], - projectNameAndRootFormat: 'as-provided', e2eTestRunner: 'none', linter: Linter.None, style: 'css', @@ -365,7 +356,6 @@ xdescribe('hostGenerator', () => { name: 'myhostapp', remotes: [remote], dynamic: true, - projectNameAndRootFormat: 'as-provided', e2eTestRunner: 'none', linter: Linter.None, style: 'css', diff --git a/packages/react/src/generators/host/host.ts b/packages/react/src/generators/host/host.ts index 39cc8fcaa4993..e6e6e179de636 100644 --- a/packages/react/src/generators/host/host.ts +++ b/packages/react/src/generators/host/host.ts @@ -82,7 +82,6 @@ export async function hostGenerator( devServerPort: remotePort, ssr: options.ssr, skipFormat: true, - projectNameAndRootFormat: options.projectNameAndRootFormat, typescriptConfiguration: options.typescriptConfiguration, js: options.js, dynamic: options.dynamic, diff --git a/packages/react/src/generators/host/host.webpack.spec.ts b/packages/react/src/generators/host/host.webpack.spec.ts index fd9ccead74fd7..ff9619ac21302 100644 --- a/packages/react/src/generators/host/host.webpack.spec.ts +++ b/packages/react/src/generators/host/host.webpack.spec.ts @@ -112,7 +112,6 @@ describe('hostGenerator', () => { linter: Linter.None, unitTestRunner: 'none', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: false, skipFormat: true, js: true, @@ -133,7 +132,6 @@ describe('hostGenerator', () => { linter: Linter.None, unitTestRunner: 'none', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: false, bundler: 'webpack', }); @@ -152,7 +150,6 @@ describe('hostGenerator', () => { linter: Linter.None, unitTestRunner: 'none', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: true, skipFormat: true, bundler: 'webpack', @@ -178,7 +175,6 @@ describe('hostGenerator', () => { linter: Linter.None, unitTestRunner: 'none', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: false, bundler: 'webpack', }); @@ -204,7 +200,6 @@ describe('hostGenerator', () => { linter: Linter.None, unitTestRunner: 'none', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', skipFormat: true, bundler: 'webpack', }); @@ -221,7 +216,6 @@ describe('hostGenerator', () => { linter: Linter.None, unitTestRunner: 'none', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: false, bundler: 'webpack', }); @@ -268,7 +262,6 @@ describe('hostGenerator', () => { linter: Linter.None, unitTestRunner: 'none', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: true, bundler: 'webpack', }); @@ -307,14 +300,13 @@ describe('hostGenerator', () => { ).toMatchSnapshot(); }); - it('should generate a host and remotes in a directory correctly when using --projectNameAndRootFormat=as-provided', async () => { + it('should generate a host and remotes in a directory correctly', async () => { const tree = createTreeWithEmptyWorkspace(); await hostGenerator(tree, { name: 'host-app', directory: 'foo/host-app', remotes: ['remote1', 'remote2', 'remote3'], - projectNameAndRootFormat: 'as-provided', e2eTestRunner: 'none', linter: Linter.None, style: 'css', @@ -331,14 +323,13 @@ describe('hostGenerator', () => { ).toContain(`'remote1', 'remote2', 'remote3'`); }); - it('should generate a host and remotes in a directory correctly when using --projectNameAndRootFormat=as-provided and --typescriptConfiguration=true', async () => { + it('should generate a host and remotes in a directory correctly when using --typescriptConfiguration=true', async () => { const tree = createTreeWithEmptyWorkspace(); await hostGenerator(tree, { name: 'host-app', directory: 'foo/host-app', remotes: ['remote1', 'remote2', 'remote3'], - projectNameAndRootFormat: 'as-provided', e2eTestRunner: 'none', linter: Linter.None, style: 'css', @@ -364,7 +355,6 @@ describe('hostGenerator', () => { name: 'myhostapp', remotes: [remote], dynamic: true, - projectNameAndRootFormat: 'as-provided', e2eTestRunner: 'none', linter: Linter.None, style: 'css', diff --git a/packages/react/src/generators/host/schema.d.ts b/packages/react/src/generators/host/schema.d.ts index b070fc79014d2..431ce0d77ce56 100644 --- a/packages/react/src/generators/host/schema.d.ts +++ b/packages/react/src/generators/host/schema.d.ts @@ -1,4 +1,3 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; import type { SupportedStyles } from '../../../typings/style'; @@ -6,13 +5,12 @@ export interface Schema { classComponent?: boolean; compiler?: 'babel' | 'swc'; devServerPort?: number; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; + directory: string; e2eTestRunner: 'cypress' | 'playwright' | 'none'; globalCss?: boolean; js?: boolean; linter: Linter | LinterType; - name: string; + name?: string; remotes?: string[]; setParserOptionsProject?: boolean; skipFormat?: boolean; diff --git a/packages/react/src/generators/host/schema.json b/packages/react/src/generators/host/schema.json index 6001de3cf8739..869c0d9026592 100644 --- a/packages/react/src/generators/host/schema.json +++ b/packages/react/src/generators/host/schema.json @@ -6,28 +6,22 @@ "description": "Create Module Federation configuration files for given React Host Application.", "type": "object", "properties": { - "name": { + "directory": { + "description": "The directory of the new application.", "type": "string", - "description": "The name of the host application to generate the Module Federation configuration", + "alias": "dir", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use as the host application?", "pattern": "^[a-zA-Z][^:]*$", - "x-priority": "important" + "x-prompt": "Which directory do you want to create the application in?" }, - "directory": { - "description": "The directory of the new application.", + "name": { "type": "string", - "alias": "dir", + "description": "The name of the host application to generate the Module Federation configuration", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "style": { "description": "The file extension to be used for style files.", "type": "string", @@ -187,6 +181,6 @@ "x-priority": "important" } }, - "required": ["name"], + "required": ["directory"], "additionalProperties": false } diff --git a/packages/react/src/generators/library/library.spec.ts b/packages/react/src/generators/library/library.spec.ts index 2ce45894ed4db..0804b1faa2b04 100644 --- a/packages/react/src/generators/library/library.spec.ts +++ b/packages/react/src/generators/library/library.spec.ts @@ -464,13 +464,11 @@ describe('lib', () => { routing: true, style: 'css', bundler: 'webpack', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { ...defaultSchema, appProject: 'my-app', - projectNameAndRootFormat: 'as-provided', }); const appSource = tree.read('my-app/src/app/app.tsx', 'utf-8'); @@ -492,13 +490,11 @@ describe('lib', () => { name: 'my-app', style: 'css', bundler: 'webpack', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { ...defaultSchema, appProject: 'my-app', - projectNameAndRootFormat: 'as-provided', }); const appSource = tree.read('my-app/src/app/app.tsx', 'utf-8'); diff --git a/packages/react/src/generators/library/schema.d.ts b/packages/react/src/generators/library/schema.d.ts index 6e8d0953c614c..8bcd42b369ea0 100644 --- a/packages/react/src/generators/library/schema.d.ts +++ b/packages/react/src/generators/library/schema.d.ts @@ -1,4 +1,3 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; import type { SupportedStyles } from '../../../typings/style'; @@ -8,14 +7,13 @@ export interface Schema { bundler?: 'none' | 'rollup' | 'vite'; compiler?: 'babel' | 'swc'; component?: boolean; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; + directory: string; globalCss?: boolean; importPath?: string; inSourceTests?: boolean; js?: boolean; linter: Linter | LinterType; - name: string; + name?: string; publishable?: boolean; routing?: boolean; setParserOptionsProject?: boolean; diff --git a/packages/react/src/generators/library/schema.json b/packages/react/src/generators/library/schema.json index 7379f0f3a0281..e3ae2eb77538c 100644 --- a/packages/react/src/generators/library/schema.json +++ b/packages/react/src/generators/library/schema.json @@ -16,28 +16,22 @@ } ], "properties": { - "name": { + "directory": { "type": "string", - "description": "Library name", + "description": "A directory where the lib is placed.", + "alias": "dir", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", - "x-priority": "important" + "x-prompt": "Which directory do you want to create the library in?" }, - "directory": { + "name": { "type": "string", - "description": "A directory where the lib is placed.", - "alias": "dir", + "description": "Library name", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "style": { "description": "The file extension to be used for style files.", "type": "string", @@ -188,5 +182,5 @@ "default": false } }, - "required": ["name"] + "required": ["directory"] } diff --git a/packages/react/src/generators/redux/redux.spec.ts b/packages/react/src/generators/redux/redux.spec.ts index df1c8b642ce9e..043efefe4e72c 100644 --- a/packages/react/src/generators/redux/redux.spec.ts +++ b/packages/react/src/generators/redux/redux.spec.ts @@ -19,7 +19,6 @@ describe('redux', () => { skipTsConfig: false, style: 'css', unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', }); }); @@ -55,7 +54,6 @@ describe('redux', () => { style: 'css', unitTestRunner: 'none', name: 'my-app', - projectNameAndRootFormat: 'as-provided', }); await reduxGenerator(appTree, { name: 'my-slice', diff --git a/packages/react/src/generators/remote/remote.rspack.spec.ts b/packages/react/src/generators/remote/remote.rspack.spec.ts index e3b312be5fd44..768c0a85e4204 100644 --- a/packages/react/src/generators/remote/remote.rspack.spec.ts +++ b/packages/react/src/generators/remote/remote.rspack.spec.ts @@ -111,7 +111,6 @@ xdescribe('remote generator', () => { skipFormat: true, style: 'css', unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: false, bundler: 'rspack', }); @@ -144,7 +143,6 @@ xdescribe('remote generator', () => { skipFormat: true, style: 'css', unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: false, js: true, bundler: 'rspack', @@ -178,7 +176,6 @@ xdescribe('remote generator', () => { skipFormat: false, style: 'css', unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: true, bundler: 'rspack', }); @@ -206,7 +203,6 @@ xdescribe('remote generator', () => { skipFormat: true, style: 'css', unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', bundler: 'rspack', }); @@ -224,7 +220,6 @@ xdescribe('remote generator', () => { skipFormat: true, style: 'css', unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', bundler: 'rspack', }); @@ -244,7 +239,6 @@ xdescribe('remote generator', () => { style: 'css', unitTestRunner: 'jest', ssr: true, - projectNameAndRootFormat: 'as-provided', bundler: 'rspack', }); @@ -265,7 +259,6 @@ xdescribe('remote generator', () => { style: 'css', unitTestRunner: 'jest', ssr: true, - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: false, bundler: 'rspack', }); @@ -295,7 +288,6 @@ xdescribe('remote generator', () => { style: 'css', unitTestRunner: 'jest', ssr: true, - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: true, bundler: 'rspack', }); @@ -327,7 +319,6 @@ xdescribe('remote generator', () => { style: 'css', unitTestRunner: 'jest', ssr: true, - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: true, bundler: 'rspack', }) diff --git a/packages/react/src/generators/remote/remote.webpack.spec.ts b/packages/react/src/generators/remote/remote.webpack.spec.ts index 296487058c0f8..b6dda686fc4c2 100644 --- a/packages/react/src/generators/remote/remote.webpack.spec.ts +++ b/packages/react/src/generators/remote/remote.webpack.spec.ts @@ -110,7 +110,6 @@ describe('remote generator', () => { skipFormat: true, style: 'css', unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: false, bundler: 'webpack', }); @@ -143,7 +142,6 @@ describe('remote generator', () => { skipFormat: true, style: 'css', unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: false, js: true, bundler: 'webpack', @@ -177,7 +175,6 @@ describe('remote generator', () => { skipFormat: false, style: 'css', unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: true, bundler: 'webpack', }); @@ -205,7 +202,6 @@ describe('remote generator', () => { skipFormat: true, style: 'css', unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', bundler: 'webpack', }); @@ -223,7 +219,6 @@ describe('remote generator', () => { skipFormat: true, style: 'css', unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', bundler: 'webpack', }); @@ -243,7 +238,6 @@ describe('remote generator', () => { style: 'css', unitTestRunner: 'jest', ssr: true, - projectNameAndRootFormat: 'as-provided', bundler: 'webpack', }); @@ -264,7 +258,6 @@ describe('remote generator', () => { style: 'css', unitTestRunner: 'jest', ssr: true, - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: false, bundler: 'webpack', }); @@ -294,7 +287,6 @@ describe('remote generator', () => { style: 'css', unitTestRunner: 'jest', ssr: true, - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: true, bundler: 'webpack', }); @@ -326,7 +318,6 @@ describe('remote generator', () => { style: 'css', unitTestRunner: 'jest', ssr: true, - projectNameAndRootFormat: 'as-provided', typescriptConfiguration: true, bundler: 'webpack', }) diff --git a/packages/react/src/generators/remote/schema.d.ts b/packages/react/src/generators/remote/schema.d.ts index 9a133e03c617c..b268628178f3f 100644 --- a/packages/react/src/generators/remote/schema.d.ts +++ b/packages/react/src/generators/remote/schema.d.ts @@ -1,4 +1,3 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; import type { SupportedStyles } from '../../../typings/style'; import type { NormalizedSchema as ApplicationNormalizedSchema } from '../application/schema'; @@ -7,14 +6,13 @@ export interface Schema { classComponent?: boolean; compiler?: 'babel' | 'swc'; devServerPort?: number; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; + directory: string; e2eTestRunner: 'cypress' | 'playwright' | 'none'; globalCss?: boolean; host?: string; js?: boolean; linter: Linter | LinterType; - name: string; + name?: string; routing?: boolean; setParserOptionsProject?: boolean; skipFormat: boolean; diff --git a/packages/react/src/generators/remote/schema.json b/packages/react/src/generators/remote/schema.json index 7d3e3cded263d..858d3db23db0d 100644 --- a/packages/react/src/generators/remote/schema.json +++ b/packages/react/src/generators/remote/schema.json @@ -6,28 +6,22 @@ "description": "Create Module Federation configuration files for given React Remote Application.", "type": "object", "properties": { - "name": { + "directory": { + "description": "The directory of the new application.", "type": "string", - "description": "The name of the remote application to generate the Module Federation configuration", + "alias": "dir", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use as the remote application?", "pattern": "^[a-zA-Z][^:]*$", - "x-priority": "important" + "x-prompt": "Which directory do you want to create the application in?" }, - "directory": { - "description": "The directory of the new application.", + "name": { "type": "string", - "alias": "dir", + "description": "The name of the remote application to generate the Module Federation configuration", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "dynamic": { "type": "boolean", "description": "Should the host application use dynamic federation?", @@ -186,6 +180,6 @@ "x-priority": "important" } }, - "required": ["name"], + "required": ["directory"], "additionalProperties": false } diff --git a/packages/react/src/generators/setup-ssr/setup-ssr.spec.ts b/packages/react/src/generators/setup-ssr/setup-ssr.spec.ts index f68b403873eca..09965cb9dd792 100644 --- a/packages/react/src/generators/setup-ssr/setup-ssr.spec.ts +++ b/packages/react/src/generators/setup-ssr/setup-ssr.spec.ts @@ -117,7 +117,6 @@ describe('setupSsrGenerator', () => { linter: Linter.None, unitTestRunner: 'none', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', skipFormat: true, }); }); diff --git a/packages/react/src/generators/stories/stories.app.spec.ts b/packages/react/src/generators/stories/stories.app.spec.ts index 40f26b33e6e9b..c70826f8a9b65 100644 --- a/packages/react/src/generators/stories/stories.app.spec.ts +++ b/packages/react/src/generators/stories/stories.app.spec.ts @@ -327,7 +327,6 @@ export async function createTestUIApp( unitTestRunner: 'none', name: libName, js: plainJS, - projectNameAndRootFormat: 'as-provided', }); return appTree; } diff --git a/packages/react/src/generators/stories/stories.lib.spec.ts b/packages/react/src/generators/stories/stories.lib.spec.ts index c54203fe189a4..d493930fa7455 100644 --- a/packages/react/src/generators/stories/stories.lib.spec.ts +++ b/packages/react/src/generators/stories/stories.lib.spec.ts @@ -240,7 +240,6 @@ export async function createTestUILib( style: 'css', unitTestRunner: 'none', name: libName, - projectNameAndRootFormat: 'as-provided', }); return appTree; diff --git a/packages/react/src/generators/stories/stories.nextjs.spec.ts b/packages/react/src/generators/stories/stories.nextjs.spec.ts index bc54fe60a6170..33347dacc53ec 100644 --- a/packages/react/src/generators/stories/stories.nextjs.spec.ts +++ b/packages/react/src/generators/stories/stories.nextjs.spec.ts @@ -92,7 +92,6 @@ export async function createTestUIApp(name: string): Promise { style: 'css', unitTestRunner: 'none', name, - projectNameAndRootFormat: 'as-provided', }); return tree; diff --git a/packages/react/src/generators/storybook-configuration/configuration.spec.ts b/packages/react/src/generators/storybook-configuration/configuration.spec.ts index ead7e7a2c3566..272f75a61e251 100644 --- a/packages/react/src/generators/storybook-configuration/configuration.spec.ts +++ b/packages/react/src/generators/storybook-configuration/configuration.spec.ts @@ -140,7 +140,6 @@ export async function createTestUILib( style: 'css', unitTestRunner: 'none', name: libName, - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); return appTree; @@ -160,7 +159,6 @@ export async function createTestAppLib( unitTestRunner: 'none', name: libName, js: plainJS, - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); diff --git a/packages/react/src/migrations/update-19-6-0/update-ssr-server-port.spec.ts b/packages/react/src/migrations/update-19-6-0/update-ssr-server-port.spec.ts index b6cf62fb8327d..91977e95a33cf 100644 --- a/packages/react/src/migrations/update-19-6-0/update-ssr-server-port.spec.ts +++ b/packages/react/src/migrations/update-19-6-0/update-ssr-server-port.spec.ts @@ -17,7 +17,6 @@ describe('update-19-6-0 update-ssr-server-port migration', () => { unitTestRunner: 'none', ssr: true, linter: Linter.EsLint, - projectNameAndRootFormat: 'as-provided', style: 'css', remotes: ['product'], bundler: 'webpack', @@ -133,7 +132,6 @@ describe('update-19-6-0 update-ssr-server-port migration', () => { unitTestRunner: 'none', ssr: true, linter: Linter.EsLint, - projectNameAndRootFormat: 'as-provided', style: 'css', bundler: 'webpack', }); @@ -185,7 +183,6 @@ describe('update-19-6-0 update-ssr-server-port migration', () => { unitTestRunner: 'none', ssr: false, linter: Linter.EsLint, - projectNameAndRootFormat: 'as-provided', style: 'css', bundler: 'webpack', }); diff --git a/packages/react/src/utils/testing-generators.ts b/packages/react/src/utils/testing-generators.ts index e495057985a63..248511c54b12c 100644 --- a/packages/react/src/utils/testing-generators.ts +++ b/packages/react/src/utils/testing-generators.ts @@ -9,8 +9,7 @@ export async function createApp(tree: Tree, appName: string): Promise { skipFormat: true, style: 'css', unitTestRunner: 'none', - name: appName, - projectNameAndRootFormat: 'as-provided', + directory: appName, }); } diff --git a/packages/remix/src/generators/application/__snapshots__/application.impl.spec.ts.snap b/packages/remix/src/generators/application/__snapshots__/application.impl.spec.ts.snap index 3d1c92a463441..e54d187ded886 100644 --- a/packages/remix/src/generators/application/__snapshots__/application.impl.spec.ts.snap +++ b/packages/remix/src/generators/application/__snapshots__/application.impl.spec.ts.snap @@ -1,5 +1,312 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Remix Application Integrated Repo --directory should create the application correctly 1`] = ` +"import { createWatchPaths } from '@nx/remix'; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +/** + * @type {import('@remix-run/dev').AppConfig} + */ +export default { + ignoredRouteFiles: ['**/.*'], + // appDirectory: "app", + // assetsBuildDirectory: "public/build", + // serverBuildPath: "build/index.js", + // publicPath: "/build/", + watchPaths: () => createWatchPaths(__dirname), +}; +" +`; + +exports[`Remix Application Integrated Repo --directory should create the application correctly 2`] = ` +"import type { MetaFunction } from '@remix-run/node'; +import { + Links, + LiveReload, + Meta, + Outlet, + Scripts, + ScrollRestoration, +} from '@remix-run/react'; + +export const meta: MetaFunction = () => [ + { + title: 'New Remix App', + }, +]; + +export default function App() { + return ( + + + + + + + + + + + + + + + ); +} +" +`; + +exports[`Remix Application Integrated Repo --directory should create the application correctly 3`] = ` +"import NxWelcome from '../nx-welcome'; + +export default function Index() { + return ( +
+ +
+ ); +} +" +`; + +exports[`Remix Application Integrated Repo --directory should extract the layout directory from the directory options if it exists 1`] = ` +"import { createWatchPaths } from '@nx/remix'; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +/** + * @type {import('@remix-run/dev').AppConfig} + */ +export default { + ignoredRouteFiles: ['**/.*'], + // appDirectory: "app", + // assetsBuildDirectory: "public/build", + // serverBuildPath: "build/index.js", + // publicPath: "/build/", + watchPaths: () => createWatchPaths(__dirname), +}; +" +`; + +exports[`Remix Application Integrated Repo --directory should extract the layout directory from the directory options if it exists 2`] = ` +"import type { MetaFunction } from '@remix-run/node'; +import { + Links, + LiveReload, + Meta, + Outlet, + Scripts, + ScrollRestoration, +} from '@remix-run/react'; + +export const meta: MetaFunction = () => [ + { + title: 'New Remix App', + }, +]; + +export default function App() { + return ( + + + + + + + + + + + + + + + ); +} +" +`; + +exports[`Remix Application Integrated Repo --directory should extract the layout directory from the directory options if it exists 3`] = ` +"import NxWelcome from '../nx-welcome'; + +export default function Index() { + return ( +
+ +
+ ); +} +" +`; + +exports[`Remix Application Integrated Repo --e2eTestRunner should generate a cypress e2e application for the app 1`] = ` +"import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset'; + +import { defineConfig } from 'cypress'; + +export default defineConfig({ + e2e: { + ...nxE2EPreset(__filename, { + cypressDir: 'src', + webServerCommands: { + default: 'npx nx run test:dev', + production: 'npx nx run test:serve-static', + }, + ciWebServerCommand: 'npx nx run test:serve-static', + ciBaseUrl: 'http://localhost:3000', + }), + baseUrl: 'http://localhost:3000', + }, +}); +" +`; + +exports[`Remix Application Integrated Repo --e2eTestRunner should generate a playwright e2e application for the app 1`] = ` +"import { defineConfig, devices } from '@playwright/test'; +import { nxE2EPreset } from '@nx/playwright/preset'; + +import { workspaceRoot } from '@nx/devkit'; + +// For CI, you may want to set BASE_URL to the deployed application. +const baseURL = process.env['BASE_URL'] || 'http://localhost:3000'; + +/** + * Read environment variables from file. + * https://github.com/motdotla/dotenv + */ +// require('dotenv').config(); + +/** + * See https://playwright.dev/docs/test-configuration. + */ +export default defineConfig({ + ...nxE2EPreset(__filename, { testDir: './src' }), + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + baseURL, + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + }, + /* Run your local dev server before starting the tests */ + webServer: { + command: 'npx nx run test:serve-static', + url: 'http://localhost:3000', + reuseExistingServer: !process.env.CI, + cwd: workspaceRoot, + }, + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + + { + name: 'firefox', + use: { ...devices['Desktop Firefox'] }, + }, + + { + name: 'webkit', + use: { ...devices['Desktop Safari'] }, + }, + + // Uncomment for mobile browsers support + /* { + name: 'Mobile Chrome', + use: { ...devices['Pixel 5'] }, + }, + { + name: 'Mobile Safari', + use: { ...devices['iPhone 12'] }, + }, */ + + // Uncomment for branded browsers + /* { + name: 'Microsoft Edge', + use: { ...devices['Desktop Edge'], channel: 'msedge' }, + }, + { + name: 'Google Chrome', + use: { ...devices['Desktop Chrome'], channel: 'chrome' }, + } */ + ], +}); +" +`; + +exports[`Remix Application Integrated Repo --js should create the application correctly 1`] = ` +"import { createWatchPaths } from '@nx/remix'; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +/** + * @type {import('@remix-run/dev').AppConfig} + */ +export default { + ignoredRouteFiles: ['**/.*'], + // appDirectory: "app", + // assetsBuildDirectory: "public/build", + // serverBuildPath: "build/index.js", + // publicPath: "/build/", + watchPaths: () => createWatchPaths(__dirname), +}; +" +`; + +exports[`Remix Application Integrated Repo --js should create the application correctly 2`] = ` +"import { + Links, + LiveReload, + Meta, + Outlet, + Scripts, + ScrollRestoration, +} from '@remix-run/react'; +export const meta = () => [ + { + title: 'New Remix App', + }, +]; +export default function App() { + return ( + + + + + + + + + + + + + + + ); +} +" +`; + +exports[`Remix Application Integrated Repo --js should create the application correctly 3`] = ` +"import NxWelcome from '../nx-welcome'; +export default function Index() { + return ( +
+ +
+ ); +} +" +`; + exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --directory should create the application correctly 1`] = ` "import { createWatchPaths } from '@nx/remix'; import { dirname } from 'path'; @@ -21,7 +328,523 @@ export default { " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --directory should create the application correctly 2`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --directory should create the application correctly 2`] = ` +"import type { MetaFunction } from '@remix-run/node'; +import { + Links, + LiveReload, + Meta, + Outlet, + Scripts, + ScrollRestoration, +} from '@remix-run/react'; + +export const meta: MetaFunction = () => [ + { + title: 'New Remix App', + }, +]; + +export default function App() { + return ( + + + + + + + + + + + + + + + ); +} +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --directory should create the application correctly 3`] = ` +"import NxWelcome from '../nx-welcome'; + +export default function Index() { + return ( +
+ +
+ ); +} +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --directory should extract the layout directory from the directory options if it exists 1`] = ` +"import { createWatchPaths } from '@nx/remix'; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +/** + * @type {import('@remix-run/dev').AppConfig} + */ +export default { + ignoredRouteFiles: ['**/.*'], + // appDirectory: "app", + // assetsBuildDirectory: "public/build", + // serverBuildPath: "build/index.js", + // publicPath: "/build/", + watchPaths: () => createWatchPaths(__dirname), +}; +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --directory should extract the layout directory from the directory options if it exists 2`] = ` +"import type { MetaFunction } from '@remix-run/node'; +import { + Links, + LiveReload, + Meta, + Outlet, + Scripts, + ScrollRestoration, +} from '@remix-run/react'; + +export const meta: MetaFunction = () => [ + { + title: 'New Remix App', + }, +]; + +export default function App() { + return ( + + + + + + + + + + + + + + + ); +} +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --directory should extract the layout directory from the directory options if it exists 3`] = ` +"import NxWelcome from '../nx-welcome'; + +export default function Index() { + return ( +
+ +
+ ); +} +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --e2eTestRunner should generate a cypress e2e application for the app 1`] = ` +"import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset'; + +import { defineConfig } from 'cypress'; + +export default defineConfig({ + e2e: { + ...nxE2EPreset(__filename, { + cypressDir: 'src', + webServerCommands: { + default: 'npx nx run test:dev', + production: 'npx nx run test:serve-static', + }, + ciWebServerCommand: 'npx nx run test:serve-static', + ciBaseUrl: 'http://localhost:3000', + }), + baseUrl: 'http://localhost:3000', + }, +}); +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --e2eTestRunner should generate a playwright e2e application for the app 1`] = ` +"import { defineConfig, devices } from '@playwright/test'; +import { nxE2EPreset } from '@nx/playwright/preset'; + +import { workspaceRoot } from '@nx/devkit'; + +// For CI, you may want to set BASE_URL to the deployed application. +const baseURL = process.env['BASE_URL'] || 'http://localhost:3000'; + +/** + * Read environment variables from file. + * https://github.com/motdotla/dotenv + */ +// require('dotenv').config(); + +/** + * See https://playwright.dev/docs/test-configuration. + */ +export default defineConfig({ + ...nxE2EPreset(__filename, { testDir: './src' }), + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + baseURL, + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + }, + /* Run your local dev server before starting the tests */ + webServer: { + command: 'npx nx run test:serve-static', + url: 'http://localhost:3000', + reuseExistingServer: !process.env.CI, + cwd: workspaceRoot, + }, + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + + { + name: 'firefox', + use: { ...devices['Desktop Firefox'] }, + }, + + { + name: 'webkit', + use: { ...devices['Desktop Safari'] }, + }, + + // Uncomment for mobile browsers support + /* { + name: 'Mobile Chrome', + use: { ...devices['Pixel 5'] }, + }, + { + name: 'Mobile Safari', + use: { ...devices['iPhone 12'] }, + }, */ + + // Uncomment for branded browsers + /* { + name: 'Microsoft Edge', + use: { ...devices['Desktop Edge'], channel: 'msedge' }, + }, + { + name: 'Google Chrome', + use: { ...devices['Desktop Chrome'], channel: 'chrome' }, + } */ + ], +}); +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --js should create the application correctly 1`] = ` +"import { createWatchPaths } from '@nx/remix'; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +/** + * @type {import('@remix-run/dev').AppConfig} + */ +export default { + ignoredRouteFiles: ['**/.*'], + // appDirectory: "app", + // assetsBuildDirectory: "public/build", + // serverBuildPath: "build/index.js", + // publicPath: "/build/", + watchPaths: () => createWatchPaths(__dirname), +}; +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --js should create the application correctly 2`] = ` +"import { + Links, + LiveReload, + Meta, + Outlet, + Scripts, + ScrollRestoration, +} from '@remix-run/react'; +export const meta = () => [ + { + title: 'New Remix App', + }, +]; +export default function App() { + return ( + + + + + + + + + + + + + + + ); +} +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --js should create the application correctly 3`] = ` +"import NxWelcome from '../nx-welcome'; +export default function Index() { + return ( +
+ +
+ ); +} +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using jest 1`] = ` +"import { createWatchPaths } from '@nx/remix'; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +/** + * @type {import('@remix-run/dev').AppConfig} + */ +export default { + ignoredRouteFiles: ['**/.*'], + // appDirectory: "app", + // assetsBuildDirectory: "public/build", + // serverBuildPath: "build/index.js", + // publicPath: "/build/", + watchPaths: () => createWatchPaths(__dirname), +}; +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using jest 2`] = ` +"export default { + displayName: 'test', + preset: '../jest.preset.js', + transform: { + '^.+\\\\.[tj]sx?$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }], + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../coverage/test', +}; +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using jest 3`] = ` +"import { installGlobals } from '@remix-run/node'; +import '@testing-library/jest-dom/matchers'; +installGlobals(); +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using vitest 1`] = ` +"import { createWatchPaths } from '@nx/remix'; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +/** + * @type {import('@remix-run/dev').AppConfig} + */ +export default { + ignoredRouteFiles: ['**/.*'], + // appDirectory: "app", + // assetsBuildDirectory: "public/build", + // serverBuildPath: "build/index.js", + // publicPath: "/build/", + watchPaths: () => createWatchPaths(__dirname), +}; +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using vitest 2`] = ` +"/// +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; +import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; +import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin'; + +export default defineConfig({ + root: __dirname, + cacheDir: '../node_modules/.vite/test', + + plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])], + + // Uncomment this if you are using workers. + // worker: { + // plugins: [ nxViteTsPaths() ], + // }, + + test: { + setupFiles: ['test-setup.ts'], + watch: false, + globals: true, + environment: 'jsdom', + include: ['./tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], + + reporters: ['default'], + coverage: { + reportsDirectory: '../coverage/test', + provider: 'v8', + }, + }, +}); +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using vitest 3`] = ` +"import { installGlobals } from '@remix-run/node'; +import '@testing-library/jest-dom/matchers'; +installGlobals(); +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using vitest 4`] = ` +"{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../dist/out-tsc", + "types": [ + "vitest/globals", + "vitest/importMeta", + "vite/client", + "node", + "vitest" + ] + }, + "include": [ + "vite.config.ts", + "vitest.config.ts", + "app/**/*.ts", + "app/**/*.tsx", + "app/**/*.js", + "app/**/*.jsx", + "tests/**/*.spec.ts", + "tests/**/*.test.ts", + "tests/**/*.spec.tsx", + "tests/**/*.test.tsx", + "tests/**/*.spec.js", + "tests/**/*.test.js", + "tests/**/*.spec.jsx", + "tests/**/*.test.jsx" + ] +} +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided should create the application correctly 1`] = ` +"import { createWatchPaths } from '@nx/remix'; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +/** + * @type {import('@remix-run/dev').AppConfig} + */ +export default { + ignoredRouteFiles: ['**/.*'], + // appDirectory: "app", + // assetsBuildDirectory: "public/build", + // serverBuildPath: "build/index.js", + // publicPath: "/build/", + watchPaths: () => createWatchPaths(__dirname), +}; +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided should create the application correctly 2`] = ` +"import type { MetaFunction } from '@remix-run/node'; +import { + Links, + LiveReload, + Meta, + Outlet, + Scripts, + ScrollRestoration, +} from '@remix-run/react'; + +export const meta: MetaFunction = () => [ + { + title: 'New Remix App', + }, +]; + +export default function App() { + return ( + + + + + + + + + + + + + + + ); +} +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided should create the application correctly 3`] = ` +"import NxWelcome from '../nx-welcome'; + +export default function Index() { + return ( +
+ +
+ ); +} +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --directory should create the application correctly 1`] = ` +"import { createWatchPaths } from '@nx/remix'; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +/** + * @type {import('@remix-run/dev').AppConfig} + */ +export default { + ignoredRouteFiles: ['**/.*'], + // appDirectory: "app", + // assetsBuildDirectory: "public/build", + // serverBuildPath: "build/index.js", + // publicPath: "/build/", + watchPaths: () => createWatchPaths(__dirname), +}; +" +`; + +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --directory should create the application correctly 2`] = ` "import type { MetaFunction } from '@remix-run/node'; import { Links, @@ -59,7 +882,7 @@ export default function App() { " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --directory should create the application correctly 3`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --directory should create the application correctly 3`] = ` "import NxWelcome from '../nx-welcome'; export default function Index() { @@ -72,7 +895,7 @@ export default function Index() { " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --directory should extract the layout directory from the directory options if it exists 1`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --directory should extract the layout directory from the directory options if it exists 1`] = ` "import { createWatchPaths } from '@nx/remix'; import { dirname } from 'path'; import { fileURLToPath } from 'url'; @@ -93,7 +916,7 @@ export default { " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --directory should extract the layout directory from the directory options if it exists 2`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --directory should extract the layout directory from the directory options if it exists 2`] = ` "import type { MetaFunction } from '@remix-run/node'; import { Links, @@ -131,7 +954,7 @@ export default function App() { " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --directory should extract the layout directory from the directory options if it exists 3`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --directory should extract the layout directory from the directory options if it exists 3`] = ` "import NxWelcome from '../nx-welcome'; export default function Index() { @@ -144,7 +967,7 @@ export default function Index() { " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --e2eTestRunner should generate a cypress e2e application for the app 1`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --e2eTestRunner should generate a cypress e2e application for the app 1`] = ` "import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset'; import { defineConfig } from 'cypress'; @@ -166,7 +989,7 @@ export default defineConfig({ " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --e2eTestRunner should generate a playwright e2e application for the app 1`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --e2eTestRunner should generate a playwright e2e application for the app 1`] = ` "import { defineConfig, devices } from '@playwright/test'; import { nxE2EPreset } from '@nx/playwright/preset'; @@ -239,7 +1062,7 @@ export default defineConfig({ " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --js should create the application correctly 1`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --js should create the application correctly 1`] = ` "import { createWatchPaths } from '@nx/remix'; import { dirname } from 'path'; import { fileURLToPath } from 'url'; @@ -260,7 +1083,7 @@ export default { " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --js should create the application correctly 2`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --js should create the application correctly 2`] = ` "import { Links, LiveReload, @@ -295,7 +1118,7 @@ export default function App() { " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --js should create the application correctly 3`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --js should create the application correctly 3`] = ` "import NxWelcome from '../nx-welcome'; export default function Index() { return ( @@ -307,7 +1130,7 @@ export default function Index() { " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using jest 1`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --unitTestRunner should generate the correct files for testing using jest 1`] = ` "import { createWatchPaths } from '@nx/remix'; import { dirname } from 'path'; import { fileURLToPath } from 'url'; @@ -328,7 +1151,7 @@ export default { " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using jest 2`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --unitTestRunner should generate the correct files for testing using jest 2`] = ` "export default { displayName: 'test', preset: '../jest.preset.js', @@ -341,14 +1164,14 @@ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provide " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using jest 3`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --unitTestRunner should generate the correct files for testing using jest 3`] = ` "import { installGlobals } from '@remix-run/node'; import '@testing-library/jest-dom/matchers'; installGlobals(); " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using vitest 1`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --unitTestRunner should generate the correct files for testing using vitest 1`] = ` "import { createWatchPaths } from '@nx/remix'; import { dirname } from 'path'; import { fileURLToPath } from 'url'; @@ -369,7 +1192,7 @@ export default { " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using vitest 2`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --unitTestRunner should generate the correct files for testing using vitest 2`] = ` "/// import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; @@ -404,14 +1227,14 @@ export default defineConfig({ " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using vitest 3`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --unitTestRunner should generate the correct files for testing using vitest 3`] = ` "import { installGlobals } from '@remix-run/node'; import '@testing-library/jest-dom/matchers'; installGlobals(); " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using vitest 4`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test --unitTestRunner should generate the correct files for testing using vitest 4`] = ` "{ "extends": "./tsconfig.json", "compilerOptions": { @@ -444,7 +1267,7 @@ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provide " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided should create the application correctly 1`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test should create the application correctly 1`] = ` "import { createWatchPaths } from '@nx/remix'; import { dirname } from 'path'; import { fileURLToPath } from 'url'; @@ -465,7 +1288,7 @@ export default { " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided should create the application correctly 2`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test should create the application correctly 2`] = ` "import type { MetaFunction } from '@remix-run/node'; import { Links, @@ -503,7 +1326,216 @@ export default function App() { " `; -exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided should create the application correctly 3`] = ` +exports[`Remix Application Integrated Repo --projectNameAndRootFormat=test should create the application correctly 3`] = ` +"import NxWelcome from '../nx-welcome'; + +export default function Index() { + return ( +
+ +
+ ); +} +" +`; + +exports[`Remix Application Integrated Repo --unitTestRunner should generate the correct files for testing using jest 1`] = ` +"import { createWatchPaths } from '@nx/remix'; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +/** + * @type {import('@remix-run/dev').AppConfig} + */ +export default { + ignoredRouteFiles: ['**/.*'], + // appDirectory: "app", + // assetsBuildDirectory: "public/build", + // serverBuildPath: "build/index.js", + // publicPath: "/build/", + watchPaths: () => createWatchPaths(__dirname), +}; +" +`; + +exports[`Remix Application Integrated Repo --unitTestRunner should generate the correct files for testing using jest 2`] = ` +"export default { + displayName: 'test', + preset: '../jest.preset.js', + transform: { + '^.+\\\\.[tj]sx?$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }], + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../coverage/test', +}; +" +`; + +exports[`Remix Application Integrated Repo --unitTestRunner should generate the correct files for testing using jest 3`] = ` +"import { installGlobals } from '@remix-run/node'; +import '@testing-library/jest-dom/matchers'; +installGlobals(); +" +`; + +exports[`Remix Application Integrated Repo --unitTestRunner should generate the correct files for testing using vitest 1`] = ` +"import { createWatchPaths } from '@nx/remix'; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +/** + * @type {import('@remix-run/dev').AppConfig} + */ +export default { + ignoredRouteFiles: ['**/.*'], + // appDirectory: "app", + // assetsBuildDirectory: "public/build", + // serverBuildPath: "build/index.js", + // publicPath: "/build/", + watchPaths: () => createWatchPaths(__dirname), +}; +" +`; + +exports[`Remix Application Integrated Repo --unitTestRunner should generate the correct files for testing using vitest 2`] = ` +"/// +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; +import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; +import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin'; + +export default defineConfig({ + root: __dirname, + cacheDir: '../node_modules/.vite/test', + + plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])], + + // Uncomment this if you are using workers. + // worker: { + // plugins: [ nxViteTsPaths() ], + // }, + + test: { + setupFiles: ['test-setup.ts'], + watch: false, + globals: true, + environment: 'jsdom', + include: ['./tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], + + reporters: ['default'], + coverage: { + reportsDirectory: '../coverage/test', + provider: 'v8', + }, + }, +}); +" +`; + +exports[`Remix Application Integrated Repo --unitTestRunner should generate the correct files for testing using vitest 3`] = ` +"import { installGlobals } from '@remix-run/node'; +import '@testing-library/jest-dom/matchers'; +installGlobals(); +" +`; + +exports[`Remix Application Integrated Repo --unitTestRunner should generate the correct files for testing using vitest 4`] = ` +"{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../dist/out-tsc", + "types": [ + "vitest/globals", + "vitest/importMeta", + "vite/client", + "node", + "vitest" + ] + }, + "include": [ + "vite.config.ts", + "vitest.config.ts", + "app/**/*.ts", + "app/**/*.tsx", + "app/**/*.js", + "app/**/*.jsx", + "tests/**/*.spec.ts", + "tests/**/*.test.ts", + "tests/**/*.spec.tsx", + "tests/**/*.test.tsx", + "tests/**/*.spec.js", + "tests/**/*.test.js", + "tests/**/*.spec.jsx", + "tests/**/*.test.jsx" + ] +} +" +`; + +exports[`Remix Application Integrated Repo should create the application correctly 1`] = ` +"import { createWatchPaths } from '@nx/remix'; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +/** + * @type {import('@remix-run/dev').AppConfig} + */ +export default { + ignoredRouteFiles: ['**/.*'], + // appDirectory: "app", + // assetsBuildDirectory: "public/build", + // serverBuildPath: "build/index.js", + // publicPath: "/build/", + watchPaths: () => createWatchPaths(__dirname), +}; +" +`; + +exports[`Remix Application Integrated Repo should create the application correctly 2`] = ` +"import type { MetaFunction } from '@remix-run/node'; +import { + Links, + LiveReload, + Meta, + Outlet, + Scripts, + ScrollRestoration, +} from '@remix-run/react'; + +export const meta: MetaFunction = () => [ + { + title: 'New Remix App', + }, +]; + +export default function App() { + return ( + + + + + + + + + + + + + + + ); +} +" +`; + +exports[`Remix Application Integrated Repo should create the application correctly 3`] = ` "import NxWelcome from '../nx-welcome'; export default function Index() { diff --git a/packages/remix/src/generators/application/application.impl.spec.ts b/packages/remix/src/generators/application/application.impl.spec.ts index c80c16f7b2cbf..f26ae42c51a92 100644 --- a/packages/remix/src/generators/application/application.impl.spec.ts +++ b/packages/remix/src/generators/application/application.impl.spec.ts @@ -3,7 +3,6 @@ import 'nx/src/internal-testing-utils/mock-project-graph'; import { joinPathFragments, readJson, readNxJson, type Tree } from '@nx/devkit'; import * as devkitExports from 'nx/src/devkit-exports'; -import { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import applicationGenerator from './application.impl'; import { join } from 'path'; @@ -24,6 +23,7 @@ describe('Remix Application', () => { // ACT await applicationGenerator(tree, { name: 'test', + directory: '.', rootProject: true, addPlugin: true, }); @@ -49,6 +49,7 @@ describe('Remix Application', () => { // ACT await applicationGenerator(tree, { name: 'test', + directory: '.', js: true, rootProject: true, addPlugin: true, @@ -71,6 +72,7 @@ describe('Remix Application', () => { // ACT await applicationGenerator(tree, { name: 'test', + directory: '.', unitTestRunner: 'vitest', rootProject: true, addPlugin: true, @@ -95,6 +97,7 @@ describe('Remix Application', () => { // ACT await applicationGenerator(tree, { name: 'test', + directory: '.', unitTestRunner: 'jest', rootProject: true, addPlugin: true, @@ -121,6 +124,7 @@ describe('Remix Application', () => { // ACT await applicationGenerator(tree, { name: 'test', + directory: '.', e2eTestRunner: 'cypress', rootProject: true, addPlugin: true, @@ -148,6 +152,7 @@ describe('Remix Application', () => { // ACT await applicationGenerator(tree, { name: 'test', + directory: '.', e2eTestRunner: 'playwright', rootProject: true, addPlugin: true, @@ -168,17 +173,36 @@ describe('Remix Application', () => { }); }); - describe.each([['as-provided', 'test', 'test-e2e']])( - 'Integrated Repo --projectNameAndRootFormat=%s', - (projectNameAndRootFormat: ProjectNameAndRootFormat, appDir, e2eDir) => { + describe.each([['test', 'test-e2e']])('Integrated Repo', (appDir, e2eDir) => { + it('should create the application correctly', async () => { + // ARRANGE + const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); + + // ACT + await applicationGenerator(tree, { + directory: 'test', + addPlugin: true, + }); + + // ASSERT + expectTargetsToBeCorrect(tree, appDir); + + expect(tree.read(`${appDir}/remix.config.js`, 'utf-8')).toMatchSnapshot(); + expect(tree.read(`${appDir}/app/root.tsx`, 'utf-8')).toMatchSnapshot(); + expect( + tree.read(`${appDir}/app/routes/_index.tsx`, 'utf-8') + ).toMatchSnapshot(); + }); + + describe('--js', () => { it('should create the application correctly', async () => { // ARRANGE const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); // ACT await applicationGenerator(tree, { - name: 'test', - projectNameAndRootFormat, + directory: 'test', + js: true, addPlugin: true, }); @@ -188,199 +212,157 @@ describe('Remix Application', () => { expect( tree.read(`${appDir}/remix.config.js`, 'utf-8') ).toMatchSnapshot(); - expect(tree.read(`${appDir}/app/root.tsx`, 'utf-8')).toMatchSnapshot(); + expect(tree.read(`${appDir}/app/root.js`, 'utf-8')).toMatchSnapshot(); expect( - tree.read(`${appDir}/app/routes/_index.tsx`, 'utf-8') + tree.read(`${appDir}/app/routes/_index.js`, 'utf-8') ).toMatchSnapshot(); }); + }); + describe('--directory', () => { + it('should create the application correctly', async () => { + // ARRANGE + const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); + const newAppDir = 'demo'; - describe('--js', () => { - it('should create the application correctly', async () => { - // ARRANGE - const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); - - // ACT - await applicationGenerator(tree, { - name: 'test', - js: true, - projectNameAndRootFormat, - addPlugin: true, - }); - - // ASSERT - expectTargetsToBeCorrect(tree, appDir); - - expect( - tree.read(`${appDir}/remix.config.js`, 'utf-8') - ).toMatchSnapshot(); - expect(tree.read(`${appDir}/app/root.js`, 'utf-8')).toMatchSnapshot(); - expect( - tree.read(`${appDir}/app/routes/_index.js`, 'utf-8') - ).toMatchSnapshot(); + // ACT + await applicationGenerator(tree, { + name: 'test', + directory: 'demo', + addPlugin: true, }); + + // ASSERT + expectTargetsToBeCorrect(tree, newAppDir); + + expect( + tree.read(`${newAppDir}/remix.config.js`, 'utf-8') + ).toMatchSnapshot(); + expect( + tree.read(`${newAppDir}/app/root.tsx`, 'utf-8') + ).toMatchSnapshot(); + expect( + tree.read(`${newAppDir}/app/routes/_index.tsx`, 'utf-8') + ).toMatchSnapshot(); }); - describe('--directory', () => { - it('should create the application correctly', async () => { - // ARRANGE - const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); - const newAppDir = - projectNameAndRootFormat === 'as-provided' - ? 'demo' - : 'apps/demo/test'; - - // ACT - await applicationGenerator(tree, { - name: 'test', - directory: 'demo', - projectNameAndRootFormat, - addPlugin: true, - }); - - // ASSERT - expectTargetsToBeCorrect(tree, newAppDir); - - expect( - tree.read(`${newAppDir}/remix.config.js`, 'utf-8') - ).toMatchSnapshot(); - expect( - tree.read(`${newAppDir}/app/root.tsx`, 'utf-8') - ).toMatchSnapshot(); - expect( - tree.read(`${newAppDir}/app/routes/_index.tsx`, 'utf-8') - ).toMatchSnapshot(); - }); - it('should extract the layout directory from the directory options if it exists', async () => { - // ARRANGE - const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); - const newAppDir = - projectNameAndRootFormat === 'as-provided' - ? 'apps/demo' - : 'apps/demo/test'; - - // ACT - await applicationGenerator(tree, { - name: 'test', - directory: 'apps/demo', - projectNameAndRootFormat, - addPlugin: true, - }); - - // ASSERT - expectTargetsToBeCorrect(tree, newAppDir); - - expect( - tree.read(`${newAppDir}/remix.config.js`, 'utf-8') - ).toMatchSnapshot(); - expect( - tree.read(`${newAppDir}/app/root.tsx`, 'utf-8') - ).toMatchSnapshot(); - expect( - tree.read(`${newAppDir}/app/routes/_index.tsx`, 'utf-8') - ).toMatchSnapshot(); + it('should extract the layout directory from the directory options if it exists', async () => { + // ARRANGE + const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); + const newAppDir = 'apps/demo'; + + // ACT + await applicationGenerator(tree, { + name: 'test', + directory: 'apps/demo', + addPlugin: true, }); + + // ASSERT + expectTargetsToBeCorrect(tree, newAppDir); + + expect( + tree.read(`${newAppDir}/remix.config.js`, 'utf-8') + ).toMatchSnapshot(); + expect( + tree.read(`${newAppDir}/app/root.tsx`, 'utf-8') + ).toMatchSnapshot(); + expect( + tree.read(`${newAppDir}/app/routes/_index.tsx`, 'utf-8') + ).toMatchSnapshot(); }); + }); + + describe('--unitTestRunner', () => { + it('should generate the correct files for testing using vitest', async () => { + // ARRANGE + const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); - describe('--unitTestRunner', () => { - it('should generate the correct files for testing using vitest', async () => { - // ARRANGE - const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); - - // ACT - await applicationGenerator(tree, { - name: 'test', - unitTestRunner: 'vitest', - projectNameAndRootFormat, - addPlugin: true, - }); - - // ASSERT - expectTargetsToBeCorrect(tree, appDir); - - expect( - tree.read(`${appDir}/remix.config.js`, 'utf-8') - ).toMatchSnapshot(); - expect( - tree.read(`${appDir}/vitest.config.ts`, 'utf-8') - ).toMatchSnapshot(); - expect( - tree.read(`${appDir}/test-setup.ts`, 'utf-8') - ).toMatchSnapshot(); - expect( - tree.read(`${appDir}/tsconfig.spec.json`, 'utf-8') - ).toMatchSnapshot(); + // ACT + await applicationGenerator(tree, { + directory: 'test', + unitTestRunner: 'vitest', + addPlugin: true, }); - it('should generate the correct files for testing using jest', async () => { - // ARRANGE - const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); - - // ACT - await applicationGenerator(tree, { - name: 'test', - unitTestRunner: 'jest', - projectNameAndRootFormat, - addPlugin: true, - }); - - // ASSERT - expectTargetsToBeCorrect(tree, appDir); - - expect( - tree.read(`${appDir}/remix.config.js`, 'utf-8') - ).toMatchSnapshot(); - expect( - tree.read(`${appDir}/jest.config.ts`, 'utf-8') - ).toMatchSnapshot(); - expect( - tree.read(`${appDir}/test-setup.ts`, 'utf-8') - ).toMatchSnapshot(); + // ASSERT + expectTargetsToBeCorrect(tree, appDir); + + expect( + tree.read(`${appDir}/remix.config.js`, 'utf-8') + ).toMatchSnapshot(); + expect( + tree.read(`${appDir}/vitest.config.ts`, 'utf-8') + ).toMatchSnapshot(); + expect(tree.read(`${appDir}/test-setup.ts`, 'utf-8')).toMatchSnapshot(); + expect( + tree.read(`${appDir}/tsconfig.spec.json`, 'utf-8') + ).toMatchSnapshot(); + }); + + it('should generate the correct files for testing using jest', async () => { + // ARRANGE + const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); + + // ACT + await applicationGenerator(tree, { + directory: 'test', + unitTestRunner: 'jest', + addPlugin: true, }); + + // ASSERT + expectTargetsToBeCorrect(tree, appDir); + + expect( + tree.read(`${appDir}/remix.config.js`, 'utf-8') + ).toMatchSnapshot(); + expect( + tree.read(`${appDir}/jest.config.ts`, 'utf-8') + ).toMatchSnapshot(); + expect(tree.read(`${appDir}/test-setup.ts`, 'utf-8')).toMatchSnapshot(); }); + }); + + describe('--e2eTestRunner', () => { + it('should generate a cypress e2e application for the app', async () => { + // ARRANGE + const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); - describe('--e2eTestRunner', () => { - it('should generate a cypress e2e application for the app', async () => { - // ARRANGE - const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); - - // ACT - await applicationGenerator(tree, { - name: 'test', - e2eTestRunner: 'cypress', - projectNameAndRootFormat, - addPlugin: true, - }); - - // ASSERT - expectTargetsToBeCorrect(tree, appDir); - - expect( - tree.read(`${appDir}-e2e/cypress.config.ts`, 'utf-8') - ).toMatchSnapshot(); + // ACT + await applicationGenerator(tree, { + directory: 'test', + e2eTestRunner: 'cypress', + addPlugin: true, }); - it('should generate a playwright e2e application for the app', async () => { - // ARRANGE - const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); + // ASSERT + expectTargetsToBeCorrect(tree, appDir); - // ACT - await applicationGenerator(tree, { - name: 'test', - e2eTestRunner: 'playwright', - projectNameAndRootFormat, - addPlugin: true, - }); + expect( + tree.read(`${appDir}-e2e/cypress.config.ts`, 'utf-8') + ).toMatchSnapshot(); + }); - // ASSERT - expectTargetsToBeCorrect(tree, appDir); + it('should generate a playwright e2e application for the app', async () => { + // ARRANGE + const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); - expect( - tree.read(`${appDir}-e2e/playwright.config.ts`, 'utf-8') - ).toMatchSnapshot(); + // ACT + await applicationGenerator(tree, { + directory: 'test', + e2eTestRunner: 'playwright', + addPlugin: true, }); + + // ASSERT + expectTargetsToBeCorrect(tree, appDir); + + expect( + tree.read(`${appDir}-e2e/playwright.config.ts`, 'utf-8') + ).toMatchSnapshot(); }); - } - ); + }); + }); }); function expectTargetsToBeCorrect(tree: Tree, projectRoot: string) { diff --git a/packages/remix/src/generators/application/schema.d.ts b/packages/remix/src/generators/application/schema.d.ts index d893899011047..e3a31477a1fcf 100644 --- a/packages/remix/src/generators/application/schema.d.ts +++ b/packages/remix/src/generators/application/schema.d.ts @@ -1,12 +1,10 @@ -import { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; export interface NxRemixGeneratorSchema { - name: string; + directory: string; + name?: string; tags?: string; js?: boolean; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; linter?: Linter | LinterType; unitTestRunner?: 'vitest' | 'jest' | 'none'; e2eTestRunner?: 'cypress' | 'playwright' | 'none'; diff --git a/packages/remix/src/generators/application/schema.json b/packages/remix/src/generators/application/schema.json index 2c0c86716b7f7..4992be7de5f47 100644 --- a/packages/remix/src/generators/application/schema.json +++ b/packages/remix/src/generators/application/schema.json @@ -5,31 +5,26 @@ "description": "Generate a new Remix application.", "type": "object", "properties": { - "name": { + "directory": { "type": "string", - "description": "", + "description": "A directory where the app is placed.", + "alias": "dir", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What is the name of the application?" + "x-prompt": "Which directory do you want to create the application in?" + }, + "name": { + "type": "string", + "description": "The name of the application.", + "x-priority": "important" }, "js": { "type": "boolean", "description": "Generate JavaScript files rather than TypeScript files.", "default": false }, - "directory": { - "type": "string", - "description": "A directory where the app is placed.", - "alias": "dir", - "x-priority": "important" - }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "linter": { "description": "The tool to use for running lint checks.", "type": "string", @@ -65,5 +60,6 @@ "x-priority": "internal", "default": false } - } + }, + "required": ["directory"] } diff --git a/packages/remix/src/generators/library/__snapshots__/library.impl.spec.ts.snap b/packages/remix/src/generators/library/__snapshots__/library.impl.spec.ts.snap index d2e9beadc8287..16e58dd947084 100644 --- a/packages/remix/src/generators/library/__snapshots__/library.impl.spec.ts.snap +++ b/packages/remix/src/generators/library/__snapshots__/library.impl.spec.ts.snap @@ -1,5 +1,64 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Remix Library Generator --unitTestRunner should create the correct config files for testing with jest 1`] = ` +"export default { + setupFilesAfterEnv: ['./src/test-setup.ts'], + displayName: 'test', + preset: '../jest.preset.js', + transform: { + '^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', + '^.+\\\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../coverage/test', +}; +" +`; + +exports[`Remix Library Generator --unitTestRunner should create the correct config files for testing with jest 2`] = ` +"import { installGlobals } from '@remix-run/node'; +import '@testing-library/jest-dom/matchers'; +installGlobals(); +" +`; + +exports[`Remix Library Generator --unitTestRunner should create the correct config files for testing with vitest 1`] = ` +"import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; +import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; +import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin'; + +export default defineConfig({ + root: __dirname, + cacheDir: '../node_modules/.vite/test', + + plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])], + + // Uncomment this if you are using workers. + // worker: { + // plugins: [ nxViteTsPaths() ], + // }, + + test: { + setupFiles: ['./src/test-setup.ts'], + watch: false, + globals: true, + environment: 'jsdom', + include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], + reporters: ['default'], + coverage: { reportsDirectory: '../coverage/test', provider: 'v8' }, + }, +}); +" +`; + +exports[`Remix Library Generator --unitTestRunner should create the correct config files for testing with vitest 2`] = ` +"import { installGlobals } from '@remix-run/node'; +import '@testing-library/jest-dom/matchers'; +installGlobals(); +" +`; + exports[`Remix Library Generator -projectNameAndRootFormat=as-provided --unitTestRunner should create the correct config files for testing with jest 1`] = ` "export default { setupFilesAfterEnv: ['./src/test-setup.ts'], @@ -77,3 +136,22 @@ exports[`Remix Library Generator -projectNameAndRootFormat=as-provided should ge ], } `; + +exports[`Remix Library Generator should generate a library correctly 1`] = ` +[ + "test.module.css", + "test.spec.tsx", + "test.tsx", +] +`; + +exports[`Remix Library Generator should generate a library correctly 2`] = ` +{ + "@proj/test": [ + "test/src/index.ts", + ], + "@proj/test/server": [ + "test/src/server.ts", + ], +} +`; diff --git a/packages/remix/src/generators/library/library.impl.spec.ts b/packages/remix/src/generators/library/library.impl.spec.ts index fe1f2d7e71b2d..6c983760de0d6 100644 --- a/packages/remix/src/generators/library/library.impl.spec.ts +++ b/packages/remix/src/generators/library/library.impl.spec.ts @@ -1,153 +1,132 @@ import 'nx/src/internal-testing-utils/mock-project-graph'; import { readJson, readProjectConfiguration } from '@nx/devkit'; -import { type ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import applicationGenerator from '../application/application.impl'; import libraryGenerator from './library.impl'; describe('Remix Library Generator', () => { - describe.each([['as-provided', 'test']])( - '-projectNameAndRootFormat=%s', - (projectNameAndRootFormat: ProjectNameAndRootFormat, libDir) => { - it('should generate a library correctly', async () => { - // ARRANGE - const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); - - // ACT - await libraryGenerator(tree, { - name: 'test', - style: 'css', - projectNameAndRootFormat, - addPlugin: true, - }); - - // ASSERT - const tsconfig = readJson(tree, 'tsconfig.base.json'); - expect(tree.exists(`${libDir}/src/server.ts`)); - expect(tree.children(`${libDir}/src/lib`)).toMatchSnapshot(); - expect(tsconfig.compilerOptions.paths).toMatchSnapshot(); - }, 25_000); - - describe('Standalone Project Repo', () => { - it('should update the tsconfig paths correctly', async () => { - // ARRANGE - const tree = createTreeWithEmptyWorkspace(); - await applicationGenerator(tree, { - name: 'demo', - rootProject: true, - addPlugin: true, - }); - const originalBaseTsConfig = readJson(tree, 'tsconfig.json'); - - // ACT - await libraryGenerator(tree, { - name: 'test', - style: 'css', - projectNameAndRootFormat, - addPlugin: true, - }); - - // ASSERT - const updatedBaseTsConfig = readJson(tree, 'tsconfig.base.json'); - expect( - Object.keys(originalBaseTsConfig.compilerOptions.paths) - ).toContain('~/*'); - expect( - Object.keys(updatedBaseTsConfig.compilerOptions.paths) - ).toContain('~/*'); - }); + it('should generate a library correctly', async () => { + // ARRANGE + const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); + + // ACT + await libraryGenerator(tree, { + directory: 'test', + style: 'css', + addPlugin: true, + }); + + // ASSERT + const tsconfig = readJson(tree, 'tsconfig.base.json'); + expect(tree.exists(`test/src/server.ts`)); + expect(tree.children(`test/src/lib`)).toMatchSnapshot(); + expect(tsconfig.compilerOptions.paths).toMatchSnapshot(); + }, 25_000); + + describe('Standalone Project Repo', () => { + it('should update the tsconfig paths correctly', async () => { + // ARRANGE + const tree = createTreeWithEmptyWorkspace(); + await applicationGenerator(tree, { + name: 'demo', + directory: '.', + rootProject: true, + addPlugin: true, }); + const originalBaseTsConfig = readJson(tree, 'tsconfig.json'); - describe('--unitTestRunner', () => { - it('should not create config files when unitTestRunner=none', async () => { - // ARRANGE - const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); - - // ACT - await libraryGenerator(tree, { - name: 'test', - style: 'css', - unitTestRunner: 'none', - projectNameAndRootFormat, - addPlugin: true, - }); - - // ASSERT - expect(tree.exists(`${libDir}/jest.config.ts`)).toBeFalsy(); - expect(tree.exists(`${libDir}/vite.config.ts`)).toBeFalsy(); - }); - - it('should create the correct config files for testing with jest', async () => { - // ARRANGE - const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); - - // ACT - await libraryGenerator(tree, { - name: 'test', - style: 'css', - unitTestRunner: 'jest', - projectNameAndRootFormat, - addPlugin: true, - }); - - // ASSERT - expect( - tree.read(`${libDir}/jest.config.ts`, 'utf-8') - ).toMatchSnapshot(); - expect( - tree.read(`${libDir}/src/test-setup.ts`, 'utf-8') - ).toMatchSnapshot(); - }); - - it('should create the correct config files for testing with vitest', async () => { - // ARRANGE - const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); - - // ACT - await libraryGenerator(tree, { - name: 'test', - style: 'css', - unitTestRunner: 'vitest', - projectNameAndRootFormat, - addPlugin: true, - }); - - // ASSERT - expect( - tree.read(`${libDir}/vite.config.ts`, 'utf-8') - ).toMatchSnapshot(); - - expect( - tree.read(`${libDir}/src/test-setup.ts`, 'utf-8') - ).toMatchSnapshot(); - }, 25_000); + // ACT + await libraryGenerator(tree, { + directory: 'test', + style: 'css', + addPlugin: true, }); - // TODO(Colum): Unskip this when buildable is investigated correctly - xit('should generate the config files correctly when the library is buildable', async () => { - // ARRANGE - const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); - - // ACT - await libraryGenerator(tree, { - name: 'test', - style: 'css', - buildable: true, - projectNameAndRootFormat, - addPlugin: true, - }); - - // ASSERT - const project = readProjectConfiguration(tree, 'test'); - const pkgJson = readJson(tree, `${libDir}/package.json`); - expect(project.targets.build.options.format).toEqual(['cjs']); - expect(project.targets.build.options.outputPath).toEqual( - `${libDir}/dist` - ); - expect(pkgJson.main).toEqual('./dist/index.cjs.js'); - expect(pkgJson.typings).toEqual('./dist/index.d.ts'); + // ASSERT + const updatedBaseTsConfig = readJson(tree, 'tsconfig.base.json'); + expect(Object.keys(originalBaseTsConfig.compilerOptions.paths)).toContain( + '~/*' + ); + expect(Object.keys(updatedBaseTsConfig.compilerOptions.paths)).toContain( + '~/*' + ); + }); + }); + + describe('--unitTestRunner', () => { + it('should not create config files when unitTestRunner=none', async () => { + // ARRANGE + const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); + + // ACT + await libraryGenerator(tree, { + directory: 'test', + style: 'css', + unitTestRunner: 'none', + addPlugin: true, }); - } - ); + + // ASSERT + expect(tree.exists(`test/jest.config.ts`)).toBeFalsy(); + expect(tree.exists(`test/vite.config.ts`)).toBeFalsy(); + }); + + it('should create the correct config files for testing with jest', async () => { + // ARRANGE + const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); + + // ACT + await libraryGenerator(tree, { + directory: 'test', + style: 'css', + unitTestRunner: 'jest', + addPlugin: true, + }); + + // ASSERT + expect(tree.read(`test/jest.config.ts`, 'utf-8')).toMatchSnapshot(); + expect(tree.read(`test/src/test-setup.ts`, 'utf-8')).toMatchSnapshot(); + }); + + it('should create the correct config files for testing with vitest', async () => { + // ARRANGE + const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); + + // ACT + await libraryGenerator(tree, { + directory: 'test', + style: 'css', + unitTestRunner: 'vitest', + addPlugin: true, + }); + + // ASSERT + expect(tree.read(`test/vite.config.ts`, 'utf-8')).toMatchSnapshot(); + + expect(tree.read(`test/src/test-setup.ts`, 'utf-8')).toMatchSnapshot(); + }, 25_000); + }); + + // TODO(Colum): Unskip this when buildable is investigated correctly + xit('should generate the config files correctly when the library is buildable', async () => { + // ARRANGE + const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); + + // ACT + await libraryGenerator(tree, { + directory: 'test', + style: 'css', + buildable: true, + addPlugin: true, + }); + + // ASSERT + const project = readProjectConfiguration(tree, 'test'); + const pkgJson = readJson(tree, `test/package.json`); + expect(project.targets.build.options.format).toEqual(['cjs']); + expect(project.targets.build.options.outputPath).toEqual(`test/dist`); + expect(pkgJson.main).toEqual('./dist/index.cjs.js'); + expect(pkgJson.typings).toEqual('./dist/index.d.ts'); + }); }); diff --git a/packages/remix/src/generators/library/library.impl.ts b/packages/remix/src/generators/library/library.impl.ts index ac94969c3597b..6473918c77811 100644 --- a/packages/remix/src/generators/library/library.impl.ts +++ b/packages/remix/src/generators/library/library.impl.ts @@ -31,7 +31,6 @@ export async function remixLibraryGeneratorInternal( tags: options.tags, importPath: options.importPath, directory: options.projectRoot, - projectNameAndRootFormat: 'as-provided', skipFormat: true, skipTsConfig: false, linter: Linter.EsLint, diff --git a/packages/remix/src/generators/library/schema.d.ts b/packages/remix/src/generators/library/schema.d.ts index c332d633c8a4d..41283df98c462 100644 --- a/packages/remix/src/generators/library/schema.d.ts +++ b/packages/remix/src/generators/library/schema.d.ts @@ -1,11 +1,9 @@ -import { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import { SupportedStyles } from '@nx/react'; export interface NxRemixGeneratorSchema { - name: string; + directory: string; + name?: string; style: SupportedStyles; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; tags?: string; importPath?: string; buildable?: boolean; diff --git a/packages/remix/src/generators/library/schema.json b/packages/remix/src/generators/library/schema.json index feb6c1f686ef2..2086b2837c068 100644 --- a/packages/remix/src/generators/library/schema.json +++ b/packages/remix/src/generators/library/schema.json @@ -11,27 +11,22 @@ } ], "properties": { - "name": { + "directory": { "type": "string", - "description": "Library name", + "description": "A directory where the lib is placed.", + "alias": "dir", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "^[a-zA-Z].*$" + "pattern": "^[a-zA-Z].*$", + "x-prompt": "Which directory do you want to create the library in?" }, - "directory": { + "name": { "type": "string", - "description": "A directory where the lib is placed.", - "alias": "dir", + "description": "Library name", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "tags": { "type": "string", "description": "Add tags to the library (used for linting)" @@ -70,5 +65,5 @@ "x-priority": "internal" } }, - "required": ["name"] + "required": ["directory"] } diff --git a/packages/remix/src/generators/preset/preset.impl.ts b/packages/remix/src/generators/preset/preset.impl.ts index af27b68a39231..c023fe203a4b1 100644 --- a/packages/remix/src/generators/preset/preset.impl.ts +++ b/packages/remix/src/generators/preset/preset.impl.ts @@ -20,6 +20,7 @@ export default async function (tree: Tree, _options: RemixGeneratorSchema) { const appGenTask = await applicationGenerator(tree, { name: options.appName, + directory: '.', tags: options.tags, skipFormat: true, rootProject: true, diff --git a/packages/storybook/src/generators/configuration/configuration.spec.ts b/packages/storybook/src/generators/configuration/configuration.spec.ts index dba7f2182df02..b65a63791ebfc 100644 --- a/packages/storybook/src/generators/configuration/configuration.spec.ts +++ b/packages/storybook/src/generators/configuration/configuration.spec.ts @@ -34,7 +34,6 @@ describe('@nx/storybook:configuration for Storybook v7', () => { await libraryGenerator(tree, { name: 'test-ui-lib', bundler: 'none', - projectNameAndRootFormat: 'as-provided', skipFormat: true, addPlugin: true, }); @@ -401,7 +400,6 @@ describe('@nx/storybook:configuration for Storybook v7', () => { await libraryGenerator(tree, { name: 'test-ui-lib', bundler: 'none', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); writeJson(tree, 'package.json', { @@ -481,7 +479,6 @@ describe('@nx/storybook:configuration for Storybook v7', () => { await libraryGenerator(tree, { name: 'test-ui-lib2', linter: Linter.EsLint, - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); @@ -513,7 +510,6 @@ describe('@nx/storybook:configuration for Storybook v7', () => { await libraryGenerator(tree, { name: 'test-ui-lib2', linter: Linter.EsLint, - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); @@ -591,7 +587,6 @@ describe('@nx/storybook:configuration for Storybook v7', () => { await libraryGenerator(tree, { name: 'test-ui-lib', bundler: 'none', - projectNameAndRootFormat: 'as-provided', skipFormat: true, addPlugin: true, }); diff --git a/packages/storybook/src/generators/cypress-project/cypress-project.spec.ts b/packages/storybook/src/generators/cypress-project/cypress-project.spec.ts index 296e5af7a6cb4..936b881b1f0d2 100644 --- a/packages/storybook/src/generators/cypress-project/cypress-project.spec.ts +++ b/packages/storybook/src/generators/cypress-project/cypress-project.spec.ts @@ -23,7 +23,6 @@ describe('@nx/storybook:cypress-project', () => { await libraryGenerator(tree, { name: 'test-ui-lib', directory: 'apps/test-ui-lib', - projectNameAndRootFormat: 'as-provided', }); }); afterEach(() => jest.clearAllMocks()); @@ -32,7 +31,6 @@ describe('@nx/storybook:cypress-project', () => { await cypressProjectGenerator(tree, { name: 'test-ui-lib', directory: 'apps/test-ui-lib-e2e', - projectNameAndRootFormat: 'as-provided', linter: Linter.EsLint, }); @@ -48,7 +46,6 @@ describe('@nx/storybook:cypress-project', () => { await cypressProjectGenerator(tree, { name: 'test-ui-lib', directory: 'apps/test-ui-lib-e2e', - projectNameAndRootFormat: 'as-provided', linter: Linter.EsLint, }); const project = readProjectConfiguration(tree, 'test-ui-lib-e2e'); diff --git a/packages/storybook/src/generators/cypress-project/schema.json b/packages/storybook/src/generators/cypress-project/schema.json index 36c49ecc3555d..4499b15119ac2 100644 --- a/packages/storybook/src/generators/cypress-project/schema.json +++ b/packages/storybook/src/generators/cypress-project/schema.json @@ -44,11 +44,6 @@ "type": "boolean", "default": false, "x-priority": "internal" - }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] } }, "required": ["name"] diff --git a/packages/storybook/src/utils/testing.ts b/packages/storybook/src/utils/testing.ts index c09e372f98864..919c6b7a178f6 100644 --- a/packages/storybook/src/utils/testing.ts +++ b/packages/storybook/src/utils/testing.ts @@ -12,7 +12,7 @@ export async function createTestUILibNoNgDevkit( skipFormat: true, skipTsConfig: false, unitTestRunner: 'none', - name: libName, + directory: libName, }); return appTree; diff --git a/packages/vite/src/generators/configuration/configuration.spec.ts b/packages/vite/src/generators/configuration/configuration.spec.ts index 6b620c936357a..5bf3aff22e2ef 100644 --- a/packages/vite/src/generators/configuration/configuration.spec.ts +++ b/packages/vite/src/generators/configuration/configuration.spec.ts @@ -274,7 +274,6 @@ describe('@nx/vite:configuration', () => { name: 'my-lib', bundler: 'vite', unitTestRunner: undefined, - projectNameAndRootFormat: 'as-provided', }); expect(tree.exists('my-lib/vite.config.ts')).toBeTruthy(); @@ -310,7 +309,6 @@ describe('@nx/vite:configuration', () => { name: 'my-lib', bundler: 'vite', unitTestRunner, - projectNameAndRootFormat: 'as-provided', }); expect(tree.read('my-lib/README.md', 'utf-8')).toMatchSnapshot(); diff --git a/packages/vue/src/generators/application/schema.d.ts b/packages/vue/src/generators/application/schema.d.ts index 35abd5f6e365d..46d4eb6e28715 100644 --- a/packages/vue/src/generators/application/schema.d.ts +++ b/packages/vue/src/generators/application/schema.d.ts @@ -1,12 +1,10 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; export interface Schema { - name: string; + directory: string; + name?: string; style: 'none' | 'css' | 'scss' | 'less'; skipFormat?: boolean; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; tags?: string; unitTestRunner?: 'vitest' | 'none'; inSourceTests?: boolean; diff --git a/packages/vue/src/generators/application/schema.json b/packages/vue/src/generators/application/schema.json index d1cba1bbee40a..87fbc8904b9d8 100644 --- a/packages/vue/src/generators/application/schema.json +++ b/packages/vue/src/generators/application/schema.json @@ -16,27 +16,22 @@ ], "type": "object", "properties": { - "name": { - "description": "The name of the application.", + "directory": { + "description": "The directory of the new application.", "type": "string", + "alias": "dir", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the application?", - "pattern": "^[a-zA-Z][^:]*$" + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "directory": { - "description": "The directory of the new application.", + "name": { + "description": "The name of the application.", "type": "string", - "alias": "dir", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "style": { "description": "The file extension to be used for style files.", "type": "string", @@ -135,6 +130,6 @@ "hidden": true } }, - "required": ["name"], + "required": ["directory"], "examplesFile": "../../../docs/application-examples.md" } diff --git a/packages/vue/src/generators/library/schema.d.ts b/packages/vue/src/generators/library/schema.d.ts index 59104ca38312c..198e8cd5840ba 100644 --- a/packages/vue/src/generators/library/schema.d.ts +++ b/packages/vue/src/generators/library/schema.d.ts @@ -1,18 +1,15 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; -import type { SupportedStyles } from '../../../typings/style'; export interface Schema { appProject?: string; bundler?: 'none' | 'vite'; component?: boolean; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; + directory: string; importPath?: string; inSourceTests?: boolean; js?: boolean; linter: Linter | LinterType; - name: string; + name?: string; publishable?: boolean; routing?: boolean; setParserOptionsProject?: boolean; diff --git a/packages/vue/src/generators/library/schema.json b/packages/vue/src/generators/library/schema.json index d27398bd14c55..9af1f45d83264 100644 --- a/packages/vue/src/generators/library/schema.json +++ b/packages/vue/src/generators/library/schema.json @@ -16,28 +16,22 @@ } ], "properties": { - "name": { + "directory": { "type": "string", - "description": "Library name", + "description": "A directory where the lib is placed.", + "alias": "dir", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", - "x-priority": "important" + "x-prompt": "Which directory do you want to create the library in?" }, - "directory": { + "name": { "type": "string", - "description": "A directory where the lib is placed.", - "alias": "dir", + "description": "Library name", "x-priority": "important" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "linter": { "description": "The tool to use for running lint checks.", "type": "string", @@ -129,5 +123,5 @@ "default": false } }, - "required": ["name"] + "required": ["directory"] } diff --git a/packages/vue/src/generators/stories/lib/component-story.spec.ts b/packages/vue/src/generators/stories/lib/component-story.spec.ts index e0a47ec44562f..fbc6dd09fa940 100644 --- a/packages/vue/src/generators/stories/lib/component-story.spec.ts +++ b/packages/vue/src/generators/stories/lib/component-story.spec.ts @@ -117,7 +117,6 @@ export async function createTestUILib(libName: string): Promise { skipFormat: true, skipTsConfig: false, unitTestRunner: 'vitest', - projectNameAndRootFormat: 'as-provided', }); const currentWorkspaceJson = getProjects(appTree); diff --git a/packages/vue/src/generators/stories/stories.app.spec.ts b/packages/vue/src/generators/stories/stories.app.spec.ts index cead472d3001c..95584786d36d1 100644 --- a/packages/vue/src/generators/stories/stories.app.spec.ts +++ b/packages/vue/src/generators/stories/stories.app.spec.ts @@ -251,7 +251,6 @@ export async function createTestUIApp( unitTestRunner: 'none', name: libName, js: plainJS, - projectNameAndRootFormat: 'as-provided', }); return appTree; } diff --git a/packages/vue/src/generators/stories/stories.lib.spec.ts b/packages/vue/src/generators/stories/stories.lib.spec.ts index 99960d0ca3d53..6baa81bb153e9 100644 --- a/packages/vue/src/generators/stories/stories.lib.spec.ts +++ b/packages/vue/src/generators/stories/stories.lib.spec.ts @@ -183,7 +183,6 @@ export async function createTestUILib( skipTsConfig: false, unitTestRunner: 'none', name: libName, - projectNameAndRootFormat: 'as-provided', }); return appTree; diff --git a/packages/vue/src/generators/storybook-configuration/configuration.spec.ts b/packages/vue/src/generators/storybook-configuration/configuration.spec.ts index 32c34b29a6e2f..7e69a7f3fbd94 100644 --- a/packages/vue/src/generators/storybook-configuration/configuration.spec.ts +++ b/packages/vue/src/generators/storybook-configuration/configuration.spec.ts @@ -147,7 +147,6 @@ export async function createTestUILib(libName: string): Promise { skipTsConfig: false, unitTestRunner: 'none', name: libName, - projectNameAndRootFormat: 'as-provided', }); return appTree; } @@ -166,7 +165,6 @@ export async function createTestAppLib( unitTestRunner: 'none', name: libName, js: plainJS, - projectNameAndRootFormat: 'as-provided', }); await componentGenerator(appTree, { diff --git a/packages/vue/src/utils/test-utils.ts b/packages/vue/src/utils/test-utils.ts index 3331c053f2065..9c109e85af942 100644 --- a/packages/vue/src/utils/test-utils.ts +++ b/packages/vue/src/utils/test-utils.ts @@ -9,8 +9,7 @@ export async function createApp(tree: Tree, appName: string): Promise { skipFormat: true, style: 'css', unitTestRunner: 'none', - name: appName, - projectNameAndRootFormat: 'as-provided', + directory: appName, }); } diff --git a/packages/web/src/generators/application/application.legacy.spec.ts b/packages/web/src/generators/application/application.legacy.spec.ts index 55616211d8b51..e7d6b0c7b7392 100644 --- a/packages/web/src/generators/application/application.legacy.spec.ts +++ b/packages/web/src/generators/application/application.legacy.spec.ts @@ -39,7 +39,6 @@ describe('web app generator (legacy)', () => { it('should setup webpack configuration', async () => { await applicationGenerator(tree, { name: 'my-app', - projectNameAndRootFormat: 'as-provided', }); const project = readProjectConfiguration(tree, 'my-app'); expect(project).toMatchInlineSnapshot(` diff --git a/packages/web/src/generators/application/application.spec.ts b/packages/web/src/generators/application/application.spec.ts index 6e2ad9bc330ea..9fa4704774327 100644 --- a/packages/web/src/generators/application/application.spec.ts +++ b/packages/web/src/generators/application/application.spec.ts @@ -42,7 +42,6 @@ describe('app', () => { it('should update configuration', async () => { await applicationGenerator(tree, { name: 'my-app', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect(readProjectConfiguration(tree, 'my-app').root).toEqual('my-app'); @@ -63,7 +62,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-app', tags: 'one,two', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); const projects = Object.fromEntries(getProjects(tree)); @@ -81,7 +79,6 @@ describe('app', () => { it('should generate files', async () => { await applicationGenerator(tree, { name: 'my-app', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect(tree.exists('my-app/src/main.ts')).toBeTruthy(); @@ -171,7 +168,6 @@ describe('app', () => { name: 'cool-app', e2eTestRunner: 'playwright', unitTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect(tree.exists('cool-app-e2e/playwright.config.ts')).toBeTruthy(); @@ -182,7 +178,6 @@ describe('app', () => { name: 'cool-app', e2eTestRunner: 'cypress', unitTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', bundler: 'vite', addPlugin: true, }); @@ -216,7 +211,6 @@ describe('app', () => { name: 'cool-app', e2eTestRunner: 'cypress', unitTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', bundler: 'webpack', addPlugin: true, }); @@ -249,7 +243,6 @@ describe('app', () => { name: 'cool-app', e2eTestRunner: 'playwright', unitTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', bundler: 'webpack', addPlugin: true, }); @@ -272,7 +265,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-app', bundler: 'vite', - projectNameAndRootFormat: 'as-provided', e2eTestRunner: 'playwright', addPlugin: true, }); @@ -306,7 +298,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-app', bundler: 'vite', - projectNameAndRootFormat: 'as-provided', e2eTestRunner: 'playwright', }); expect( @@ -319,7 +310,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-app', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); @@ -333,7 +323,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-app', directory: 'my-dir/my-app', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect(readProjectConfiguration(tree, 'my-app').root).toEqual( @@ -349,7 +338,6 @@ describe('app', () => { name: 'my-app', directory: 'my-dir/my-app', tags: 'one,two', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); const projects = Object.fromEntries(getProjects(tree)); @@ -373,7 +361,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-app', directory: 'my-dir/my-app', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); @@ -411,7 +398,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-app', directory: 'my-dir/my-app', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); @@ -425,7 +411,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-app', directory: 'my-dir/my-app', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); @@ -437,7 +422,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-app', directory: 'my-dir/my-app', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect( @@ -454,7 +438,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-app', style: 'scss', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect(tree.exists('my-app/src/app/app.element.scss')).toEqual(true); @@ -464,7 +447,6 @@ describe('app', () => { it('should setup jest without serializers', async () => { await applicationGenerator(tree, { name: 'my-app', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); @@ -476,7 +458,6 @@ describe('app', () => { it('should setup the web build builder', async () => { await applicationGenerator(tree, { name: 'my-app', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect(tree.read('my-app/webpack.config.js', 'utf-8')).toMatchSnapshot(); @@ -485,7 +466,6 @@ describe('app', () => { it('should setup the web dev server', async () => { await applicationGenerator(tree, { name: 'my-app', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); @@ -495,7 +475,6 @@ describe('app', () => { it('should setup eslint', async () => { await applicationGenerator(tree, { name: 'my-app', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect(tree.read('my-app/.eslintrc.json', 'utf-8')).toMatchSnapshot(); @@ -506,7 +485,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-app', prefix: 'prefix', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); @@ -521,7 +499,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-app', unitTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect(tree.exists('jest.config.ts')).toBeFalsy(); @@ -534,7 +511,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-cool-app', bundler: 'none', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect(tree.exists('my-cool-app/jest.config.ts')).toBeTruthy(); @@ -557,7 +533,6 @@ describe('app', () => { bundler: 'vite', unitTestRunner: 'jest', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect(tree.exists('my-vite-app/vite.config.ts')).toBeTruthy(); @@ -569,7 +544,6 @@ describe('app', () => { name: 'my-vite-app', bundler: 'vite', unitTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect(tree.exists('my-vite-app/vite.config.ts')).toBeTruthy(); @@ -584,7 +558,6 @@ describe('app', () => { name: 'my-webpack-app', bundler: 'webpack', unitTestRunner: 'vitest', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect(tree.exists('my-webpack-app/vite.config.ts')).toBeTruthy(); @@ -609,7 +582,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-app', e2eTestRunner: 'none', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); expect(tree.exists('my-app-e2e')).toBeFalsy(); @@ -621,7 +593,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-app', compiler: 'babel', - projectNameAndRootFormat: 'as-provided', addPlugin: true, } as Schema); @@ -648,7 +619,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-app', compiler: 'swc', - projectNameAndRootFormat: 'as-provided', addPlugin: true, } as Schema); @@ -675,7 +645,6 @@ describe('app', () => { await applicationGenerator(tree, { name: 'my-app', compiler: 'swc', - projectNameAndRootFormat: 'as-provided', addPlugin: true, } as Schema); @@ -691,7 +660,6 @@ describe('app', () => { await applicationGenerator(viteAppTree, { name: 'my-app', bundler: 'vite', - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); }); @@ -726,7 +694,6 @@ describe('app', () => { name: 'insourceTests', bundler: 'vite', inSourceTests: true, - projectNameAndRootFormat: 'as-provided', addPlugin: true, }); diff --git a/packages/web/src/generators/application/schema.d.ts b/packages/web/src/generators/application/schema.d.ts index 4943850f605ff..1a21df09e764f 100644 --- a/packages/web/src/generators/application/schema.d.ts +++ b/packages/web/src/generators/application/schema.d.ts @@ -1,15 +1,13 @@ -import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; import type { Linter, LinterType } from '@nx/eslint'; export interface Schema { - name: string; + directory: string; + name?: string; prefix?: string; style?: string; bundler?: 'webpack' | 'none' | 'vite'; compiler?: 'babel' | 'swc'; skipFormat?: boolean; - directory?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; tags?: string; unitTestRunner?: 'jest' | 'vitest' | 'none'; inSourceTests?: boolean; diff --git a/packages/web/src/generators/application/schema.json b/packages/web/src/generators/application/schema.json index a4b8798bf551c..f926bc3706dbc 100644 --- a/packages/web/src/generators/application/schema.json +++ b/packages/web/src/generators/application/schema.json @@ -6,24 +6,20 @@ "description": "Create a web application using `swc` or `babel` as compiler.", "type": "object", "properties": { - "name": { - "description": "The name of the application.", + "directory": { + "description": "The directory of the new application.", "type": "string", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the application?", - "pattern": "^[a-zA-Z][^:]*$" - }, - "directory": { - "description": "The directory of the new application.", - "type": "string" + "pattern": "^[a-zA-Z][^:]*$", + "x-prompt": "Which directory do you want to create the application in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { + "description": "The name of the application.", "type": "string", - "enum": ["as-provided", "derived"] + "x-priority": "important" }, "style": { "description": "The file extension to be used for style files.", @@ -113,6 +109,6 @@ "x-deprecated": "Nx only supports standaloneConfig" } }, - "required": ["name"], + "required": ["directory"], "examplesFile": "../../../docs/application-examples.md" } diff --git a/packages/workspace/src/generators/convert-to-monorepo/convert-to-monorepo.ts b/packages/workspace/src/generators/convert-to-monorepo/convert-to-monorepo.ts index a2f4a14064658..cb2b579db6d02 100644 --- a/packages/workspace/src/generators/convert-to-monorepo/convert-to-monorepo.ts +++ b/packages/workspace/src/generators/convert-to-monorepo/convert-to-monorepo.ts @@ -64,7 +64,6 @@ export async function monorepoGenerator(tree: Tree, options: {}) { project.root === '.' ? project.name : project.root ), updateImportPath: project.projectType === 'library', - projectNameAndRootFormat: 'as-provided', }); } } diff --git a/packages/workspace/src/generators/move/lib/check-destination.spec.ts b/packages/workspace/src/generators/move/lib/check-destination.spec.ts index 2eb9e7991f422..ca2c8a360d754 100644 --- a/packages/workspace/src/generators/move/lib/check-destination.spec.ts +++ b/packages/workspace/src/generators/move/lib/check-destination.spec.ts @@ -20,7 +20,6 @@ describe('checkDestination', () => { tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); projectConfig = readProjectConfiguration(tree, 'my-lib'); }); @@ -44,7 +43,6 @@ describe('checkDestination', () => { it('should throw an error if the path already exists', async () => { await libraryGenerator(tree, { name: 'my-other-lib', - projectNameAndRootFormat: 'as-provided', }); const schema: NormalizedSchema = { diff --git a/packages/workspace/src/generators/move/lib/move-project-files.spec.ts b/packages/workspace/src/generators/move/lib/move-project-files.spec.ts index b07564401cbda..0047ae1250bc3 100644 --- a/packages/workspace/src/generators/move/lib/move-project-files.spec.ts +++ b/packages/workspace/src/generators/move/lib/move-project-files.spec.ts @@ -20,7 +20,6 @@ describe('moveProject', () => { tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); projectConfig = readProjectConfiguration(tree, 'my-lib'); }); diff --git a/packages/workspace/src/generators/move/lib/normalize-schema.spec.ts b/packages/workspace/src/generators/move/lib/normalize-schema.spec.ts index 53f4691607daa..4ee58369e6a7a 100644 --- a/packages/workspace/src/generators/move/lib/normalize-schema.spec.ts +++ b/packages/workspace/src/generators/move/lib/normalize-schema.spec.ts @@ -37,7 +37,6 @@ xdescribe('normalizeSchema', () => { importPath: '@proj/my/library', newProjectName: 'my-library', projectName: 'my-library', - projectNameAndRootFormat: 'as-provided', relativeToRootDestination: 'libs/my/library', updateImportPath: true, }; @@ -53,7 +52,6 @@ xdescribe('normalizeSchema', () => { importPath: '@proj/my-awesome-library', newProjectName: 'my-library', projectName: 'my-library', - projectNameAndRootFormat: 'as-provided', relativeToRootDestination: 'libs/my/library', updateImportPath: true, }; diff --git a/packages/workspace/src/generators/move/lib/update-cypress-config.spec.ts b/packages/workspace/src/generators/move/lib/update-cypress-config.spec.ts index ddeda61777804..6ff3a74cc0671 100644 --- a/packages/workspace/src/generators/move/lib/update-cypress-config.spec.ts +++ b/packages/workspace/src/generators/move/lib/update-cypress-config.spec.ts @@ -32,7 +32,6 @@ describe('updateCypressConfig', () => { tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); projectConfig = readProjectConfiguration(tree, 'my-lib'); }); diff --git a/packages/workspace/src/generators/move/lib/update-eslint-config.spec.ts b/packages/workspace/src/generators/move/lib/update-eslint-config.spec.ts index 52da633bdd480..f2ef1f36a7a39 100644 --- a/packages/workspace/src/generators/move/lib/update-eslint-config.spec.ts +++ b/packages/workspace/src/generators/move/lib/update-eslint-config.spec.ts @@ -37,7 +37,6 @@ describe('updateEslint', () => { await libraryGenerator(tree, { name: 'my-lib', linter: Linter.None, - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-lib'); @@ -51,7 +50,6 @@ describe('updateEslint', () => { await libraryGenerator(tree, { name: 'my-lib', linter: Linter.EsLint, - projectNameAndRootFormat: 'as-provided', }); // This step is usually handled elsewhere tree.rename( @@ -74,7 +72,6 @@ describe('updateEslint', () => { name: 'api-test', directory: 'api/test', linter: Linter.EsLint, - projectNameAndRootFormat: 'as-provided', }); // This step is usually handled elsewhere tree.rename('api/test/.eslintrc.json', 'test/.eslintrc.json'); @@ -102,7 +99,6 @@ describe('updateEslint', () => { await libraryGenerator(tree, { name: 'my-lib', linter: Linter.EsLint, - projectNameAndRootFormat: 'as-provided', }); updateJson(tree, 'my-lib/.eslintrc.json', (eslintRcJson) => { eslintRcJson.extends = [ @@ -137,7 +133,6 @@ describe('updateEslint', () => { name: 'my-lib', linter: Linter.EsLint, setParserOptionsProject: true, - projectNameAndRootFormat: 'as-provided', }); // This step is usually handled elsewhere tree.rename( @@ -166,7 +161,6 @@ describe('updateEslint', () => { name: 'my-lib', linter: Linter.EsLint, setParserOptionsProject: true, - projectNameAndRootFormat: 'as-provided', }); // Add another parser project to eslint.json @@ -208,7 +202,6 @@ describe('updateEslint', () => { name: 'my-lib', linter: Linter.EsLint, setParserOptionsProject: true, - projectNameAndRootFormat: 'as-provided', }); // Add another parser project to eslint.json @@ -257,7 +250,6 @@ describe('updateEslint (flat config)', () => { await libraryGenerator(tree, { name: 'my-lib', linter: Linter.None, - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-lib'); @@ -271,7 +263,6 @@ describe('updateEslint (flat config)', () => { await libraryGenerator(tree, { name: 'my-lib', linter: Linter.EsLint, - projectNameAndRootFormat: 'as-provided', }); convertToFlat(tree, 'my-lib'); // This step is usually handled elsewhere @@ -293,7 +284,6 @@ describe('updateEslint (flat config)', () => { name: 'api-test', directory: 'api/test', linter: Linter.EsLint, - projectNameAndRootFormat: 'as-provided', }); convertToFlat(tree, 'api/test'); // This step is usually handled elsewhere @@ -322,7 +312,6 @@ describe('updateEslint (flat config)', () => { name: 'my-lib', linter: Linter.EsLint, setParserOptionsProject: true, - projectNameAndRootFormat: 'as-provided', }); convertToFlat(tree, 'my-lib', { hasParser: true }); // This step is usually handled elsewhere @@ -348,7 +337,6 @@ describe('updateEslint (flat config)', () => { name: 'my-lib', linter: Linter.EsLint, setParserOptionsProject: true, - projectNameAndRootFormat: 'as-provided', }); // Add another parser project to eslint.json const storybookProject = '.storybook/tsconfig.json'; @@ -379,7 +367,6 @@ describe('updateEslint (flat config)', () => { name: 'my-lib', linter: Linter.EsLint, setParserOptionsProject: true, - projectNameAndRootFormat: 'as-provided', }); convertToFlat(tree, 'my-lib', { hasParser: true, isString: true }); diff --git a/packages/workspace/src/generators/move/lib/update-imports.spec.ts b/packages/workspace/src/generators/move/lib/update-imports.spec.ts index 2f651aa7a6c39..1a9bc5902e7af 100644 --- a/packages/workspace/src/generators/move/lib/update-imports.spec.ts +++ b/packages/workspace/src/generators/move/lib/update-imports.spec.ts @@ -26,7 +26,6 @@ describe('updateImports', () => { newProjectName: 'my-destination', destination: 'my-destination', updateImportPath: true, - projectNameAndRootFormat: 'as-provided', }; }); @@ -37,15 +36,12 @@ describe('updateImports', () => { await libraryGenerator(tree, { name: 'my-destination', config: 'project', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'my-importer', - projectNameAndRootFormat: 'as-provided', }); const importerFilePath = 'my-importer/src/importer.ts'; tree.write( @@ -75,15 +71,12 @@ describe('updateImports', () => { it('should not update import paths when they contain a partial match', async () => { await libraryGenerator(tree, { name: 'table', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'tab', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'my-importer', - projectNameAndRootFormat: 'as-provided', }); const importerFilePath = 'my-importer/src/importer.ts'; tree.write( @@ -123,15 +116,12 @@ describe('updateImports', () => { it('should correctly update deep imports', async () => { await libraryGenerator(tree, { name: 'table', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'tab', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'my-importer', - projectNameAndRootFormat: 'as-provided', }); const importerFilePath = 'my-importer/src/importer.ts'; tree.write( @@ -171,15 +161,12 @@ describe('updateImports', () => { it('should update dynamic imports', async () => { await libraryGenerator(tree, { name: 'table', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'tab', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'my-importer', - projectNameAndRootFormat: 'as-provided', }); const importerFilePath = 'my-importer/src/importer.ts'; tree.write( @@ -225,15 +212,12 @@ describe('updateImports', () => { await libraryGenerator(tree, { name: 'my-destination', config: 'project', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'my-importer', - projectNameAndRootFormat: 'as-provided', }); const importerFilePath = 'my-importer/src/importer.ts'; tree.write( @@ -262,15 +246,12 @@ describe('updateImports', () => { await libraryGenerator(tree, { name: 'my-destination', config: 'project', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'my-importer', - projectNameAndRootFormat: 'as-provided', }); const importerFilePath = 'my-importer/src/importer.ts'; tree.write( @@ -293,15 +274,12 @@ describe('updateImports', () => { it('should update require imports', async () => { await libraryGenerator(tree, { name: 'table', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'tab', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'my-importer', - projectNameAndRootFormat: 'as-provided', }); const importerFilePath = 'my-importer/src/importer.ts'; tree.write( @@ -348,15 +326,12 @@ describe('updateImports', () => { // source and destination to make sure that the workspace has libraries with those names. await libraryGenerator(tree, { name: 'my-destination', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); await libraryGenerator(tree, { name: 'my-importer', - projectNameAndRootFormat: 'as-provided', }); const importerFilePath = 'my-importer/src/importer.ts'; tree.write( @@ -389,7 +364,6 @@ export MyExtendedClass extends MyClass {};` it('should update project ref in the root tsconfig.base.json', async () => { await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-source'); @@ -408,7 +382,6 @@ export MyExtendedClass extends MyClass {};` it('should update project ref in the root tsconfig.base.json for secondary entry points', async () => { await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); updateJson(tree, '/tsconfig.base.json', (json) => { json.compilerOptions.paths['@proj/my-source/testing'] = [ @@ -439,7 +412,6 @@ export MyExtendedClass extends MyClass {};` tree.delete('libs'); await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-source'); @@ -459,7 +431,6 @@ export MyExtendedClass extends MyClass {};` tree.rename('tsconfig.base.json', 'tsconfig.json'); await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-source'); @@ -483,7 +454,6 @@ export MyExtendedClass extends MyClass {};` ); await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-source'); @@ -502,7 +472,6 @@ export MyExtendedClass extends MyClass {};` it('should only update the project ref paths in the tsconfig file when --updateImportPath=false', async () => { await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-source'); @@ -529,7 +498,6 @@ export MyExtendedClass extends MyClass {};` it("should update project ref in the root tsconfig file if it contains a secondary entry point for Next.js's server", async () => { await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); tree.write('my-source/src/server.ts', ''); diff --git a/packages/workspace/src/generators/move/lib/update-jest-config.spec.ts b/packages/workspace/src/generators/move/lib/update-jest-config.spec.ts index 6a256a6218b51..34db31ef530f5 100644 --- a/packages/workspace/src/generators/move/lib/update-jest-config.spec.ts +++ b/packages/workspace/src/generators/move/lib/update-jest-config.spec.ts @@ -18,7 +18,6 @@ describe('updateJestConfig', () => { it('should handle jest config not existing', async () => { await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-source'); const schema: NormalizedSchema = { @@ -47,7 +46,6 @@ describe('updateJestConfig', () => { const rootJestConfigPath = '/jest.config.ts'; await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-source'); tree.write(jestConfigPath, jestConfig); @@ -84,7 +82,6 @@ describe('updateJestConfig', () => { const jestConfigPath = 'my-source/data-access/jest.config.ts'; await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-source'); tree.write(jestConfigPath, jestConfig); @@ -121,7 +118,6 @@ describe('updateJestConfig', () => { await libraryGenerator(tree, { name: 'some-test-dir-my-source', directory: 'some/test/dir/my-source', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration( tree, @@ -152,7 +148,6 @@ describe('updateJestConfig', () => { await libraryGenerator(tree, { name: 'some-test-dir-my-source', directory: 'some/test/dir/my-source', - projectNameAndRootFormat: 'as-provided', }); tree.write( rootJestConfigPath, @@ -190,7 +185,6 @@ describe('updateJestConfig', () => { await libraryGenerator(tree, { name: 'some-test-dir-my-source', directory: 'some/test/dir/my-source', - projectNameAndRootFormat: 'as-provided', }); tree.write( rootJestConfigPath, @@ -231,7 +225,6 @@ module.exports = { await libraryGenerator(tree, { name: 'some-test-dir-my-source', directory: 'some/test/dir/my-source', - projectNameAndRootFormat: 'as-provided', }); tree.write( rootJestConfigPath, diff --git a/packages/workspace/src/generators/move/lib/update-package-json.spec.ts b/packages/workspace/src/generators/move/lib/update-package-json.spec.ts index 7792ed41b12c8..3b041fd0d9659 100644 --- a/packages/workspace/src/generators/move/lib/update-package-json.spec.ts +++ b/packages/workspace/src/generators/move/lib/update-package-json.spec.ts @@ -25,7 +25,6 @@ describe('updatePackageJson', () => { tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); }); diff --git a/packages/workspace/src/generators/move/lib/update-project-root-files.spec.ts b/packages/workspace/src/generators/move/lib/update-project-root-files.spec.ts index 5faaf8293c01f..7bd5b7fe3bbdd 100644 --- a/packages/workspace/src/generators/move/lib/update-project-root-files.spec.ts +++ b/packages/workspace/src/generators/move/lib/update-project-root-files.spec.ts @@ -28,7 +28,6 @@ describe('updateProjectRootFiles', () => { const testFilePath = 'subfolder/my-destination/jest.config.js'; await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-source'); tree.write(testFilePath, testFile); @@ -63,7 +62,6 @@ export default defineConfig({ await libraryGenerator(tree, { name: 'e2e', root: 'e2e', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'e2e'); tree.write(cypressConfigPath, cypressConfigContents); diff --git a/packages/workspace/src/generators/move/lib/update-readme.spec.ts b/packages/workspace/src/generators/move/lib/update-readme.spec.ts index 2860373686fc4..6ecb1f102aea0 100644 --- a/packages/workspace/src/generators/move/lib/update-readme.spec.ts +++ b/packages/workspace/src/generators/move/lib/update-readme.spec.ts @@ -29,7 +29,6 @@ describe('updateReadme', () => { it('should handle README.md not existing', async () => { await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); const readmePath = join(schema.relativeToRootDestination, 'README.md'); tree.delete(readmePath); @@ -42,7 +41,6 @@ describe('updateReadme', () => { it('should update README.md contents', async () => { await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); // This step is usually handled elsewhere tree.rename('my-lib/README.md', 'shared/my-destination/README.md'); diff --git a/packages/workspace/src/generators/move/lib/update-storybook-config.spec.ts b/packages/workspace/src/generators/move/lib/update-storybook-config.spec.ts index 1f295d7ff62fa..d385bd533fd4f 100644 --- a/packages/workspace/src/generators/move/lib/update-storybook-config.spec.ts +++ b/packages/workspace/src/generators/move/lib/update-storybook-config.spec.ts @@ -18,7 +18,6 @@ describe('updateStorybookConfig', () => { it('should handle storybook config not existing', async () => { await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-source'); const schema: NormalizedSchema = { @@ -44,7 +43,6 @@ describe('updateStorybookConfig', () => { await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-source'); tree.write(storybookMainPath, storybookMain); @@ -73,7 +71,6 @@ describe('updateStorybookConfig', () => { 'namespace/my-destination/.storybook/webpack.config.js'; await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-source'); tree.write(storybookWebpackConfigPath, storybookWebpackConfig); @@ -114,7 +111,6 @@ describe('updateStorybookConfig', () => { await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-source'); tree.write(storybookMainPath, storybookMain); @@ -158,7 +154,6 @@ describe('updateStorybookConfig', () => { await libraryGenerator(tree, { name: 'my-source', - projectNameAndRootFormat: 'as-provided', }); const projectConfig = readProjectConfiguration(tree, 'my-source'); tree.write(storybookWebpackConfigPath, storybookWebpackConfig); diff --git a/packages/workspace/src/generators/move/move.spec.ts b/packages/workspace/src/generators/move/move.spec.ts index 6f8e75c6bb0b3..559a025a6c336 100644 --- a/packages/workspace/src/generators/move/move.spec.ts +++ b/packages/workspace/src/generators/move/move.spec.ts @@ -24,7 +24,6 @@ describe('move', () => { it('should update jest config when moving down directories', async () => { await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); await moveGenerator(tree, { @@ -32,7 +31,6 @@ describe('move', () => { importPath: '@proj/shared-mylib', updateImportPath: true, destination: 'shared/my-lib-new', - projectNameAndRootFormat: 'as-provided', }); const jestConfigPath = 'shared/my-lib-new/jest.config.ts'; @@ -47,7 +45,6 @@ describe('move', () => { it('should make sure build targets are correct when moving', async () => { await libraryGenerator(tree, { name: 'one', - projectNameAndRootFormat: 'as-provided', }); const myLibConfig = readProjectConfiguration(tree, 'one'); @@ -73,7 +70,6 @@ describe('move', () => { newProjectName: 'two', updateImportPath: true, destination: 'shared/two', - projectNameAndRootFormat: 'as-provided', }); const myLibNewConfig = readProjectConfiguration(tree, 'two'); @@ -93,7 +89,6 @@ describe('move', () => { await libraryGenerator(tree, { name: 'shared-my-lib', directory: 'shared/my-lib', - projectNameAndRootFormat: 'as-provided', }); await moveGenerator(tree, { @@ -101,7 +96,6 @@ describe('move', () => { importPath: '@proj/mylib', updateImportPath: true, destination: 'my-lib-new', - projectNameAndRootFormat: 'as-provided', }); const jestConfigPath = 'my-lib-new/jest.config.ts'; @@ -116,7 +110,6 @@ describe('move', () => { it('should update $schema path when move', async () => { await libraryGenerator(tree, { name: 'my-lib', - projectNameAndRootFormat: 'as-provided', }); let projectJson = readJson(tree, 'my-lib/project.json'); @@ -129,7 +122,6 @@ describe('move', () => { importPath: '@proj/shared-mylib', updateImportPath: true, destination: 'shared/my-lib-new', - projectNameAndRootFormat: 'as-provided', }); projectJson = readJson(tree, 'shared/my-lib-new/project.json'); diff --git a/packages/workspace/src/generators/move/schema.d.ts b/packages/workspace/src/generators/move/schema.d.ts index 5af363e4735a4..c4fd298ef4d32 100644 --- a/packages/workspace/src/generators/move/schema.d.ts +++ b/packages/workspace/src/generators/move/schema.d.ts @@ -1,5 +1,3 @@ -import { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'; - export interface Schema { projectName: string; destination: string; @@ -7,7 +5,6 @@ export interface Schema { updateImportPath: boolean; skipFormat?: boolean; newProjectName?: string; - projectNameAndRootFormat?: ProjectNameAndRootFormat; } export interface NormalizedSchema extends Schema { diff --git a/packages/workspace/src/generators/move/schema.json b/packages/workspace/src/generators/move/schema.json index e67c483887195..ceea9a5130f21 100644 --- a/packages/workspace/src/generators/move/schema.json +++ b/packages/workspace/src/generators/move/schema.json @@ -33,11 +33,6 @@ "index": 0 } }, - "projectNameAndRootFormat": { - "description": "Whether to generate the new project name and destination as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", - "type": "string", - "enum": ["as-provided", "derived"] - }, "importPath": { "type": "string", "description": "The new import path to use in the `tsconfig.base.json`." diff --git a/packages/workspace/src/generators/npm-package/npm-package.ts b/packages/workspace/src/generators/npm-package/npm-package.ts index c7bdab3d859f1..2f6d4dc551095 100644 --- a/packages/workspace/src/generators/npm-package/npm-package.ts +++ b/packages/workspace/src/generators/npm-package/npm-package.ts @@ -10,8 +10,8 @@ import { join } from 'path'; import { getImportPath } from '../../utilities/get-import-path'; export interface ProjectOptions { - name: string; - directory?: string; + directory: string; + name?: string; } interface NormalizedProjectOptions extends ProjectOptions { diff --git a/packages/workspace/src/generators/npm-package/schema.json b/packages/workspace/src/generators/npm-package/schema.json index 70437019d348f..63a91cd535b75 100644 --- a/packages/workspace/src/generators/npm-package/schema.json +++ b/packages/workspace/src/generators/npm-package/schema.json @@ -6,26 +6,21 @@ "cli": "nx", "type": "object", "properties": { - "name": { + "directory": { "type": "string", - "description": "Package name.", + "description": "A directory where the package is placed.", + "alias": "dir", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name of your npm package?", - "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$" - }, - "directory": { - "type": "string", - "description": "A directory where the package is placed.", - "alias": "dir" + "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$", + "x-prompt": "Which directory do you want to create the package in?" }, - "projectNameAndRootFormat": { - "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", + "name": { "type": "string", - "enum": ["as-provided", "derived"] + "description": "Package name." } }, - "required": ["name"] + "required": ["directory"] } diff --git a/packages/workspace/src/generators/preset/preset.ts b/packages/workspace/src/generators/preset/preset.ts index b802e34751c1f..5a624e7dcf147 100644 --- a/packages/workspace/src/generators/preset/preset.ts +++ b/packages/workspace/src/generators/preset/preset.ts @@ -29,7 +29,6 @@ async function createPreset(tree: Tree, options: Schema) { return angularApplicationGenerator(tree, { name: options.name, directory: join('apps', options.name), - projectNameAndRootFormat: 'as-provided', style: options.style, linter: options.linter, standalone: options.standaloneApi, @@ -48,7 +47,6 @@ async function createPreset(tree: Tree, options: Schema) { return angularApplicationGenerator(tree, { name: options.name, directory: '.', - projectNameAndRootFormat: 'as-provided', style: options.style, linter: options.linter, routing: options.routing, @@ -67,7 +65,6 @@ async function createPreset(tree: Tree, options: Schema) { return reactApplicationGenerator(tree, { name: options.name, directory: join('apps', options.name), - projectNameAndRootFormat: 'as-provided', style: options.style, linter: options.linter, bundler: options.bundler ?? 'webpack', @@ -82,7 +79,6 @@ async function createPreset(tree: Tree, options: Schema) { return reactApplicationGenerator(tree, { name: options.name, directory: '.', - projectNameAndRootFormat: 'as-provided', style: options.style, linter: options.linter, rootProject: true, @@ -99,7 +95,6 @@ async function createPreset(tree: Tree, options: Schema) { return remixApplicationGenerator(tree, { name: options.name, directory: join('apps', options.name), - projectNameAndRootFormat: 'as-provided', linter: options.linter, e2eTestRunner: options.e2eTestRunner ?? 'playwright', unitTestRunner: 'vitest', @@ -113,7 +108,6 @@ async function createPreset(tree: Tree, options: Schema) { return remixApplicationGenerator(tree, { name: options.name, directory: '.', - projectNameAndRootFormat: 'as-provided', linter: options.linter, e2eTestRunner: options.e2eTestRunner ?? 'playwright', rootProject: true, @@ -128,7 +122,6 @@ async function createPreset(tree: Tree, options: Schema) { return vueApplicationGenerator(tree, { name: options.name, directory: join('apps', options.name), - projectNameAndRootFormat: 'as-provided', style: options.style, linter: options.linter, e2eTestRunner: options.e2eTestRunner ?? 'playwright', @@ -142,7 +135,6 @@ async function createPreset(tree: Tree, options: Schema) { return vueApplicationGenerator(tree, { name: options.name, directory: '.', - projectNameAndRootFormat: 'as-provided', style: options.style, linter: options.linter, rootProject: true, @@ -158,7 +150,6 @@ async function createPreset(tree: Tree, options: Schema) { return nuxtApplicationGenerator(tree, { name: options.name, directory: join('apps', options.name), - projectNameAndRootFormat: 'as-provided', style: options.style, linter: options.linter, e2eTestRunner: options.e2eTestRunner ?? 'playwright', @@ -172,7 +163,6 @@ async function createPreset(tree: Tree, options: Schema) { return nuxtApplicationGenerator(tree, { name: options.name, directory: '.', - projectNameAndRootFormat: 'as-provided', style: options.style, linter: options.linter, rootProject: true, @@ -188,7 +178,6 @@ async function createPreset(tree: Tree, options: Schema) { return nextApplicationGenerator(tree, { name: options.name, directory: join('apps', options.name), - projectNameAndRootFormat: 'as-provided', style: options.style, linter: options.linter, appDir: options.nextAppDir, @@ -202,7 +191,6 @@ async function createPreset(tree: Tree, options: Schema) { return nextApplicationGenerator(tree, { name: options.name, directory: '.', - projectNameAndRootFormat: 'as-provided', style: options.style, linter: options.linter, appDir: options.nextAppDir, @@ -218,7 +206,6 @@ async function createPreset(tree: Tree, options: Schema) { return webApplicationGenerator(tree, { name: options.name, directory: join('apps', options.name), - projectNameAndRootFormat: 'as-provided', style: options.style, linter: options.linter, bundler: 'vite', @@ -233,7 +220,6 @@ async function createPreset(tree: Tree, options: Schema) { return nestApplicationGenerator(tree, { name: options.name, directory: join('apps', options.name), - projectNameAndRootFormat: 'as-provided', linter: options.linter, e2eTestRunner: options.e2eTestRunner ?? 'jest', addPlugin, @@ -245,7 +231,6 @@ async function createPreset(tree: Tree, options: Schema) { return expressApplicationGenerator(tree, { name: options.name, directory: join('apps', options.name), - projectNameAndRootFormat: 'as-provided', linter: options.linter, e2eTestRunner: options.e2eTestRunner ?? 'jest', addPlugin, @@ -256,7 +241,6 @@ async function createPreset(tree: Tree, options: Schema) { return reactNativeApplicationGenerator(tree, { name: options.name, directory: join('apps', options.name), - projectNameAndRootFormat: 'as-provided', linter: options.linter, e2eTestRunner: options.e2eTestRunner ?? 'detox', addPlugin, @@ -267,7 +251,6 @@ async function createPreset(tree: Tree, options: Schema) { return expoApplicationGenerator(tree, { name: options.name, directory: join('apps', options.name), - projectNameAndRootFormat: 'as-provided', linter: options.linter, e2eTestRunner: options.e2eTestRunner ?? 'detox', addPlugin, @@ -281,7 +264,6 @@ async function createPreset(tree: Tree, options: Schema) { return libraryGenerator(tree, { name: options.name, directory: '.', - projectNameAndRootFormat: 'as-provided', bundler: 'tsc', unitTestRunner: 'vitest', testEnvironment: 'node', @@ -297,7 +279,6 @@ async function createPreset(tree: Tree, options: Schema) { bundler, name: options.name, directory: '.', - projectNameAndRootFormat: 'as-provided', linter: options.linter, standaloneConfig: options.standaloneConfig, framework: options.framework, @@ -314,7 +295,6 @@ async function createPreset(tree: Tree, options: Schema) { bundler, name: options.name, directory: join('apps', options.name), - projectNameAndRootFormat: 'as-provided', linter: options.linter, framework: options.framework, docker: options.docker, diff --git a/packages/workspace/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.ts b/packages/workspace/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.ts index 5f934632ccb75..b4535e3244a88 100644 --- a/packages/workspace/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.ts +++ b/packages/workspace/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.ts @@ -208,7 +208,6 @@ function moveGeneratedPlugin( newProjectName: PROJECT_NAME, updateImportPath: true, importPath: importPath, - projectNameAndRootFormat: 'as-provided', }); } }