From 251d28248e82b6324ef456e130804eae863a20bc Mon Sep 17 00:00:00 2001 From: Isaac Mann Date: Fri, 20 Oct 2023 14:19:20 -0400 Subject: [PATCH] docs(core): deprecate workspaceLayout --- docs/generated/manifests/menus.json | 32 ++++---- docs/generated/manifests/nx.json | 40 +++++----- docs/generated/manifests/tags.json | 7 -- .../angular/generators/application.json | 2 +- .../packages/angular/generators/library.json | 2 +- .../packages/esbuild/documents/overview.md | 2 +- .../packages/js/generators/library.json | 2 +- .../packages/next/generators/application.json | 2 +- .../packages/next/generators/library.json | 2 +- .../react/generators/application.json | 2 +- .../packages/vue/generators/application.json | 2 +- .../packages/web/generators/application.json | 2 +- docs/map.json | 13 ++- docs/shared/deprecated/workspace-layout.md | 68 ++++++++++++++++ docs/shared/guides/remix.md | 2 +- .../setup-incremental-builds-angular.md | 2 +- docs/shared/migration/migration-angularjs.md | 2 +- .../shared/packages/esbuild/esbuild-plugin.md | 2 +- docs/shared/recipes/add-stack/add-astro.md | 2 +- docs/shared/recipes/add-stack/add-deno.md | 4 +- docs/shared/recipes/add-stack/add-dotnet.md | 4 +- docs/shared/recipes/add-stack/add-express.md | 4 +- docs/shared/recipes/add-stack/add-fastify.md | 4 +- docs/shared/recipes/add-stack/add-lit.md | 4 +- docs/shared/recipes/add-stack/add-qwik.md | 4 +- docs/shared/recipes/add-stack/add-rust.md | 4 +- docs/shared/recipes/add-stack/add-solid.md | 4 +- docs/shared/recipes/add-stack/add-svelte.md | 2 +- docs/shared/recipes/add-stack/add-vue.md | 2 +- docs/shared/recipes/deployment/deno-deploy.md | 2 +- .../deployment/deno-netlify-edge-functions.md | 2 +- .../storybook/one-storybook-for-all.md | 2 +- .../storybook/one-storybook-per-scope.md | 2 +- .../one-storybook-with-composition.md | 2 +- docs/shared/reference/nx-json.md | 79 ++++++------------- docs/shared/reference/sitemap.md | 1 + packages/angular/docs/application-examples.md | 2 +- packages/angular/docs/library-examples.md | 2 +- packages/js/docs/library-examples.md | 2 +- packages/next/docs/application-examples.md | 2 +- packages/next/docs/library-examples.md | 2 +- packages/nuxt/docs/application-examples.md | 2 +- packages/react/docs/application-examples.md | 2 +- packages/vue/docs/application-examples.md | 2 +- packages/web/docs/application-examples.md | 2 +- 45 files changed, 178 insertions(+), 154 deletions(-) create mode 100644 docs/shared/deprecated/workspace-layout.md diff --git a/docs/generated/manifests/menus.json b/docs/generated/manifests/menus.json index dc2360ab1fbda..a316e15566803 100644 --- a/docs/generated/manifests/menus.json +++ b/docs/generated/manifests/menus.json @@ -4948,6 +4948,14 @@ "children": [], "disableCollapsible": false }, + { + "name": "workspace-layout", + "path": "/deprecated/workspace-layout", + "id": "workspace-layout", + "isExternal": false, + "children": [], + "disableCollapsible": false + }, { "name": "Workspace Generators", "path": "/deprecated/workspace-generators", @@ -5072,6 +5080,14 @@ "children": [], "disableCollapsible": false }, + { + "name": "workspace-layout", + "path": "/deprecated/workspace-layout", + "id": "workspace-layout", + "isExternal": false, + "children": [], + "disableCollapsible": false + }, { "name": "Workspace Generators", "path": "/deprecated/workspace-generators", @@ -5279,14 +5295,6 @@ "children": [], "disableCollapsible": false }, - { - "name": "nx.json workspaceLayout property", - "path": "/reference/nx-json#workspace-layout", - "id": "nxjson-workspaceLayout", - "isExternal": true, - "children": [], - "disableCollapsible": false - }, { "name": "nx.json generator defaults", "path": "/reference/nx-json#generators", @@ -5346,14 +5354,6 @@ "children": [], "disableCollapsible": false }, - { - "name": "nx.json workspaceLayout property", - "path": "/reference/nx-json#workspace-layout", - "id": "nxjson-workspaceLayout", - "isExternal": true, - "children": [], - "disableCollapsible": false - }, { "name": "nx.json generator defaults", "path": "/reference/nx-json#generators", diff --git a/docs/generated/manifests/nx.json b/docs/generated/manifests/nx.json index a7f97e38136e3..eddbcb4a682e8 100644 --- a/docs/generated/manifests/nx.json +++ b/docs/generated/manifests/nx.json @@ -6170,6 +6170,16 @@ "path": "/deprecated/workspace-lint", "tags": [] }, + { + "id": "workspace-layout", + "name": "workspace-layout", + "description": "", + "file": "shared/deprecated/workspace-layout", + "itemList": [], + "isExternal": false, + "path": "/deprecated/workspace-layout", + "tags": [] + }, { "id": "workspace-generators", "name": "Workspace Generators", @@ -6326,6 +6336,16 @@ "path": "/deprecated/workspace-lint", "tags": [] }, + "/deprecated/workspace-layout": { + "id": "workspace-layout", + "name": "workspace-layout", + "description": "", + "file": "shared/deprecated/workspace-layout", + "itemList": [], + "isExternal": false, + "path": "/deprecated/workspace-layout", + "tags": [] + }, "/deprecated/workspace-generators": { "id": "workspace-generators", "name": "Workspace Generators", @@ -6583,16 +6603,6 @@ "path": "/reference/project-configuration#inputs-&-namedinputs", "tags": ["cache-task-results"] }, - { - "id": "nxjson-workspaceLayout", - "name": "nx.json workspaceLayout property", - "description": "", - "file": "", - "itemList": [], - "isExternal": true, - "path": "/reference/nx-json#workspace-layout", - "tags": ["enforce-module-boundaries"] - }, { "id": "nxjson-generator-defaults", "name": "nx.json generator defaults", @@ -6668,16 +6678,6 @@ "path": "/reference/project-configuration#inputs-&-namedinputs", "tags": ["cache-task-results"] }, - "/reference/nx-json#workspace-layout": { - "id": "nxjson-workspaceLayout", - "name": "nx.json workspaceLayout property", - "description": "", - "file": "", - "itemList": [], - "isExternal": true, - "path": "/reference/nx-json#workspace-layout", - "tags": ["enforce-module-boundaries"] - }, "/reference/nx-json#generators": { "id": "nxjson-generator-defaults", "name": "nx.json generator defaults", diff --git a/docs/generated/manifests/tags.json b/docs/generated/manifests/tags.json index f3fc0a832f4dd..121ff37ca5a5e 100644 --- a/docs/generated/manifests/tags.json +++ b/docs/generated/manifests/tags.json @@ -369,13 +369,6 @@ "name": ".nxignore", "path": "/reference/nxignore" }, - { - "description": "", - "file": "", - "id": "nxjson-workspaceLayout", - "name": "nx.json workspaceLayout property", - "path": "/reference/nx-json#workspace-layout" - }, { "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.", "file": "generated/packages/generated/packages/nx/documents/format-check", diff --git a/docs/generated/packages/angular/generators/application.json b/docs/generated/packages/angular/generators/application.json index 8c04afe750531..9c4b999dce985 100644 --- a/docs/generated/packages/angular/generators/application.json +++ b/docs/generated/packages/angular/generators/application.json @@ -177,7 +177,7 @@ }, "additionalProperties": false, "required": ["name"], - "examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Application\" %}\n\nCreate an application named `my-app`:\n\n```bash\nnx g @nx/angular:application 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 [workspace layout documentation](/reference/nx-json#workspace-layout) for more details.\n{% /callout %}\n\n```bash\nnx g @nx/angular:app my-app --directory=my-dir/my-app --style=scss\n```\n\n{% /tab %}\n\n{% tab label=\"Single File Components application\" %}\n\nCreate an application with Single File Components (inline styles and inline templates):\n\n```bash\nnx g @nx/angular:app my-app --inlineStyle --inlineTemplate\n```\n\n{% /tab %}\n\n{% tab label=\"Standalone Components application\" %}\n\nCreate an application that is setup to use standalone components:\n\n```bash\nnx g @nx/angular:app my-app --standalone\n```\n\n{% /tab %}\n\n{% tab label=\"Set custom prefix and tags\" %}\n\nSet the prefix to apply to generated selectors and add tags to the application (used for linting).\n\n```bash\nnx g @nx/angular:app my-app --prefix=admin --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n", + "examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Application\" %}\n\nCreate an application named `my-app`:\n\n```bash\nnx g @nx/angular:application 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 [workspace layout documentation](/deprecated/workspace-layout) for more details.\n{% /callout %}\n\n```bash\nnx g @nx/angular:app my-app --directory=my-dir/my-app --style=scss\n```\n\n{% /tab %}\n\n{% tab label=\"Single File Components application\" %}\n\nCreate an application with Single File Components (inline styles and inline templates):\n\n```bash\nnx g @nx/angular:app my-app --inlineStyle --inlineTemplate\n```\n\n{% /tab %}\n\n{% tab label=\"Standalone Components application\" %}\n\nCreate an application that is setup to use standalone components:\n\n```bash\nnx g @nx/angular:app my-app --standalone\n```\n\n{% /tab %}\n\n{% tab label=\"Set custom prefix and tags\" %}\n\nSet the prefix to apply to generated selectors and add tags to the application (used for linting).\n\n```bash\nnx g @nx/angular:app my-app --prefix=admin --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n", "presets": [] }, "aliases": ["app"], diff --git a/docs/generated/packages/angular/generators/library.json b/docs/generated/packages/angular/generators/library.json index afc77f39bd074..5aac4e14276dc 100644 --- a/docs/generated/packages/angular/generators/library.json +++ b/docs/generated/packages/angular/generators/library.json @@ -204,7 +204,7 @@ }, "additionalProperties": false, "required": ["name"], - "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 [workspace layout documentation](/reference/nx-json#workspace-layout) 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\n{% tab label=\"Standalone component\"%}\nCreates the `my-standalone-lib` library with a standalone component as an entry point instead of an ng-module. The component can be used via the `myorg-standalone-component` selector.\n\n```bash\nnx g @nx/angular:library --standalone --selector=myorg-standalone-component my-standalone-lib\n```\n\n{% /tab %}\n", + "examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Library\" %}\n\nCreates the `my-ui-lib` library with an `ui` tag:\n\n```bash\nnx g @nx/angular:library 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 [workspace layout documentation](/deprecated/workspace-layout) 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\n{% tab label=\"Standalone component\"%}\nCreates the `my-standalone-lib` library with a standalone component as an entry point instead of an ng-module. The component can be used via the `myorg-standalone-component` selector.\n\n```bash\nnx g @nx/angular:library --standalone --selector=myorg-standalone-component my-standalone-lib\n```\n\n{% /tab %}\n", "presets": [] }, "aliases": ["lib"], diff --git a/docs/generated/packages/esbuild/documents/overview.md b/docs/generated/packages/esbuild/documents/overview.md index 0a4d96a8b39b3..b66ce9161ef94 100644 --- a/docs/generated/packages/esbuild/documents/overview.md +++ b/docs/generated/packages/esbuild/documents/overview.md @@ -37,7 +37,7 @@ yarn add -D @nx/esbuild ### Creating a new JS library {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} You can add a new library that builds using esbuild with: diff --git a/docs/generated/packages/js/generators/library.json b/docs/generated/packages/js/generators/library.json index 51f017a3c0f0b..b1b59e5e376ac 100644 --- a/docs/generated/packages/js/generators/library.json +++ b/docs/generated/packages/js/generators/library.json @@ -141,7 +141,7 @@ } }, "required": ["name"], - "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](https://nx.dev/packages/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 [workspace layout documentation](/reference/nx-json#workspace-layout) 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", + "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](https://nx.dev/packages/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 [workspace layout documentation](/deprecated/workspace-layout) 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": [] }, "aliases": ["lib"], diff --git a/docs/generated/packages/next/generators/application.json b/docs/generated/packages/next/generators/application.json index db655fddeb0a6..62dac6323b556 100644 --- a/docs/generated/packages/next/generators/application.json +++ b/docs/generated/packages/next/generators/application.json @@ -133,7 +133,7 @@ } }, "required": [], - "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 [workspace layout documentation](/reference/nx-json#workspace-layout) 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", + "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 [workspace layout documentation](/deprecated/workspace-layout) 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": [] }, "aliases": ["app"], diff --git a/docs/generated/packages/next/generators/library.json b/docs/generated/packages/next/generators/library.json index e18f8a63d1115..d121edf5f0066 100644 --- a/docs/generated/packages/next/generators/library.json +++ b/docs/generated/packages/next/generators/library.json @@ -149,7 +149,7 @@ } }, "required": ["name"], - "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 [workspace layout documentation](/reference/nx-json#workspace-layout) 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", + "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 [workspace layout documentation](/deprecated/workspace-layout) 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": [] }, "aliases": ["lib"], diff --git a/docs/generated/packages/react/generators/application.json b/docs/generated/packages/react/generators/application.json index f240522122b4a..80d8b4a3d667a 100644 --- a/docs/generated/packages/react/generators/application.json +++ b/docs/generated/packages/react/generators/application.json @@ -187,7 +187,7 @@ } }, "required": ["name"], - "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 [workspace layout documentation](/reference/nx-json#workspace-layout) 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", + "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 [workspace layout documentation](/deprecated/workspace-layout) 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": [] }, "aliases": ["app"], diff --git a/docs/generated/packages/vue/generators/application.json b/docs/generated/packages/vue/generators/application.json index f83acb40bb162..edb7e796dff60 100644 --- a/docs/generated/packages/vue/generators/application.json +++ b/docs/generated/packages/vue/generators/application.json @@ -130,7 +130,7 @@ } }, "required": ["name"], - "examplesFile": "## 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 [workspace layout documentation](/reference/nx-json#workspace-layout) 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", + "examplesFile": "## 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 [workspace layout documentation](/deprecated/workspace-layout) 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": [] }, "aliases": ["app"], diff --git a/docs/generated/packages/web/generators/application.json b/docs/generated/packages/web/generators/application.json index 14a67a4242ea0..3cfcc5c56739f 100644 --- a/docs/generated/packages/web/generators/application.json +++ b/docs/generated/packages/web/generators/application.json @@ -106,7 +106,7 @@ } }, "required": ["name"], - "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 [workspace layout documentation](/reference/nx-json#workspace-layout) 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", + "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 [workspace layout documentation](/deprecated/workspace-layout) 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": [] }, "aliases": ["app"], diff --git a/docs/map.json b/docs/map.json index c7222c64744bd..cdbf2715cbbd0 100644 --- a/docs/map.json +++ b/docs/map.json @@ -1388,6 +1388,11 @@ "id": "workspace-lint", "file": "shared/deprecated/workspace-lint" }, + { + "name": "workspace-layout", + "id": "workspace-layout", + "file": "shared/deprecated/workspace-layout" + }, { "name": "Workspace Generators", "id": "workspace-generators", @@ -1516,14 +1521,6 @@ "path": "/reference/project-configuration#inputs-&-namedinputs", "isExternal": true }, - { - "name": "nx.json workspaceLayout property", - "id": "nxjson-workspaceLayout", - "file": "", - "tags": ["enforce-module-boundaries"], - "path": "/reference/nx-json#workspace-layout", - "isExternal": true - }, { "name": "nx.json generator defaults", "id": "nxjson-generator-defaults", diff --git a/docs/shared/deprecated/workspace-layout.md b/docs/shared/deprecated/workspace-layout.md new file mode 100644 index 0000000000000..b614d46a009ce --- /dev/null +++ b/docs/shared/deprecated/workspace-layout.md @@ -0,0 +1,68 @@ +# Workspace Layout and projectNameAndRootFormat + +As of Nx 16.8.0, generating a project will prompt you to choose how Nx will calculate where the project should be located. You can choose between `as-provided` and `derived`. `as-provided` will be the default in Nx 18. + +## `as-provided` + +This setting makes app or lib generators behave in the following way: + +- `nx g app my-app` creates a new application named `my-app` in the `/my-app` folder +- `nx g lib my-lib` creates a new library named `my-lib` in the `/my-lib` folder +- `nx g app my-app --directory=apps/nested/my-app` creates a new application named `my-app` in the `/apps/nested/my-app` folder +- `nx g lib my-lib --directory=libs/shared/ui/my-lib` creates a new library named `my-lib` in the `/libs/shared/ui/my-lib` folder + +## `derived` + +Choosing `derived` makes Nx behave the way it did before version 16.8.0. Nx will check the `workspaceLayout` property in `nx.json` to determine how it should calculate the path to the new project. + +```json +{ + "workspaceLayout": { + "appsDir": "demos", + "libsDir": "packages" + } +} +``` + +These settings would store apps in `/demos/` and libraries in `/packages/`. The paths specified are relative to the +workspace root. + +This makes app or lib generators behave in the following way: + +- `nx g app my-app` creates a new application named `my-app` in the `/demos/my-app` folder +- `nx g lib my-lib` creates a new library named `my-lib` in the `/packages/my-lib` folder +- `nx g app my-app --directory=nested` creates a new application named `nested-my-app` in the `/demos/nested/my-app` folder +- `nx g lib my-lib --directory=shared/ui` creates a new library named `shared-ui-my-lib` in the `/packages/shared/ui/my-lib` folder + +If you accidentally generate a project in the wrong folder, use the [move generator](/nx-api/workspace/generators/move) to move it to the correct location. + +## Skipping the Prompt + +You can skip the prompt in two ways: + +1. Specify a flag directly in the terminal `nx g app my-app --directory=apps/my-app --projectNameAndRootFormat=as-provided` +2. Set a default value for that property for every generator that you use. + +```jsonc {% fileName="nx.json" %} +{ + "generators": { + "@nx/node": { + "application": { + "projectNameAndRootFormat": "as-provided" + }, + "library": { + "projectNameAndRootFormat": "as-provided" + } + }, + "@nx/react": { + "application": { + "projectNameAndRootFormat": "as-provided" + }, + "library": { + "projectNameAndRootFormat": "as-provided" + } + } + // etc + } +} +``` diff --git a/docs/shared/guides/remix.md b/docs/shared/guides/remix.md index 755056ab499fb..75de279ff3b02 100644 --- a/docs/shared/guides/remix.md +++ b/docs/shared/guides/remix.md @@ -38,7 +38,7 @@ npm install --save-dev @nx/remix ## Generate a Remix Application {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```{% command="nx g @nx/remix:app myapp --directory=apps/myapp" path="~/acme" %} diff --git a/docs/shared/guides/setup-incremental-builds-angular.md b/docs/shared/guides/setup-incremental-builds-angular.md index bef3d58bac503..f48e5d1517756 100644 --- a/docs/shared/guides/setup-incremental-builds-angular.md +++ b/docs/shared/guides/setup-incremental-builds-angular.md @@ -53,7 +53,7 @@ node-linker=hoisted To enable incremental builds you need to use buildable libraries. {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} You can generate a new buildable library with: diff --git a/docs/shared/migration/migration-angularjs.md b/docs/shared/migration/migration-angularjs.md index 896ebd9958963..881a839884582 100644 --- a/docs/shared/migration/migration-angularjs.md +++ b/docs/shared/migration/migration-angularjs.md @@ -54,7 +54,7 @@ Codebases with existing unit and e2e tests should continue to use whatever runne With the Angular capability added, generate your application: {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell diff --git a/docs/shared/packages/esbuild/esbuild-plugin.md b/docs/shared/packages/esbuild/esbuild-plugin.md index 0a4d96a8b39b3..b66ce9161ef94 100644 --- a/docs/shared/packages/esbuild/esbuild-plugin.md +++ b/docs/shared/packages/esbuild/esbuild-plugin.md @@ -37,7 +37,7 @@ yarn add -D @nx/esbuild ### Creating a new JS library {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} You can add a new library that builds using esbuild with: diff --git a/docs/shared/recipes/add-stack/add-astro.md b/docs/shared/recipes/add-stack/add-astro.md index 6595ffe9003e7..fd280641709c3 100644 --- a/docs/shared/recipes/add-stack/add-astro.md +++ b/docs/shared/recipes/add-stack/add-astro.md @@ -90,7 +90,7 @@ npm i -DE @nx/js@ Then generate a project {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```{% command="nx g @nx/js:lib ui --directory=libs/ui --simpleName --minimal} diff --git a/docs/shared/recipes/add-stack/add-deno.md b/docs/shared/recipes/add-stack/add-deno.md index b6985e1896cc1..f26ebf038dde5 100644 --- a/docs/shared/recipes/add-stack/add-deno.md +++ b/docs/shared/recipes/add-stack/add-deno.md @@ -42,7 +42,7 @@ yarn add --dev @nx/deno ## Create an Application {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} Use the `app` generator to create a new Deno app. @@ -62,7 +62,7 @@ This starts the application on localhost:4200 by default. ## Create a Library {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} To create a new library, run: diff --git a/docs/shared/recipes/add-stack/add-dotnet.md b/docs/shared/recipes/add-stack/add-dotnet.md index 75f4aaac88b5b..c28490f8a4d19 100644 --- a/docs/shared/recipes/add-stack/add-dotnet.md +++ b/docs/shared/recipes/add-stack/add-dotnet.md @@ -106,7 +106,7 @@ This generates the following files: Use the `app` generator to create a new .NET app. For this demo, use the `nx` path naming convention and the `web-api` project template. {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell @@ -124,7 +124,7 @@ nx serve my-api To create a new library, run the library generator. Use the `classlib` template. {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell diff --git a/docs/shared/recipes/add-stack/add-express.md b/docs/shared/recipes/add-stack/add-express.md index 41b913041a0dc..55c9eaaa56e3b 100644 --- a/docs/shared/recipes/add-stack/add-express.md +++ b/docs/shared/recipes/add-stack/add-express.md @@ -44,7 +44,7 @@ yarn add --dev @nx/express Use the `app` generator to create a new Express app. {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell @@ -64,7 +64,7 @@ This starts the application on localhost:3333/api by default. The `@nx/express` plugin does not have a `library` generator, but we can use the `library` generator from the `@nx/js` plugin. To create a new library, install the `@nx/js` package and run: {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell diff --git a/docs/shared/recipes/add-stack/add-fastify.md b/docs/shared/recipes/add-stack/add-fastify.md index bdaba7bc8f746..ddd1d88ec0f1e 100644 --- a/docs/shared/recipes/add-stack/add-fastify.md +++ b/docs/shared/recipes/add-stack/add-fastify.md @@ -57,7 +57,7 @@ yarn add --dev @nx/node Use the `app` generator to create a new Fastify app. {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell @@ -77,7 +77,7 @@ This starts the application on localhost:3000/api by default. To create a new library, run: {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell diff --git a/docs/shared/recipes/add-stack/add-lit.md b/docs/shared/recipes/add-stack/add-lit.md index 5a8897632e2ce..0b9f983964bce 100644 --- a/docs/shared/recipes/add-stack/add-lit.md +++ b/docs/shared/recipes/add-stack/add-lit.md @@ -44,7 +44,7 @@ yarn add --dev @nx/node lit http-server ## Create an Application {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} We'll start with a node application and then tweak the settings to match what we need. Add a new node application to your workspace with the following command: @@ -168,7 +168,7 @@ nx serve my-lit-app ## Create a Library {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} Let's create a library that our Lit application is going to consume. To create a new library, install the `@nx/js` package and run: diff --git a/docs/shared/recipes/add-stack/add-qwik.md b/docs/shared/recipes/add-stack/add-qwik.md index 51dd376566b57..7eb2c36abade8 100644 --- a/docs/shared/recipes/add-stack/add-qwik.md +++ b/docs/shared/recipes/add-stack/add-qwik.md @@ -61,7 +61,7 @@ If you need help finding the version of `nx` you are currently using, run `nx re Let's generate a new application using `qwik-nx`. {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell @@ -73,7 +73,7 @@ nx g qwik-nx:app todo --directory=apps/todo Let's generate a new library using `qwik-nx`. {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell diff --git a/docs/shared/recipes/add-stack/add-rust.md b/docs/shared/recipes/add-stack/add-rust.md index e6d101155f53f..8431b40a3f621 100644 --- a/docs/shared/recipes/add-stack/add-rust.md +++ b/docs/shared/recipes/add-stack/add-rust.md @@ -61,7 +61,7 @@ Using the preset provided by `@monodon/rust` will: Let's generate a new application using `@monodon/rust`. {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell @@ -73,7 +73,7 @@ nx g @monodon/rust:binary myapp --directory=apps/myapp Let's generate a new library using `@monodon/rust`. {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell diff --git a/docs/shared/recipes/add-stack/add-solid.md b/docs/shared/recipes/add-stack/add-solid.md index 98e1512c053ce..070677c6f0391 100644 --- a/docs/shared/recipes/add-stack/add-solid.md +++ b/docs/shared/recipes/add-stack/add-solid.md @@ -54,7 +54,7 @@ pnpm i --save-dev @nx/web solid-devtools vite-plugin-solid ## Create an Application {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} We'll start with a web application and then tweak the settings to match what we need. Add a new web application to your @@ -233,7 +233,7 @@ You can now run `nx serve my-solid-app` and your Solid application can be viewed ## Create a Library {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} Let's create a library that our Solid application is going to consume. To create a new library, install the `@nx/js` diff --git a/docs/shared/recipes/add-stack/add-svelte.md b/docs/shared/recipes/add-stack/add-svelte.md index d7252237e3b7f..6dc35e18712e1 100644 --- a/docs/shared/recipes/add-stack/add-svelte.md +++ b/docs/shared/recipes/add-stack/add-svelte.md @@ -274,7 +274,7 @@ Navigate to `http://localhost:4200` and you should see your application. Instead of having our Counter directly defined in `App.svelte` file, let's create a library that we can import into our application. {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell diff --git a/docs/shared/recipes/add-stack/add-vue.md b/docs/shared/recipes/add-stack/add-vue.md index c15acd64ae159..fa065491f1d40 100644 --- a/docs/shared/recipes/add-stack/add-vue.md +++ b/docs/shared/recipes/add-stack/add-vue.md @@ -236,7 +236,7 @@ nx serve acme Instead of having our Counter directly defined in the app we can instead create a library that exports the Counter component. {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} Create a new library `nx generate @nx/js:library --name=Counter --directory=libs/counter --unitTestRunner=vitest --bundler=vite --importPath=@acme/counter` diff --git a/docs/shared/recipes/deployment/deno-deploy.md b/docs/shared/recipes/deployment/deno-deploy.md index 667bdc49d93fd..5b2ce65700ff5 100644 --- a/docs/shared/recipes/deployment/deno-deploy.md +++ b/docs/shared/recipes/deployment/deno-deploy.md @@ -43,7 +43,7 @@ pnpm add -D @nx/deno {% /tabs %} {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} Then generate a new Deno app with the following command: diff --git a/docs/shared/recipes/deployment/deno-netlify-edge-functions.md b/docs/shared/recipes/deployment/deno-netlify-edge-functions.md index 228674f54e7c3..4d6e000cc0261 100644 --- a/docs/shared/recipes/deployment/deno-netlify-edge-functions.md +++ b/docs/shared/recipes/deployment/deno-netlify-edge-functions.md @@ -41,7 +41,7 @@ pnpm add -D @nx/deno {% /tabs %} {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} Then generate a new Deno app with the following command: diff --git a/docs/shared/recipes/storybook/one-storybook-for-all.md b/docs/shared/recipes/storybook/one-storybook-for-all.md index 60dcbd26d38e9..4442814c64494 100644 --- a/docs/shared/recipes/storybook/one-storybook-for-all.md +++ b/docs/shared/recipes/storybook/one-storybook-for-all.md @@ -21,7 +21,7 @@ Let’s see how we can implement this solution: According to the framework you are using, use the corresponding generator to generate a new library. Let’s suppose that you are using React and all your stories are using the `@storybook/react-vite` framework: {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell diff --git a/docs/shared/recipes/storybook/one-storybook-per-scope.md b/docs/shared/recipes/storybook/one-storybook-per-scope.md index edbef1bef47d5..b7832c2cc1421 100644 --- a/docs/shared/recipes/storybook/one-storybook-per-scope.md +++ b/docs/shared/recipes/storybook/one-storybook-per-scope.md @@ -87,7 +87,7 @@ Let's assume in this case that all our libraries are using Angular. Let's generate three Angular libraries, one for each scope, and let's call them `storybook-host-client`, `storybook-host-admin`, and `storybook-host-shared`. We can do this by running the following commands: {% callout type="note" title="Directory Flag Behavior Changes" %} -The commands below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The commands below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell diff --git a/docs/shared/recipes/storybook/one-storybook-with-composition.md b/docs/shared/recipes/storybook/one-storybook-with-composition.md index a5ec060360c48..7476c23af6129 100644 --- a/docs/shared/recipes/storybook/one-storybook-with-composition.md +++ b/docs/shared/recipes/storybook/one-storybook-with-composition.md @@ -29,7 +29,7 @@ We are going to assume that you are at the state where you already have your `st It does not matter which framework you use for the host Storybook library. It can be any framework really, and it does not have to be one of the frameworks that are used in the hosted apps. The only thing that is important is for this host library to have _at least one story_. This is important, or else Storybook will not load. The one story can be a component, for example, which would work like a title for the application, or any other introduction to your Storybook you see fit. {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, omit the `--directory` flag. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} So, let’s use React for the Storybook Composition host library: diff --git a/docs/shared/reference/nx-json.md b/docs/shared/reference/nx-json.md index 67f98faa47cd6..aaa5a7a697ccc 100644 --- a/docs/shared/reference/nx-json.md +++ b/docs/shared/reference/nx-json.md @@ -4,28 +4,17 @@ The `nx.json` file configures the Nx CLI and project defaults. The full [machine The following is an expanded example showing all options. Your `nx.json` will likely be much shorter. For a more intuitive understanding of the roles of each option, you can highlight the options in the excerpt below that relate to different categories. -```json {% fileName="nx.json" lineGroups={ Caching:[15,16,17,18,19,20,21,22,23,24,25,26,29], Orchestration:[3,4,5,28,30], Execution:[28,31,32,33,34] } %} +```json {% fileName="nx.json" lineGroups={ Caching:[11,12,13,14,17,23,27], Orchestration:[3,4,5,18], Execution:[19,20,21,22] } %} { "extends": "nx/presets/npm.json", "affected": { "defaultBase": "main" }, - "workspaceLayout": { - "projectNameAndRootFormat": "as-provided" - }, "generators": { "@nx/js:library": { "buildable": true } }, - "tasksRunnerOptions": { - "default": { - "runner": "nx/tasks-runners/default", - "options": { - "cacheableOperations": ["build", "lint", "test", "e2e"] - } - } - }, "namedInputs": { "default": ["{projectRoot}/**/*"], "production": ["!{projectRoot}/**/*.spec.tsx"] @@ -40,7 +29,9 @@ The following is an expanded example showing all options. Your `nx.json` will li }, "cache": true } - } + }, + "parallel": 4, + "cacheDirectory": "tmp/my-nx-cache" } ``` @@ -62,49 +53,6 @@ Tells Nx which branch and HEAD to use when calculating affected projects. - `defaultBase` defines the default base branch, defaulted to `main`. -### Workspace Layout - -You can add a `workspaceLayout` property to modify where libraries and apps are located. As of Nx 16.8.0, there is a property called `projectNameAndRootFormat` that determines how this configuration block is interpreted. The default setting is `"projectNameAndRootFormat": "as-provided"`. - -```json -{ - "workspaceLayout": { - "projectNameAndRootFormat": "as-provided" - } -} -``` - -This setting makes app or lib generators behave in the following way: - -- `nx g app my-app` creates a new application named `my-app` in the `/my-app` folder -- `nx g lib my-lib` creates a new library named `my-lib` in the `/my-lib` folder -- `nx g app my-app --directory=apps/nested/my-app` creates a new application named `my-app` in the `/apps/nested/my-app` folder -- `nx g lib my-lib --directory=libs/shared/ui/my-lib` creates a new library named `my-lib` in the `/libs/shared/ui/my-lib` folder - -The other style is `"projectNameAndRootFormat": "derived"`, which behaves the way Nx did before version 16.8.0. - -```json -{ - "workspaceLayout": { - "projectNameAndRootFormat": "derived", - "appsDir": "demos", - "libsDir": "packages" - } -} -``` - -These settings would store apps in `/demos/` and libraries in `/packages/`. The paths specified are relative to the -workspace root. - -This makes app or lib generators behave in the following way: - -- `nx g app my-app` creates a new application named `my-app` in the `/demos/my-app` folder -- `nx g lib my-lib` creates a new library named `my-lib` in the `/packages/my-lib` folder -- `nx g app my-app --directory=nested` creates a new application named `nested-my-app` in the `/demos/nested/my-app` folder -- `nx g lib my-lib --directory=shared/ui` creates a new library named `shared-ui-my-lib` in the `/packages/shared/ui/my-lib` folder - -If you accidentally generate a project in the wrong folder, use the [move generator](/nx-api/workspace/generators/move) to move it to the correct location. - ### inputs & namedInputs Named inputs defined in `nx.json` are merged with the named inputs defined in each project's project.json. In other words, every project has a set of named inputs, and it's defined as: `{...namedInputsFromNxJson, ...namedInputsFromProjectsProjectJson}`. @@ -257,12 +205,29 @@ pass `--buildable=true` when creating new libraries. Tasks runners are invoked when you run `nx test`, `nx build`, `nx run-many`, `nx affected`, and so on. The tasks runner named "default" is used by default. Specify a different one like this `nx run-many -t build --runner=another`. +To register a tasks runner, add it to `nx.json` like this: + +```json {% fileName="nx.json" %} +{ + "tasksRunnerOptions": { + "another": { + "runner": "nx/tasks-runners/default", + "options": {} + } + } +} +``` + Tasks runners can accept different options. The following are the options supported by `"nx/tasks-runners/default"` and `"nx-cloud"`. +{% callout type="note" title="Define these properties at the root" %} +As of Nx 17, if you only use one tasks runner, you can specify these properties at the root of `nx.json` instead of inside the `tasksRunnerOptions` property. +{% /callout %} + | Property | Description | | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| cacheableOperations | defines the list of targets/operations that are cached by Nx | +| cacheableOperations | In Nx < 17, defined the list of targets/operations that were cached by Nx. In Nx 17, use the `cache` property in `targetDefaults` or individual target definitions | | parallel | defines the max number of targets ran in parallel (in older versions of Nx you had to pass `--parallel --maxParallel=3` instead of `--parallel=3`) | | captureStderr | defines whether the cache captures stderr or just stdout | | skipNxCache | defines whether the Nx Cache should be skipped (defaults to `false`) | diff --git a/docs/shared/reference/sitemap.md b/docs/shared/reference/sitemap.md index b447c5c9e28b3..36864f55c861a 100644 --- a/docs/shared/reference/sitemap.md +++ b/docs/shared/reference/sitemap.md @@ -231,6 +231,7 @@ - [Deprecated](/deprecated) - [workspace.json](/deprecated/workspace-json) - [workspace-lint](/deprecated/workspace-lint) + - [workspace-layout](/deprecated/workspace-layout) - [Workspace Generators](/deprecated/workspace-generators) - [Workspace Executors](/deprecated/workspace-executors) - [defaultCollection](/deprecated/default-collection) diff --git a/packages/angular/docs/application-examples.md b/packages/angular/docs/application-examples.md index ba912e4bd3fde..1da04b4e5bdc5 100644 --- a/packages/angular/docs/application-examples.md +++ b/packages/angular/docs/application-examples.md @@ -16,7 +16,7 @@ nx g @nx/angular:application my-app Create an application named `my-app` in the `my-dir` directory and use `scss` for styles: {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=my-dir`. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=my-dir`. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```bash diff --git a/packages/angular/docs/library-examples.md b/packages/angular/docs/library-examples.md index 20cf465cfb4b9..4dc7eb33e6930 100644 --- a/packages/angular/docs/library-examples.md +++ b/packages/angular/docs/library-examples.md @@ -35,7 +35,7 @@ nx g @nx/angular:library my-lib --buildable Creates the `my-lib` library in the `nested` directory and sets the import path to `@myorg/nested/my-lib`: {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=nested`. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=nested`. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```bash diff --git a/packages/js/docs/library-examples.md b/packages/js/docs/library-examples.md index d6d478b9157cb..6172715ce1130 100644 --- a/packages/js/docs/library-examples.md +++ b/packages/js/docs/library-examples.md @@ -118,7 +118,7 @@ npx nx g lib mylib --publishable Generate a library named `mylib` and put it under a directory named `myapp` (`libs/myapp/mylib`) {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=myapp`. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=myapp`. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell diff --git a/packages/next/docs/application-examples.md b/packages/next/docs/application-examples.md index 0b00b8f99d3e8..5cce451866ad3 100644 --- a/packages/next/docs/application-examples.md +++ b/packages/next/docs/application-examples.md @@ -4,7 +4,7 @@ {% tab label="Create app in a directory" %} {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=nested`. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=nested`. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell diff --git a/packages/next/docs/library-examples.md b/packages/next/docs/library-examples.md index 1aeb15c0022b0..f5a9693b98392 100644 --- a/packages/next/docs/library-examples.md +++ b/packages/next/docs/library-examples.md @@ -13,7 +13,7 @@ nx g lib my-lib The following will create a library at `libs/shared/my-lib`. {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=shared`. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=shared`. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell diff --git a/packages/nuxt/docs/application-examples.md b/packages/nuxt/docs/application-examples.md index a9bae7211001e..8b04c4dd98ae8 100644 --- a/packages/nuxt/docs/application-examples.md +++ b/packages/nuxt/docs/application-examples.md @@ -9,7 +9,7 @@ description: This page contains examples for the @nx/nuxt:app generator. {% tab label="Create app in a directory" %} {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=nested`. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=nested`. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell diff --git a/packages/react/docs/application-examples.md b/packages/react/docs/application-examples.md index b274f1f812a6f..50dd277c7560b 100644 --- a/packages/react/docs/application-examples.md +++ b/packages/react/docs/application-examples.md @@ -28,7 +28,7 @@ When choosing `vite` as the bundler, your unit tests will be set up with `vitest Create an application named `my-app` in the `my-dir` directory and use `scss` for styles: {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=my-dir`. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=my-dir`. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```bash diff --git a/packages/vue/docs/application-examples.md b/packages/vue/docs/application-examples.md index 35b52e9bf4e20..ed975322f3b52 100644 --- a/packages/vue/docs/application-examples.md +++ b/packages/vue/docs/application-examples.md @@ -16,7 +16,7 @@ nx g @nx/vue:app my-app Create an application named `my-app` in the `my-dir` directory and use `scss` for styles: {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=my-dir`. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=my-dir`. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```shell diff --git a/packages/web/docs/application-examples.md b/packages/web/docs/application-examples.md index c76d8945e6465..28be0e4214c8a 100644 --- a/packages/web/docs/application-examples.md +++ b/packages/web/docs/application-examples.md @@ -28,7 +28,7 @@ When choosing `vite` as the bundler, your unit tests will be set up with `vitest Create an application named `my-app` in the `my-dir` directory: {% callout type="note" title="Directory Flag Behavior Changes" %} -The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=my-dir`. See the [workspace layout documentation](/reference/nx-json#workspace-layout) for more details. +The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=my-dir`. See the [workspace layout documentation](/deprecated/workspace-layout) for more details. {% /callout %} ```bash