Skip to content

Commit 42b5343

Browse files
barbados-clemensnx-cloud[bot]claudegraphite-app[bot]
authored
docs(nx-dev): tech intro page structure improvements (#34450)
Work on making a tech intro pages more consistent with each other and focus on "answering the 80%" for the given technology. Focusing on - Angular - Maven/Gradle - react - TS - Vite - Vitest/Jest The changes are based around answering the following, where each "category" of page might have a different set of depth for the answer. 1. Why do I want to use this plugin? - Plugins are considered fully optional and are aimed at providing better DX for a technology, such as inferred setup, generators, migrations. - some plugins (like TSC) might have special call outs in some of this, but generally the same for all plugins. 2. How do I use this plugin in my workspace? - also pretty commonly the "same" for all plugins in terms of "setup" - where they differ is mostly for frameworks, e.g. Angular, React. You're looking at setting up a project to use these tools - For Build/Test tools you're looking at adding to an existing project, or converting from one to another. - Build/Test tools are "means to an end", so should callout if the goal is tool + framework in a "new" context point to the framework based plugin page. Otherwise, show adding to an existing project like React project. 3. What do I need to know about using this plugin? - understanding finer details of a plugin options, e.g. buildable & publishable - extra generators for the plugin. e.g. "convert-to-swc" - generally I like the idea of having a "CI considerations" where we talk about CI setups that can help, e.g. options or batch mode etc. closes DOC-407 --------- Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com> Co-authored-by: barbados-clemens <barbados-clemens@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
1 parent 7528cc5 commit 42b5343

File tree

10 files changed

+1276
-1550
lines changed

10 files changed

+1276
-1550
lines changed
Lines changed: 91 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,142 @@
11
---
2-
title: Overview of the Nx Angular Plugin
3-
description: The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace.
2+
title: Angular Plugin for Nx
3+
description: Use @nx/angular to create, run, and maintain Angular applications and libraries in an Nx workspace.
44
keywords: [angular]
55
sidebar:
66
label: Introduction
77
order: 1
88
filter: 'type:References'
99
---
1010

11-
The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries
12-
within an Nx workspace. It also enables using Angular Devkit builders and schematics in Nx workspaces.
13-
14-
Among other things, it provides:
15-
16-
- Integration with libraries such as:
17-
- Cypress
18-
- ESLint
19-
- Jest
20-
- Playwright
21-
- Storybook
22-
- Generators to help scaffold code quickly, including:
23-
- Micro Frontends
24-
- Libraries, both internal to your codebase and publishable to npm
25-
- Projects with Tailwind CSS
26-
- Executors providing extra capabilities on top of the Angular Devkit builders:
27-
- Provide ESBuild plugins
28-
- Provide custom webpack configurations
29-
- Utilities for automatic workspace refactoring
30-
31-
{% aside type="note" title="Currently using the Angular CLI?" %}
32-
You can easily and mostly **automatically migrate from an Angular CLI** project to Nx! Learn
33-
more [here](/docs/technologies/angular/migration/angular).
34-
{% /aside %}
11+
[Angular](https://angular.dev) is a framework for building web applications. Nx has first party support for Angular projects. If you're familiar with the Angular CLI, `ng`, then Nx CLI will feel very familiar.
12+
The `@nx/angular` plugin adds [generators](#local-development), Angular CLI builder integration (executors) and migrations so you can run Angular tasks through Nx. With Nx, each project has its own configuration instead of a single `angular.json` file, making it more scalable for monorepos.
13+
You can use Angular with Nx without the plugin and still get [task caching](/docs/features/cache-task-results), [task orchestration](/docs/features/run-tasks), and the [project graph](/docs/features/explore-graph).
3514

36-
## Setting Up @nx/angular
15+
See the [Nx and Angular versions matrix](/docs/technologies/angular/guides/angular-nx-version-matrix) to know which Nx version supports a given Angular version.
3716

38-
### Installation
17+
## Setup
3918

40-
{% aside type="note" title="Keep Nx Package Versions In Sync" %}
41-
Make sure to install the `@nx/angular` version that matches the version of `nx` in your repository. If the version numbers get out of sync, you can encounter some difficult to debug errors. You can [fix Nx version mismatches with this recipe](/docs/guides/tips-n-tricks/keep-nx-versions-in-sync).
42-
{% /aside %}
19+
### Add to an existing workspace
4320

44-
In any Nx workspace, you can install `@nx/angular` by running the following command:
21+
{% aside type="note" title="Keep Nx package versions in sync" %}
22+
Install the `@nx/angular` version that matches your `nx` version to avoid hard-to-debug errors. See [Keep Nx versions in sync](/docs/guides/tips-n-tricks/keep-nx-versions-in-sync).
23+
Using `nx add` helps ensure the correct version is installed and configured.
24+
{% /aside %}
4525

4626
```shell
4727
nx add @nx/angular
4828
```
4929

50-
This will install the correct version of `@nx/angular`.
30+
Verify the plugin is active by inspecting an Angular project:
31+
32+
```shell
33+
nx show project <your-app-name>
34+
```
35+
36+
Look for `build`, `serve`, `test`, `lint`, or `e2e` targets generated from `angular.json`.
37+
38+
### Create a new workspace
5139

52-
{% aside type="note" title="Angular Tutorial" %}
53-
For a full tutorial experience, follow the [Angular Monorepo Tutorial](/docs/getting-started/tutorials/angular-monorepo-tutorial)
40+
```shell
41+
npx create-nx-workspace my-org --template=nrwl/angular-template
42+
```
43+
44+
{% aside type="tip" title="Angular Tutorial" %}
45+
For a guided walkthrough, follow the [Angular Monorepo Tutorial](/docs/getting-started/tutorials/angular-monorepo-tutorial).
5446
{% /aside %}
5547

56-
## Using the Angular Plugin
48+
## Local Development
49+
50+
### Generate an Angular Application
51+
52+
```shell
53+
nx g @nx/angular:app apps/my-app
54+
```
55+
56+
By default, Nx configures ESLint for linting, Jest for unit tests, and Cypress for e2e tests. Read more of the options available for the application generator in the [Angular application generators reference](/docs/technologies/angular/generators#application).
5757

58-
### Generating an angular application
58+
```shell
59+
nx serve my-app
60+
nx build my-app
61+
nx test my-app
62+
nx lint my-app
63+
nx e2e my-app
64+
```
5965

60-
It's straightforward to generate an Angular application:
66+
### Generate an Angular Library
6167

6268
```shell
63-
nx g @nx/angular:app apps/appName
69+
nx g @nx/angular:lib libs/my-lib
6470
```
6571

66-
By default, the application will be generated with:
72+
By default, Nx configures ESLint for linting, Jest for unit tests. Read more of the options available for the application generator in the [angular library generators reference](/docs/technologies/angular/generators#library).
6773

68-
- ESLint as the linter.
69-
- Jest as the unit test runner.
70-
- Cypress as the E2E test runner.
74+
There are also generators for setting up common items inside your projects, such as components and services:
7175

72-
We can then serve, build, test, lint, and run e2e tests on the application with the following commands:
76+
```shell
77+
nx g @nx/angular:component libs/my-lib/src/lib/my-component
78+
nx g @nx/angular:service libs/my-lib/src/lib/my-service
79+
```
7380

7481
```shell
75-
nx serve appName
76-
nx build appName
77-
nx test appName
78-
nx lint appName
79-
nx e2e appName
82+
nx test my-lib
83+
nx lint my-lib
8084
```
8185

82-
### Generating an angular library
86+
### Buildable and Publishable Libraries
8387

84-
Generating an Angular library is very similar to generating an application:
88+
If you need libraries that build or publish, generate them with build output enabled and an import path. This creates build targets you can cache and run in CI.
89+
See [Set up incremental builds for Angular libraries](/docs/technologies/angular/guides/setup-incremental-builds-angular) for details.
8590

8691
```shell
87-
nx g @nx/angular:lib libs/libName
92+
nx g @nx/angular:lib libs/my-lib
8893
```
8994

90-
By default, the library will be generated with:
95+
### Set Up Module Federation
96+
97+
Nx includes generators for scaffolding [Module Federation](/docs/technologies/module-federation/concepts/module-federation-and-nx) architectures with Angular. Generate a host application and its remotes in one command:
9198

92-
- ESLint as the linter.
93-
- Jest as the unit test runner.
99+
```shell
100+
nx g @nx/angular:host apps/shell --remotes=products,checkout
101+
```
94102

95-
We can then test and lint the library with the following commands:
103+
> See all options in the [Angular host generators reference](/docs/technologies/angular/generators#host).
104+
105+
Add a remote to an existing host:
96106

97107
```shell
98-
nx test libName
99-
nx lint libName
108+
nx g @nx/angular:remote apps/login --host=shell
100109
```
101110

102-
Read more about:
111+
> See all options in the [Angular remote generators reference](/docs/technologies/angular/generators#remote).
103112

104-
- [Creating Libraries](/docs/concepts/decisions/project-size)
105-
- [Library Types](/docs/concepts/decisions/project-dependency-rules)
106-
- [Buildable and Publishable Libraries](/docs/concepts/buildable-and-publishable-libraries)
113+
Pass `--dynamic` for [dynamic federation](/docs/technologies/angular/guides/dynamic-module-federation-with-angular) (remotes resolved at runtime) or `--ssr` for [server-side rendering with Module Federation](/docs/technologies/angular/guides/module-federation-with-ssr).
107114

108-
### Fallback to `@schematics/angular`
115+
## CI Considerations
109116

110-
If you try to invoke a generator that is not present in `@nx/angular`, the request will automatically be forwarded on
111-
to `@schematics/angular`. So, even though there is no `@nx/angular:service` generator, the following command will
112-
successfully create a service:
117+
Run only what changed using the project graph:
113118

114119
```shell
115-
nx g @nx/angular:service apps/appName/src/lib/my-service/my-service
120+
nx affected -t build test lint e2e
116121
```
117122

118-
## More Documentation
123+
Enable remote caching for faster CI runs:
124+
125+
```shell
126+
nx connect
127+
```
128+
129+
If you use Angular CLI configurations, define a `ci` configuration in `angular.json` and run tasks with `--configuration=ci` for CI-specific settings.
130+
131+
See [Set Up CI](/docs/guides/nx-cloud/setup-ci) for a sample CI setup.
132+
133+
## What's Next
119134

120-
- [Angular Monorepo Tutorial](/docs/getting-started/tutorials/angular-monorepo-tutorial)
121-
- [Migrating from the Angular CLI](/docs/technologies/angular/migration/angular)
122-
- [Setup Module Federation with Angular and Nx](/docs/technologies/module-federation/concepts/faster-builds-with-module-federation)
123-
- [Using Tailwind CSS with Angular projects](/docs/technologies/angular/guides/using-tailwind-css-with-angular-projects)
135+
{% cardgrid %}
136+
{% linkcard title="Angular Monorepo Tutorial" description="Build an Angular monorepo step-by-step with Nx." href="/docs/getting-started/tutorials/angular-monorepo-tutorial" /%}
137+
{% linkcard title="Migrate from Angular CLI" description="Move an existing Angular CLI project into Nx." href="/docs/technologies/angular/migration/angular" /%}
138+
{% linkcard title="Dynamic Module Federation" description="Load Angular remotes at runtime with dynamic federation." href="/docs/technologies/angular/guides/dynamic-module-federation-with-angular" /%}
139+
{% linkcard title="Tailwind CSS with Angular" description="Add Tailwind CSS to Angular apps and libraries." href="/docs/technologies/angular/guides/using-tailwind-css-with-angular-projects" /%}
140+
{% linkcard title="Angular Generators Reference" description="All @nx/angular generators." href="/docs/technologies/angular/generators" /%}
141+
{% linkcard title="Angular Executors Reference" description="All @nx/angular executors." href="/docs/technologies/angular/executors" /%}
142+
{% /cardgrid %}

0 commit comments

Comments
 (0)