diff --git a/docs/generated/manifests/menus.json b/docs/generated/manifests/menus.json
index f45cd17d83..a02707e629 100644
--- a/docs/generated/manifests/menus.json
+++ b/docs/generated/manifests/menus.json
@@ -235,6 +235,14 @@
"children": [],
"disableCollapsible": false
},
+ {
+ "name": "Maintain TypeScript Monorepos",
+ "path": "/features/maintain-ts-monorepos",
+ "id": "maintain-ts-monorepos",
+ "isExternal": false,
+ "children": [],
+ "disableCollapsible": false
+ },
{
"name": "Automate Updating Dependencies",
"path": "/features/automate-updating-dependencies",
@@ -359,6 +367,14 @@
"children": [],
"disableCollapsible": false
},
+ {
+ "name": "Maintain TypeScript Monorepos",
+ "path": "/features/maintain-ts-monorepos",
+ "id": "maintain-ts-monorepos",
+ "isExternal": false,
+ "children": [],
+ "disableCollapsible": false
+ },
{
"name": "Automate Updating Dependencies",
"path": "/features/automate-updating-dependencies",
diff --git a/docs/generated/manifests/nx.json b/docs/generated/manifests/nx.json
index 61c3385995..179efb70b5 100644
--- a/docs/generated/manifests/nx.json
+++ b/docs/generated/manifests/nx.json
@@ -317,6 +317,17 @@
"path": "/features/generate-code",
"tags": ["generate-code"]
},
+ {
+ "id": "maintain-ts-monorepos",
+ "name": "Maintain TypeScript Monorepos",
+ "description": "",
+ "mediaImage": "",
+ "file": "shared/features/maintain-typescript-monorepos",
+ "itemList": [],
+ "isExternal": false,
+ "path": "/features/maintain-ts-monorepos",
+ "tags": ["inferred-tasks", "project-linking", "sync"]
+ },
{
"id": "automate-updating-dependencies",
"name": "Automate Updating Dependencies",
@@ -488,6 +499,17 @@
"path": "/features/generate-code",
"tags": ["generate-code"]
},
+ "/features/maintain-ts-monorepos": {
+ "id": "maintain-ts-monorepos",
+ "name": "Maintain TypeScript Monorepos",
+ "description": "",
+ "mediaImage": "",
+ "file": "shared/features/maintain-typescript-monorepos",
+ "itemList": [],
+ "isExternal": false,
+ "path": "/features/maintain-ts-monorepos",
+ "tags": ["inferred-tasks", "project-linking", "sync"]
+ },
"/features/automate-updating-dependencies": {
"id": "automate-updating-dependencies",
"name": "Automate Updating Dependencies",
diff --git a/docs/generated/manifests/tags.json b/docs/generated/manifests/tags.json
index 05d58e74a6..cc48a29667 100644
--- a/docs/generated/manifests/tags.json
+++ b/docs/generated/manifests/tags.json
@@ -382,6 +382,110 @@
"path": "/nx-api/nx/documents/generate"
}
],
+ "inferred-tasks": [
+ {
+ "description": "",
+ "file": "shared/features/maintain-typescript-monorepos",
+ "id": "maintain-ts-monorepos",
+ "name": "Maintain TypeScript Monorepos",
+ "path": "/features/maintain-ts-monorepos"
+ },
+ {
+ "description": "",
+ "file": "shared/concepts/mental-model",
+ "id": "mental-model",
+ "name": "Mental Model",
+ "path": "/concepts/mental-model"
+ },
+ {
+ "description": "",
+ "file": "shared/concepts/nx-plugins",
+ "id": "nx-plugins",
+ "name": "What Are Nx Plugins",
+ "path": "/concepts/nx-plugins"
+ },
+ {
+ "description": "",
+ "file": "shared/concepts/inferred-tasks",
+ "id": "inferred-tasks",
+ "name": "Inferred Tasks",
+ "path": "/concepts/inferred-tasks"
+ },
+ {
+ "description": "",
+ "file": "shared/recipes/running-tasks/convert-to-inferred",
+ "id": "convert-to-inferred",
+ "name": "Migrate to Inferred Tasks (Project Crystal)",
+ "path": "/recipes/running-tasks/convert-to-inferred"
+ },
+ {
+ "description": "",
+ "file": "shared/recipes/plugins/project-graph-plugins",
+ "id": "project-graph-plugins",
+ "name": "Infer Tasks or Projects",
+ "path": "/extending-nx/recipes/project-graph-plugins"
+ }
+ ],
+ "project-linking": [
+ {
+ "description": "",
+ "file": "shared/features/maintain-typescript-monorepos",
+ "id": "maintain-ts-monorepos",
+ "name": "Maintain TypeScript Monorepos",
+ "path": "/features/maintain-ts-monorepos"
+ },
+ {
+ "description": "",
+ "file": "shared/concepts/typescript-project-linking",
+ "id": "typescript-project-linking",
+ "name": "TypeScript Project Linking",
+ "path": "/concepts/typescript-project-linking"
+ },
+ {
+ "description": "",
+ "file": "shared/recipes/tips-n-tricks/switch-to-workspaces-project-references",
+ "id": "switch-to-workspaces-project-references",
+ "name": "Switch to Workspaces and TS Project References",
+ "path": "/recipes/tips-n-tricks/switch-to-workspaces-project-references"
+ }
+ ],
+ "sync": [
+ {
+ "description": "",
+ "file": "shared/features/maintain-typescript-monorepos",
+ "id": "maintain-ts-monorepos",
+ "name": "Maintain TypeScript Monorepos",
+ "path": "/features/maintain-ts-monorepos"
+ },
+ {
+ "description": "",
+ "file": "shared/concepts/sync-generators",
+ "id": "sync-generators",
+ "name": "Sync Generators",
+ "path": "/concepts/sync-generators"
+ },
+ {
+ "description": "",
+ "file": "shared/recipes/generators/create-sync-generator",
+ "id": "create-sync-generator",
+ "name": "Create a Sync Generator",
+ "path": "/extending-nx/recipes/create-sync-generator"
+ },
+ {
+ "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
+ "file": "generated/packages/nx/documents/sync",
+ "id": "sync",
+ "name": "sync",
+ "path": "/nx-api/nx/documents/sync"
+ },
+ {
+ "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
+ "file": "generated/packages/nx/documents/sync-check",
+ "id": "sync-check",
+ "name": "sync:check",
+ "path": "/nx-api/nx/documents/sync-check"
+ }
+ ],
"automate-updating-dependencies": [
{
"description": "Learn how Nx provides automated update scripts to help you keep your workspace, tooling and framework dependencies up to date.",
@@ -621,43 +725,6 @@
"path": "/concepts/mental-model"
}
],
- "inferred-tasks": [
- {
- "description": "",
- "file": "shared/concepts/mental-model",
- "id": "mental-model",
- "name": "Mental Model",
- "path": "/concepts/mental-model"
- },
- {
- "description": "",
- "file": "shared/concepts/nx-plugins",
- "id": "nx-plugins",
- "name": "What Are Nx Plugins",
- "path": "/concepts/nx-plugins"
- },
- {
- "description": "",
- "file": "shared/concepts/inferred-tasks",
- "id": "inferred-tasks",
- "name": "Inferred Tasks",
- "path": "/concepts/inferred-tasks"
- },
- {
- "description": "",
- "file": "shared/recipes/running-tasks/convert-to-inferred",
- "id": "convert-to-inferred",
- "name": "Migrate to Inferred Tasks (Project Crystal)",
- "path": "/recipes/running-tasks/convert-to-inferred"
- },
- {
- "description": "",
- "file": "shared/recipes/plugins/project-graph-plugins",
- "id": "project-graph-plugins",
- "name": "Infer Tasks or Projects",
- "path": "/extending-nx/recipes/project-graph-plugins"
- }
- ],
"add": [
{
"description": "",
@@ -748,52 +815,6 @@
"path": "/nx-api/nx/documents/daemon"
}
],
- "sync": [
- {
- "description": "",
- "file": "shared/concepts/sync-generators",
- "id": "sync-generators",
- "name": "Sync Generators",
- "path": "/concepts/sync-generators"
- },
- {
- "description": "",
- "file": "shared/recipes/generators/create-sync-generator",
- "id": "create-sync-generator",
- "name": "Create a Sync Generator",
- "path": "/extending-nx/recipes/create-sync-generator"
- },
- {
- "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
- "file": "generated/packages/nx/documents/sync",
- "id": "sync",
- "name": "sync",
- "path": "/nx-api/nx/documents/sync"
- },
- {
- "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
- "file": "generated/packages/nx/documents/sync-check",
- "id": "sync-check",
- "name": "sync:check",
- "path": "/nx-api/nx/documents/sync-check"
- }
- ],
- "project-linking": [
- {
- "description": "",
- "file": "shared/concepts/typescript-project-linking",
- "id": "typescript-project-linking",
- "name": "TypeScript Project Linking",
- "path": "/concepts/typescript-project-linking"
- },
- {
- "description": "",
- "file": "shared/recipes/tips-n-tricks/switch-to-workspaces-project-references",
- "id": "switch-to-workspaces-project-references",
- "name": "Switch to Workspaces and TS Project References",
- "path": "/recipes/tips-n-tricks/switch-to-workspaces-project-references"
- }
- ],
"module-federation": [
{
"description": "",
diff --git a/docs/map.json b/docs/map.json
index 794c1b4b81..fae4d21276 100644
--- a/docs/map.json
+++ b/docs/map.json
@@ -101,6 +101,12 @@
"tags": ["generate-code"],
"file": "shared/features/generate-code"
},
+ {
+ "name": "Maintain TypeScript Monorepos",
+ "id": "maintain-ts-monorepos",
+ "tags": ["inferred-tasks", "project-linking", "sync"],
+ "file": "shared/features/maintain-typescript-monorepos"
+ },
{
"name": "Automate Updating Dependencies",
"description": "Learn how Nx provides automated update scripts to help you keep your workspace, tooling and framework dependencies up to date.",
diff --git a/docs/shared/features/maintain-typescript-monorepos.md b/docs/shared/features/maintain-typescript-monorepos.md
new file mode 100644
index 0000000000..9b7f8c3c9f
--- /dev/null
+++ b/docs/shared/features/maintain-typescript-monorepos.md
@@ -0,0 +1,284 @@
+# Maintain TypeScript Monorepos
+
+Keeping all the industry-standard tools involved in a large TypeScript monorepo correctly configured and working well together is a difficult task. And the more tools you add, the more opportunity there is for tools to conflict with each other in some way.
+
+In addition to [generating default configuration files](/features/generate-code) and [automatically updating dependencies](/features/automate-updating-dependencies) to versions that we know work together, Nx makes managing all the tools in your monorepo easier in two ways:
+
+- Rather than adding another tool that you have to configure, Nx configures itself to match the existing configuration of other tools.
+- Nx also enhances certain tools to be more usable in a monorepo context.
+
+## Auto-Configuration
+
+Whenever possible, Nx will detect the existing configuration settings of other tools and update itself to match.
+
+### Project Detection with Workspaces
+
+If your repository is using package manager workspaces, Nx will use those settings to find all the [projects](/reference/project-configuration) in your repository. So you don't need to define a project for your package manager and separately identify the project for Nx. The `workspaces` configuration on the left allows Nx to detect the project graph on the right.
+
+{% side-by-side align="top" %}
+
+```json {% fileName="/package.json" %}
+{
+ "workspaces": ["apps/*", "packages/*"]
+}
+```
+
+{% graph height="200px" title="Project View" %}
+
+```json
+{
+ "composite": false,
+ "projects": [
+ {
+ "name": "product-state",
+ "type": "lib",
+ "data": {
+ "root": "packages/cart/product-state",
+ "tags": ["scope:cart", "type:state"]
+ }
+ },
+ {
+ "name": "ui-buttons",
+ "type": "lib",
+ "data": {
+ "root": "packages/ui/buttons",
+ "tags": ["scope:shared", "type:ui"]
+ }
+ },
+ {
+ "name": "cart",
+ "type": "app",
+ "data": {
+ "root": "apps/cart",
+ "tags": ["type:app", "scope:cart"]
+ }
+ }
+ ],
+ "dependencies": {
+ "product-state": [],
+ "ui-buttons": [],
+ "cart": [
+ { "source": "cart", "target": "product-state", "type": "static" },
+ { "source": "cart", "target": "ui-buttons", "type": "static" }
+ ]
+ },
+ "workspaceLayout": {
+ "appsDir": "apps",
+ "libsDir": "libs"
+ },
+ "affectedProjectIds": [],
+ "focus": null,
+ "groupByFolder": false,
+ "exclude": [],
+ "enableTooltips": false
+}
+```
+
+{% /graph %}
+
+{% /side-by-side %}
+
+### Inferred Tasks with Tooling Plugins
+
+Nx provides [plugins](/concepts/nx-plugins) for tools that run tasks, like Vite, TypeScript, Playwright or Jest. These plugins can automatically [infer the Nx-specific task configuration](/concepts/inferred-tasks) based on the tooling configuration files that already exist.
+
+In the example below, because the `/apps/cart/vite.config.ts` file exists, Nx knows that the `cart` project can run a `build` task using Vite. If you expand the `build` task on the right, you can also see that Nx configured the output directory for the [cache](/features/cache-task-results) to match the `build.outDir` provided in the Vite configuration file.
+
+With inferred tasks, you can keep your tooling configuration file as the one source of truth for that tool's configuration, instead of adding an extra layer of configuration on top.
+
+{% side-by-side align="top" %}
+
+```ts {% fileName="/apps/cart/vite.config.ts" %}
+///
No JSON provided for graph, use JSON code fence to embed data for the graph. @@ -82,7 +82,7 @@ export function Graph({ setParsedProps(JSON.parse(children?.props.children as any)); } catch { return ( -
Could not parse JSON for graph:
{children?.props.children as any}