Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(angular): add support for angular v19 #28847

Merged
merged 36 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
6e3157c
feat(angular): support angular v19.0.0 (#28953)
leosvelperez Oct 22, 2024
d669e78
fix(angular): apply some required changes
leosvelperez Oct 22, 2024
0773d39
fix(angular): apply some more required changes
leosvelperez Oct 22, 2024
ce92a63
fix(angular): drop usage of removed esm2022 output
leosvelperez Oct 22, 2024
98db4cb
fix(angular): use new stylesheet processor in ng-packagr
leosvelperez Oct 25, 2024
85806fc
feat(angular): drop support for angular v16 (#28848)
leosvelperez Nov 8, 2024
efdc42e
feat(angular): bump zone.js version (#28853)
leosvelperez Nov 8, 2024
6499ac3
feat(misc): add support for typescript 5.6 (#28874)
leosvelperez Nov 11, 2024
d32d467
feat(angular): remove redundant `standalone: true` from templates for…
leosvelperez Nov 11, 2024
a91e366
feat(angular): add migration to explicitly set `@angular/localize/ini…
leosvelperez Nov 11, 2024
b94bf53
feat(angular): add option to export component as default (#28883)
leosvelperez Nov 12, 2024
845261c
feat(angular): update `CommonEngine` imports from `@angular/ssr` to `…
leosvelperez Nov 12, 2024
ffeb263
fix(angular): use default export from component in spec file (#28896)
leosvelperez Nov 12, 2024
0fa2002
feat(angular): integrate `withEventReplay()` in `provideClientHydrati…
leosvelperez Nov 12, 2024
23dcd07
feat(angular): add `outputMode` option to the application executor (#…
leosvelperez Nov 12, 2024
67dcdd1
feat(angular): add validation for component, directive and pipe class…
leosvelperez Nov 12, 2024
86bca60
feat(angular): add `sass` to `stylePreprocessorOptions` in applicatio…
leosvelperez Nov 12, 2024
8f3d5c8
feat(angular): remove default value for `hmr` option in `dev-server` …
leosvelperez Nov 12, 2024
89719a2
feat(angular): update the application executor options (#28903)
leosvelperez Nov 12, 2024
e39f6b2
feat(angular): update generators to support the new server rendering …
leosvelperez Nov 15, 2024
400e9d2
feat(angular): remove unused `tailwindConfig` option from the ng-pack…
leosvelperez Nov 15, 2024
b6735d1
docs(angular): update the nx and angular versions matrix docs (#28955)
leosvelperez Nov 15, 2024
ab58ae1
fix(angular): unset default for `serverRouting` option
leosvelperez Nov 19, 2024
4bdeba6
feat(angular): bump analogjs package versions
leosvelperez Nov 19, 2024
d18a90d
chore(linter): fix lock_file_changed error in e2e
leosvelperez Nov 20, 2024
4174948
chore(linter): fix e2e tests
leosvelperez Nov 20, 2024
08e28b6
feat(angular): update migrations target versions
leosvelperez Nov 25, 2024
4edc46e
feat(angular): update `jest-preset-angular`
leosvelperez Nov 25, 2024
b2067ca
feat(angular): update analog packages
leosvelperez Nov 25, 2024
c0a5d30
feat(storybook): update storybook packages
leosvelperez Nov 25, 2024
a40ab86
feat(angular): update angular eslint packages
leosvelperez Nov 25, 2024
bce9b72
feat(angular): update `jest-preset-angular` to the stable version
leosvelperez Nov 27, 2024
5a64dff
feat(storybook): update storybook packages
leosvelperez Nov 29, 2024
13b0d92
feat(angular): bump angular eslint and analog deps
leosvelperez Dec 2, 2024
ce7df08
feat(angular): update migrations target versions
leosvelperez Dec 2, 2024
782600e
cleanup(angular): fix e2e test case
leosvelperez Dec 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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