Skip to content

Commit

Permalink
feat(angular): add support for angular v19 (#28847)
Browse files Browse the repository at this point in the history
## Third-party deps support for Angular v19

- [x] `jest-preset-angular`
  - [x] PRs:
    - [x] thymikee/jest-preset-angular#2835
  - [x] Released:
- [x] RC:
https://github.com/thymikee/jest-preset-angular/releases/tag/v14.4.0-rc.0
- [x] Stable:
https://github.com/thymikee/jest-preset-angular/releases/tag/v14.4.0
- [x] Angular ESLint
  - [x] PRs:
    - [x] angular-eslint/angular-eslint#2109
  - [x] Released:
- [x]
https://github.com/angular-eslint/angular-eslint/releases/tag/v19.0.0
- [x] Storybook
  - [x] PRs:
    - [x] storybookjs/storybook#29659
    - [x] storybookjs/storybook#29677
  - [x] Released:
    - [x] storybookjs/storybook#29679
- [ ] NgRx
  - [x] PRs:
    - [x] ngrx/platform#4602
  - [ ] Released:
- [x] Beta:
https://github.com/ngrx/platform/blob/main/CHANGELOG.md#1900-beta0-2024-11-20
    - [ ] Stable:
- [ ] Analog
  - [x] PRs:
    - [x] analogjs/analog#1447
    - [x] analogjs/analog#1451
  - [ ] Released:
- [x] Beta:
https://github.com/analogjs/analog/releases/tag/v1.10.0-beta.6
    - [ ] Stable:

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

Angular v19 is not supported.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Angular v19 should be supported.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->
 
Fixes #29028
  • Loading branch information
leosvelperez authored Dec 2, 2024
1 parent 06d549b commit 3ec5390
Show file tree
Hide file tree
Showing 230 changed files with 6,710 additions and 6,099 deletions.
4 changes: 2 additions & 2 deletions docs/generated/manifests/nx-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"type": "executor"
},
"/nx-api/angular/executors/application": {
"description": "Builds an Angular application using [esbuild](https://esbuild.github.io/) with integrated SSR and prerendering capabilities. _Note: this is only supported in Angular versions >= 17.0.0_.",
"description": "Builds an Angular application using [esbuild](https://esbuild.github.io/) with integrated SSR and prerendering capabilities.",
"file": "generated/packages/angular/executors/application.json",
"hidden": false,
"name": "application",
Expand Down Expand Up @@ -200,7 +200,7 @@
"type": "generator"
},
"/nx-api/angular/generators/convert-to-application-executor": {
"description": "Converts projects to use the `@nx/angular:application` executor or the `@angular-devkit/build-angular:application` builder. _Note: this is only supported in Angular versions >= 17.0.0_.",
"description": "Converts projects to use the `@nx/angular:application` executor or the `@angular-devkit/build-angular:application` builder.",
"file": "generated/packages/angular/generators/convert-to-application-executor.json",
"hidden": false,
"name": "convert-to-application-executor",
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/packages-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"type": "executor"
},
{
"description": "Builds an Angular application using [esbuild](https://esbuild.github.io/) with integrated SSR and prerendering capabilities. _Note: this is only supported in Angular versions >= 17.0.0_.",
"description": "Builds an Angular application using [esbuild](https://esbuild.github.io/) with integrated SSR and prerendering capabilities.",
"file": "generated/packages/angular/executors/application.json",
"hidden": false,
"name": "application",
Expand Down Expand Up @@ -195,7 +195,7 @@
"type": "generator"
},
{
"description": "Converts projects to use the `@nx/angular:application` executor or the `@angular-devkit/build-angular:application` builder. _Note: this is only supported in Angular versions >= 17.0.0_.",
"description": "Converts projects to use the `@nx/angular:application` executor or the `@angular-devkit/build-angular:application` builder.",
"file": "generated/packages/angular/generators/convert-to-application-executor.json",
"hidden": false,
"name": "convert-to-application-executor",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ We provide a recommended version, and it is usually the latest minor version of

| Angular Version | **Nx Version _(recommended)_** | Nx Version _(range)_ |
| --------------- | ------------------------------ | ---------------------------------------- |
| ~19.0.0 | **latest** | >=20.2.0 <=latest |
| ~18.2.0 | **latest** | >=19.6.0 <=latest |
| ~18.1.0 | **latest** | >=19.5.0 <=latest |
| ~18.0.0 | **latest** | >=19.1.0 <=latest |
| ~17.3.0 | **latest** | >=18.2.0 <=latest |
| ~17.2.0 | **latest** | >=18.1.1 <=latest |
| ~17.1.0 | **latest** | >=17.3.0 <=latest |
| ~17.0.0 | **latest** | >=17.1.0 <=latest |
| ~16.2.0 | **latest** | >=16.7.0 <=latest |
| ~16.1.0 | **latest** | >=16.4.0 <=latest |
| ~16.0.0 | **latest** | >=16.1.0 <=latest |
| ~16.2.0 | **~20.1.0** | >=16.7.0 <20.2.0 |
| ~16.1.0 | **~20.1.0** | >=16.4.0 <20.2.0 |
| ~16.0.0 | **~20.1.0** | >=16.1.0 <20.2.0 |
| ~15.2.0 | **~19.0.0** | >=15.8.0 <19.1.0 |
| ~15.1.0 | **~19.0.0** | >=15.5.0 <19.1.0 |
| ~15.0.0 | **~19.0.0** | >=15.2.0 <=15.4.8 \|\| >=15.7.0 <19.1.0 |
Expand Down
78 changes: 71 additions & 7 deletions docs/generated/packages/angular/executors/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"schema": {
"$schema": "http://json-schema.org/draft-07/schema",
"title": "Schema for Nx Application Executor",
"description": "Builds an Angular application using [esbuild](https://esbuild.github.io/) with integrated SSR and prerendering capabilities. _Note: this is only supported in Angular versions >= 17.0.0_.",
"description": "Builds an Angular application using [esbuild](https://esbuild.github.io/) with integrated SSR and prerendering capabilities.",
"examplesFile": "This executor is a drop-in replacement for the `@angular-devkit/build-angular:application` builder provided by the Angular CLI. It builds an Angular application using [esbuild](https://esbuild.github.io/) with integrated SSR and prerendering capabilities.\n\nIn addition to the features provided by the Angular CLI builder, the `@nx/angular:application` executor also supports the following:\n\n- Providing esbuild plugins\n- Providing a function to transform the application's `index.html` file\n- Incremental builds\n\n{% callout type=\"check\" title=\"Dev Server\" %}\nThe [`@nx/angular:dev-server` executor](/nx-api/angular/executors/dev-server) is required to serve your application when using the `@nx/angular:application` to build it. It is a drop-in replacement for the Angular CLI's `@angular-devkit/build-angular:dev-server` builder and ensures the application is correctly served with Vite when using the `@nx/angular:application` executor.\n{% /callout %}\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Providing esbuild plugins\" %}\n\nThe executor accepts a `plugins` option that allows you to provide esbuild plugins that will be used when building your application. It allows providing a path to a plugin file or an object with a `path` and `options` property to provide options to the plugin.\n\n```json {% fileName=\"apps/my-app/project.json\" highlightLines=[\"8-16\"] %}\n{\n ...\n \"targets\": {\n \"build\": {\n \"executor\": \"@nx/angular:application\",\n \"options\": {\n ...\n \"plugins\": [\n \"apps/my-app/plugins/plugin1.js\",\n {\n \"path\": \"apps/my-app/plugins/plugin2.js\",\n \"options\": {\n \"someOption\": \"some value\"\n }\n }\n ]\n }\n }\n ...\n }\n}\n```\n\n```ts {% fileName=\"apps/my-app/plugins/plugin1.js\" %}\nconst plugin1 = {\n name: 'plugin1',\n setup(build) {\n const options = build.initialOptions;\n options.define.PLUGIN1_TEXT = '\"Value was provided at build time\"';\n },\n};\n\nmodule.exports = plugin1;\n```\n\n```ts {% fileName=\"apps/my-app/plugins/plugin2.js\" %}\nfunction plugin2({ someOption }) {\n return {\n name: 'plugin2',\n setup(build) {\n const options = build.initialOptions;\n options.define.PLUGIN2_TEXT = JSON.stringify(someOption);\n },\n };\n}\n\nmodule.exports = plugin2;\n```\n\nAdditionally, we need to inform TypeScript of the defined variables to prevent type-checking errors during the build. We can achieve this by creating or updating a type definition file included in the TypeScript build process (e.g. `src/types.d.ts`) with the following content:\n\n```ts {% fileName=\"apps/my-app/src/types.d.ts\" %}\ndeclare const PLUGIN1_TEXT: number;\ndeclare const PLUGIN2_TEXT: string;\n```\n\n{% /tab %}\n\n{% tab label=\"Transforming the 'index.html' file\" %}\n\nThe executor accepts an `indexHtmlTransformer` option to provide a path to a file with a default export for a function that receives the application's `index.html` file contents and outputs the updated contents.\n\n```json {% fileName=\"apps/my-app/project.json\" highlightLines=[8] %}\n{\n ...\n \"targets\": {\n \"build\": {\n \"executor\": \"@nx/angular:application\",\n \"options\": {\n ...\n \"indexHtmlTransformer\": \"apps/my-app/index-html.transformer.ts\"\n }\n }\n ...\n }\n}\n```\n\n```ts {% fileName=\"apps/my-app/index-html.transformer.ts\" %}\nexport default function (indexContent: string) {\n return indexContent.replace(\n '<title>my-app</title>',\n '<title>my-app (transformed)</title>'\n );\n}\n```\n\n{% /tab %}\n{% /tabs %}\n",
"outputCapture": "direct-nodejs",
"type": "object",
Expand Down Expand Up @@ -55,7 +55,18 @@
},
"server": {
"type": "string",
"description": "The full path for the server entry point to the application, relative to the current workspace."
"description": "The full path for the server entry point to the application, relative to the current workspace.",
"oneOf": [
{
"type": "string",
"description": "The full path for the server entry point to the application, relative to the current workspace."
},
{
"const": false,
"type": "boolean",
"description": "Indicates that a server entry point is not provided. _Note: this is only supported in Angular versions >= 19.0.0_."
}
]
},
"polyfills": {
"description": "A list of polyfills to include in the build. Can be a full path for a file, relative to the current workspace or module specifier. Example: 'zone.js'.",
Expand All @@ -71,6 +82,29 @@
"type": "string",
"description": "Customize the base path for the URLs of resources in 'index.html' and component stylesheets. This option is only necessary for specific deployment scenarios, such as with Angular Elements or when utilizing different CDN locations. _Note: this is only supported in Angular versions >= 17.3.0_."
},
"security": {
"description": "Security features to protect against XSS and other common attacks. _Note: this is only supported in Angular versions >= 19.0.0_.",
"type": "object",
"additionalProperties": false,
"properties": {
"autoCsp": {
"description": "Enables automatic generation of a hash-based Strict Content Security Policy (https://web.dev/articles/strict-csp#choose-hash) based on scripts in index.html. Will default to true once we are out of experimental/preview phases. It defaults to `false`.",
"oneOf": [
{
"type": "object",
"properties": {
"unsafeEval": {
"type": "boolean",
"description": "Include the `unsafe-eval` directive (https://web.dev/articles/strict-csp#remove-eval) in the auto-CSP. Please only enable this if you are absolutely sure that you need to, as allowing calls to eval will weaken the XSS defenses provided by the auto-CSP. It default to `false`."
}
},
"additionalProperties": false
},
{ "type": "boolean" }
]
}
}
},
"scripts": {
"description": "Global scripts to be included in the build.",
"type": "array",
Expand Down Expand Up @@ -157,6 +191,28 @@
"type": "array",
"items": { "type": "string" },
"default": []
},
"sass": {
"description": "Options to pass to the sass preprocessor. _Note: this is only supported in Angular versions >= 19.0.0_.",
"type": "object",
"properties": {
"fatalDeprecations": {
"description": "A set of deprecations to treat as fatal. If a deprecation warning of any provided type is encountered during compilation, the compiler will error instead. If a Version is provided, then all deprecations that were active in that compiler version will be treated as fatal.",
"type": "array",
"items": { "type": "string" }
},
"silenceDeprecations": {
"description": " A set of active deprecations to ignore. If a deprecation warning of any provided type is encountered during compilation, the compiler will ignore it instead.",
"type": "array",
"items": { "type": "string" }
},
"futureDeprecations": {
"description": "A set of future deprecations to opt into early. Future deprecations passed here will be treated as active by the compiler, emitting warnings as necessary.",
"type": "array",
"items": { "type": "string" }
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand Down Expand Up @@ -546,8 +602,7 @@
"default": []
},
"prerender": {
"description": "Prerender (SSG) pages of your application during build time.",
"default": false,
"description": "Prerender (SSG) pages of your application during build time. It defaults to `false` in Angular versions < 19.0.0. Otherwise, the value will be `undefined`.",
"oneOf": [
{
"type": "boolean",
Expand Down Expand Up @@ -584,6 +639,11 @@
"entry": {
"type": "string",
"description": "The server entry-point that when executed will spawn the web server."
},
"experimentalPlatform": {
"description": "Specifies the platform for which the server bundle is generated. This affects the APIs and modules available in the server-side code. \n\n- `node`: (Default) Generates a bundle optimized for Node.js environments. \n- `neutral`: Generates a platform-neutral bundle suitable for environments like edge workers, and other serverless platforms. This option avoids using Node.js-specific APIs, making the bundle more portable. \n\nPlease note that this feature does not provide polyfills for Node.js modules. Additionally, it is experimental, and the feature may undergo changes in future versions. _Note: this is only supported in Angular versions >= 19.0.0_.",
"default": "node",
"enum": ["node", "neutral"]
}
},
"additionalProperties": false
Expand All @@ -592,8 +652,12 @@
},
"appShell": {
"type": "boolean",
"description": "Generates an application shell during build time.",
"default": false
"description": "Generates an application shell during build time. It defaults to `false` in Angular versions < 19.0.0. Otherwise, the value will be `undefined`."
},
"outputMode": {
"type": "string",
"description": "Defines the build output target. 'static': Generates a static site for deployment on any static hosting service. 'server': Produces an application designed for deployment on a server that supports server-side rendering (SSR). _Note: this is only supported in Angular versions >= 19.0.0_.",
"enum": ["static", "server"]
},
"buildLibsFromSource": {
"type": "boolean",
Expand Down Expand Up @@ -739,7 +803,7 @@
},
"presets": []
},
"description": "Builds an Angular application using [esbuild](https://esbuild.github.io/) with integrated SSR and prerendering capabilities. _Note: this is only supported in Angular versions >= 17.0.0_.",
"description": "Builds an Angular application using [esbuild](https://esbuild.github.io/) with integrated SSR and prerendering capabilities.",
"aliases": [],
"hidden": false,
"path": "/packages/angular/src/executors/application/schema.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@
"default": true
},
"plugins": {
"description": "A list of ESBuild plugins. _Note: this is only supported in Angular versions >= 17.0.0_.",
"description": "A list of ESBuild plugins.",
"type": "array",
"items": {
"oneOf": [
Expand Down
7 changes: 3 additions & 4 deletions docs/generated/packages/angular/executors/dev-server.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@
},
"hmr": {
"type": "boolean",
"description": "Enable hot module replacement.",
"default": false
"description": "Enable hot module replacement. It defaults to `false` in Angular versions < 19.0.0. Otherwise, the value will be `undefined`."
},
"watch": {
"type": "boolean",
Expand All @@ -107,7 +106,7 @@
},
"forceEsbuild": {
"type": "boolean",
"description": "Force the development server to use the 'browser-esbuild' builder when building. This is a developer preview option for the esbuild-based build system. _Note: this is only supported in Angular versions >= 16.1.0_.",
"description": "Force the development server to use the 'browser-esbuild' builder when building. This is a developer preview option for the esbuild-based build system.",
"default": false
},
"inspect": {
Expand Down Expand Up @@ -145,7 +144,7 @@
"x-priority": "important"
},
"esbuildMiddleware": {
"description": "A list of HTTP request middleware functions. _Note: this is only supported in Angular versions >= 17.0.0_.",
"description": "A list of HTTP request middleware functions.",
"type": "array",
"items": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
"cli": "nx",
"type": "object",
"presets": [
{
"name": "Buildable Library with Tailwind",
"keys": ["project", "tailwindConfig"]
},
{
"name": "Updating Project Dependencies for Buildable Library",
"keys": ["project"]
Expand All @@ -39,10 +35,6 @@
"poll": {
"type": "number",
"description": "Enable and define the file watching poll time period in milliseconds. _Note: this is only supported in Angular versions >= 18.0.0_."
},
"tailwindConfig": {
"type": "string",
"description": "The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured."
}
},
"additionalProperties": false,
Expand Down
13 changes: 0 additions & 13 deletions docs/generated/packages/angular/executors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
"cli": "nx",
"type": "object",
"presets": [
{
"name": "Publishable Library with Tailwind",
"keys": [
"project",
"tailwindConfig"
]
},
{
"name": "Updating Project Dependencies for Publishable Library",
"keys": [
Expand Down Expand Up @@ -44,12 +37,6 @@
"poll": {
"type": "number",
"description": "Enable and define the file watching poll time period in milliseconds. _Note: this is only supported in Angular versions >= 18.0.0_."
},
"tailwindConfig": {
"type": "string",
"description": "The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured. _Note: starting with Angular v17, this option is no longer used and the configuration will be picked up if exists at the project or workspace root_.",
"x-completion-type": "file",
"x-completion-glob": "tailwind.config@(.js|.cjs|.mjs|.ts)"
}
},
"additionalProperties": false,
Expand Down
Loading

0 comments on commit 3ec5390

Please sign in to comment.