diff --git a/docs/generated/packages/angular/migrations/add-localize-polyfill-to-targets.json b/docs/generated/packages/angular/migrations/add-localize-polyfill-to-targets.json index a03b7a9064..5f5cb90b61 100644 --- a/docs/generated/packages/angular/migrations/add-localize-polyfill-to-targets.json +++ b/docs/generated/packages/angular/migrations/add-localize-polyfill-to-targets.json @@ -11,5 +11,5 @@ "path": "/packages/angular", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Add Localize Polyfill to Targets\n\nAdd the '@angular/localize/init' polyfill to the 'polyfills' option of targets using esbuild-based executors.\n\n#### Sample Code Changes\n\nAdd the `@angular/localize/init` polyfill to any of these executors:\n\n- `@angular/build:application`\n- `@angular-devkit/build-angular:application`\n- `@nx/angular:application`\n- `@angular-devkit/build-angular:browser-esbuild`\n- `@nx/angular:browser-esbuild`\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"apps/app1/project.json\" %}\n{\n \"targets\": {\n \"build\": {\n \"executor\": \"@angular/build:application\",\n \"options\": {\n \"localize\": true\n }\n }\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```json {% fileName=\"apps/app1/project.json\" %}\n{\n \"targets\": {\n \"build\": {\n \"executor\": \"@angular/build:application\",\n \"options\": {\n \"localize\": true,\n \"polyfills\": [\"@angular/localize/init\"]\n }\n }\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/angular/migrations/disable-angular-eslint-prefer-standalone.json b/docs/generated/packages/angular/migrations/disable-angular-eslint-prefer-standalone.json index efd969b46e..db9d643a0d 100644 --- a/docs/generated/packages/angular/migrations/disable-angular-eslint-prefer-standalone.json +++ b/docs/generated/packages/angular/migrations/disable-angular-eslint-prefer-standalone.json @@ -11,5 +11,5 @@ "path": "/packages/angular", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Disable Angular ESLint Prefer Standalone\n\nDisable the Angular ESLint prefer-standalone rule if not set.\n\n#### Sample Code Changes\n\nUpdate import paths for `withModuleFederation` and `withModuleFederationForSSR`.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"apps/app1/.eslintrc.json\" %}\n{\n \"overrides\": [\n {\n \"files\": [\"*.html\"],\n \"rules\": {\n \"some-rule-for-html\": \"error\"\n }\n }\n ]\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```json {% fileName=\"apps/app1/.eslintrc.json\" %}\n{\n \"overrides\": [\n {\n \"files\": [\"*.html\"],\n \"rules\": {\n \"some-rule-for-html\": \"error\"\n }\n },\n {\n \"files\": [\"*.ts\"],\n \"rules\": {\n \"@angular-eslint/prefer-standalone\": \"off\"\n }\n }\n ]\n}\n```\n\n{% /tab %}\n{% /tabs %}\n\nimport {\naddProjectConfiguration,\nwriteJson,\ntype ProjectConfiguration,\ntype ProjectGraph,\ntype Tree,\n} from '@nx/devkit';\nimport { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';\nimport migration from './disable-angular-eslint-prefer-standalone';\n\nlet projectGraph: ProjectGraph;\njest.mock('@nx/devkit', () => ({\n...jest.requireActual('@nx/devkit'),\ncreateProjectGraphAsync: () => Promise.resolve(projectGraph),\n}));\n\ndescribe('disable-angular-eslint-prefer-standalone', () => {\nlet tree: Tree;\n\nbeforeEach(() => {\ntree = createTreeWithEmptyWorkspace();\n\n const projectConfig: ProjectConfiguration = {\n name: 'app1',\n root: 'apps/app1',\n };\n projectGraph = {\n dependencies: {\n app1: [\n {\n source: 'app1',\n target: 'npm:@angular/core',\n type: 'static',\n },\n ],\n },\n nodes: {\n app1: {\n data: projectConfig,\n name: 'app1',\n type: 'app',\n },\n },\n };\n addProjectConfiguration(tree, projectConfig.name, projectConfig);\n\n});\n\ndescribe('.eslintrc.json', () => {\nit('should not disable @angular-eslint/prefer-standalone when it is set', async () => {\nwriteJson(tree, 'apps/app1/.eslintrc.json', {\noverrides: [\n{\nfiles: ['*.ts'],\nrules: { '@angular-eslint/prefer-standalone': ['error'] },\n},\n],\n});\n\n await migration(tree);\n\n expect(tree.read('apps/app1/.eslintrc.json', 'utf8'))\n .toMatchInlineSnapshot(`\n \"{\n \"overrides\": [\n {\n \"files\": [\"*.ts\"],\n \"rules\": {\n \"@angular-eslint/prefer-standalone\": [\"error\"]\n }\n }\n ]\n }\n \"\n `);\n });\n\n it('should not disable @angular-eslint/prefer-standalone when there are multiple overrides for angular eslint and the rule is set in one of them', async () => {\n writeJson(tree, 'apps/app1/.eslintrc.json', {\n overrides: [\n {\n files: ['*.ts'],\n rules: {\n '@angular-eslint/directive-selector': [\n 'error',\n { type: 'attribute', prefix: 'app', style: 'camelCase' },\n ],\n },\n },\n {\n files: ['*.ts'],\n rules: { '@angular-eslint/prefer-standalone': ['error'] },\n },\n ],\n });\n\n await migration(tree);\n\n expect(tree.read('apps/app1/.eslintrc.json', 'utf8'))\n .toMatchInlineSnapshot(`\n \"{\n \"overrides\": [\n {\n \"files\": [\"*.ts\"],\n \"rules\": {\n \"@angular-eslint/directive-selector\": [\n \"error\",\n {\n \"type\": \"attribute\",\n \"prefix\": \"app\",\n \"style\": \"camelCase\"\n }\n ]\n }\n },\n {\n \"files\": [\"*.ts\"],\n \"rules\": {\n \"@angular-eslint/prefer-standalone\": [\"error\"]\n }\n }\n ]\n }\n \"\n `);\n });\n\n it('should disable @angular-eslint/prefer-standalone in an existing override for angular eslint', async () => {\n writeJson(tree, 'apps/app1/.eslintrc.json', {\n overrides: [\n {\n files: ['*.ts'],\n rules: { 'no-unused-vars': 'error' },\n },\n {\n files: ['*.ts'],\n rules: {\n '@angular-eslint/directive-selector': [\n 'error',\n { type: 'attribute', prefix: 'app', style: 'camelCase' },\n ],\n },\n },\n ],\n });\n\n await migration(tree);\n\n expect(tree.read('apps/app1/.eslintrc.json', 'utf8'))\n .toMatchInlineSnapshot(`\n \"{\n \"overrides\": [\n {\n \"files\": [\"*.ts\"],\n \"rules\": {\n \"no-unused-vars\": \"error\"\n }\n },\n {\n \"files\": [\"*.ts\"],\n \"rules\": {\n \"@angular-eslint/directive-selector\": [\n \"error\",\n {\n \"type\": \"attribute\",\n \"prefix\": \"app\",\n \"style\": \"camelCase\"\n }\n ],\n \"@angular-eslint/prefer-standalone\": \"off\"\n }\n }\n ]\n }\n \"\n `);\n });\n\n it('should disable @angular-eslint/prefer-standalone in an existing override for ts files', async () => {\n writeJson(tree, 'apps/app1/.eslintrc.json', {\n overrides: [\n {\n files: ['*.ts'],\n rules: { 'no-unused-vars': 'error' },\n },\n ],\n });\n\n await migration(tree);\n\n expect(tree.read('apps/app1/.eslintrc.json', 'utf8'))\n .toMatchInlineSnapshot(`\n \"{\n \"overrides\": [\n {\n \"files\": [\"*.ts\"],\n \"rules\": {\n \"no-unused-vars\": \"error\",\n \"@angular-eslint/prefer-standalone\": \"off\"\n }\n }\n ]\n }\n \"\n `);\n });\n\n it('should disable @angular-eslint/prefer-standalone in a new override', async () => {\n writeJson(tree, 'apps/app1/.eslintrc.json', {\n overrides: [\n {\n files: ['*.html'],\n rules: { 'some-rule-for-html': 'error' },\n },\n ],\n });\n\n await migration(tree);\n\n expect(tree.read('apps/app1/.eslintrc.json', 'utf8'))\n .toMatchInlineSnapshot(`\n \"{\n \"overrides\": [\n {\n \"files\": [\"*.html\"],\n \"rules\": {\n \"some-rule-for-html\": \"error\"\n }\n },\n {\n \"files\": [\"*.ts\"],\n \"rules\": {\n \"@angular-eslint/prefer-standalone\": \"off\"\n }\n }\n ]\n }\n \"\n `);\n });\n\n});\n\ndescribe('flat config', () => {\nit('should not disable @angular-eslint/prefer-standalone when it is set', async () => {\ntree.write('eslint.config.js', 'module.exports = [];');\ntree.write(\n'apps/app1/eslint.config.js',\n`module.exports = [\n {\n files: ['*.ts'],\n rules: { '@angular-eslint/prefer-standalone': ['error'] },\n },\n ];\n `\n);\n\n await migration(tree);\n\n expect(tree.read('apps/app1/eslint.config.js', 'utf8'))\n .toMatchInlineSnapshot(`\n \"module.exports = [\n {\n files: ['*.ts'],\n rules: { '@angular-eslint/prefer-standalone': ['error'] },\n },\n ];\n \"\n `);\n });\n\n it('should not disable @angular-eslint/prefer-standalone when there are multiple overrides for angular eslint and the rule is set in one of them', async () => {\n tree.write('eslint.config.js', 'module.exports = [];');\n tree.write(\n 'apps/app1/eslint.config.js',\n `module.exports = [\n {\n files: ['*.ts'],\n rules: {\n '@angular-eslint/directive-selector': [\n 'error',\n { type: 'attribute', prefix: 'app', style: 'camelCase' },\n ],\n },\n },\n {\n files: ['*.ts'],\n rules: { '@angular-eslint/prefer-standalone': ['error'] },\n },\n ];\n `\n );\n\n await migration(tree);\n\n expect(tree.read('apps/app1/eslint.config.js', 'utf8'))\n .toMatchInlineSnapshot(`\n \"module.exports = [\n {\n files: ['*.ts'],\n rules: {\n '@angular-eslint/directive-selector': [\n 'error',\n { type: 'attribute', prefix: 'app', style: 'camelCase' },\n ],\n },\n },\n {\n files: ['*.ts'],\n rules: { '@angular-eslint/prefer-standalone': ['error'] },\n },\n ];\n \"\n `);\n });\n\n it('should disable @angular-eslint/prefer-standalone in an existing override for angular eslint', async () => {\n tree.write('eslint.config.js', 'module.exports = [];');\n tree.write(\n 'apps/app1/eslint.config.js',\n `module.exports = [\n {\n files: ['*.ts'],\n rules: { 'no-unused-vars': 'error' },\n },\n {\n files: ['*.ts'],\n rules: {\n '@angular-eslint/directive-selector': [\n 'error',\n { type: 'attribute', prefix: 'app', style: 'camelCase' },\n ],\n },\n },\n ];\n `\n );\n\n await migration(tree);\n\n expect(tree.read('apps/app1/eslint.config.js', 'utf8'))\n .toMatchInlineSnapshot(`\n \"module.exports = [\n {\n files: ['*.ts'],\n rules: { 'no-unused-vars': 'error' },\n },\n {\n files: ['**/*.ts'],\n rules: {\n '@angular-eslint/directive-selector': [\n 'error',\n {\n type: 'attribute',\n prefix: 'app',\n style: 'camelCase',\n },\n ],\n '@angular-eslint/prefer-standalone': 'off',\n },\n },\n ];\n \"\n `);\n });\n\n it('should disable @angular-eslint/prefer-standalone in an existing override for ts files', async () => {\n tree.write('eslint.config.js', 'module.exports = [];');\n tree.write(\n 'apps/app1/eslint.config.js',\n `module.exports = [\n {\n files: ['*.ts'],\n rules: { 'no-unused-vars': 'error' },\n },\n ];\n `\n );\n\n await migration(tree);\n\n expect(tree.read('apps/app1/eslint.config.js', 'utf8'))\n .toMatchInlineSnapshot(`\n \"module.exports = [\n {\n files: ['**/*.ts'],\n rules: {\n 'no-unused-vars': 'error',\n '@angular-eslint/prefer-standalone': 'off',\n },\n },\n ];\n \"\n `);\n });\n\n it('should disable @angular-eslint/prefer-standalone in a new override', async () => {\n tree.write('eslint.config.js', 'module.exports = [];');\n tree.write(\n 'apps/app1/eslint.config.js',\n `module.exports = [\n {\n files: ['*.html'],\n rules: { 'some-rule-for-html': 'error' },\n },\n ];\n `\n );\n\n await migration(tree);\n\n expect(tree.read('apps/app1/eslint.config.js', 'utf8'))\n .toMatchInlineSnapshot(`\n \"module.exports = [\n {\n files: ['*.html'],\n rules: { 'some-rule-for-html': 'error' },\n },\n {\n files: ['**/*.ts'],\n rules: {\n '@angular-eslint/prefer-standalone': 'off',\n },\n },\n ];\n \"\n `);\n });\n\n});\n});\n" } diff --git a/docs/generated/packages/angular/migrations/ensure-nx-module-federation-package.json b/docs/generated/packages/angular/migrations/ensure-nx-module-federation-package.json index 0c51c4cc71..2ddbf97f57 100644 --- a/docs/generated/packages/angular/migrations/ensure-nx-module-federation-package.json +++ b/docs/generated/packages/angular/migrations/ensure-nx-module-federation-package.json @@ -10,5 +10,5 @@ "path": "/packages/angular", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Ensure the @nx/module-federation Package is Installed\n\nIf workspace includes Module Federation projects, ensure the new `@nx/module-federation` package is installed.\n\n#### Sample Code Changes\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"package.json\" %}\n{\n \"dependencies\": {}\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```json {% fileName=\"package.json\" %}\n{\n \"dependencies\": {\n \"@nx/module-federation\": \"20.3.0\"\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/angular/migrations/remove-angular-eslint-rules.json b/docs/generated/packages/angular/migrations/remove-angular-eslint-rules.json index b45e4a7363..079541430e 100644 --- a/docs/generated/packages/angular/migrations/remove-angular-eslint-rules.json +++ b/docs/generated/packages/angular/migrations/remove-angular-eslint-rules.json @@ -11,5 +11,5 @@ "path": "/packages/angular", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Remove Angular ESLint Rules\n\nRemove Angular ESLint rules that were removed in v19.0.0.\n\n#### Sample Code Changes\n\nRemoves `@angular-eslint/no-host-metadata-property`, `@angular-eslint/sort-ngmodule-metadata-arrays` and `@angular-eslint/prefer-standalone-component` from any ESLint config file. Files to be searched include `.eslintrc.json`, `.eslintrc.base.json`, `.eslint.config.js` and `.eslint.config.base.js`.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"apps/app1/.eslintrc.json\" %}\n{\n \"overrides\": [\n {\n \"files\": [\"*.ts\"],\n \"rules\": {\n \"@angular-eslint/no-host-metadata-property\": [\"error\"],\n \"@angular-eslint/sort-ngmodule-metadata-arrays\": [\"error\"],\n \"@angular-eslint/prefer-standalone-component\": [\"error\"]\n }\n }\n ]\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```json {% fileName=\"apps/app1/.eslintrc.json\" %}\n{\n \"overrides\": [\n {\n \"files\": [\"*.ts\"],\n \"rules\": {}\n }\n ]\n}\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/angular/migrations/remove-tailwind-config-from-ng-packagr-executors.json b/docs/generated/packages/angular/migrations/remove-tailwind-config-from-ng-packagr-executors.json index 72d33c7d43..4d8846556d 100644 --- a/docs/generated/packages/angular/migrations/remove-tailwind-config-from-ng-packagr-executors.json +++ b/docs/generated/packages/angular/migrations/remove-tailwind-config-from-ng-packagr-executors.json @@ -11,5 +11,5 @@ "path": "/packages/angular", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Remove tailwindConfig from ng-packagr Executors\n\nRemove the deprecated 'tailwindConfig' option from ng-packagr executors. Tailwind CSS configurations located at the project or workspace root will be picked up automatically.\n\n#### Sample Code Changes\n\nRemove `tailwindConfig` from the `@nx/angular:ng-packagr-lite` or `@nx/angular:package` executor options in project configuration.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"libs/my-lib/project.json\" %}\n{\n \"targets\": {\n \"build\": {\n \"executor\": \"@nx/angular:ng-packagr-lite\",\n \"options\": {\n \"project\": \"libs/lib1/ng-package.json\",\n \"tailwindConfig\": \"libs/lib1/tailwind.config.js\"\n }\n }\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```json {% fileName=\"libs/my-lib/project.json\" %}\n{\n \"targets\": {\n \"build\": {\n \"executor\": \"@nx/angular:ng-packagr-lite\",\n \"options\": {\n \"project\": \"libs/lib1/ng-package.json\"\n }\n }\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n\nRemove `tailwindConfig` from the `@nx/angular:ng-packagr-lite` or `@nx/angular:package` executor target defaults in `nx.json`.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"nx.json\" %}\n{\n \"targetDefaults\": {\n \"@nx/angular:ng-packagr-lite\": {\n \"options\": {\n \"project\": \"{projectRoot}/ng-package.json\",\n \"tailwindConfig\": \"{projectRoot}/tailwind.config.js\"\n }\n }\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```json {% fileName=\"nx.json\" %}\n{\n \"targetDefaults\": {\n \"@nx/angular:ng-packagr-lite\": {\n \"options\": {\n \"project\": \"{projectRoot}/ng-package.json\"\n }\n }\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/angular/migrations/update-20-2-0-update-module-federation-config-import.json b/docs/generated/packages/angular/migrations/update-20-2-0-update-module-federation-config-import.json index 3d32784139..545f36fb4a 100644 --- a/docs/generated/packages/angular/migrations/update-20-2-0-update-module-federation-config-import.json +++ b/docs/generated/packages/angular/migrations/update-20-2-0-update-module-federation-config-import.json @@ -10,5 +10,5 @@ "path": "/packages/angular", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Migrate Module Federation Imports to New Package\n\nUpdate the ModuleFederationConfig imports to use @nx/module-federation.\n\n#### Sample Code Changes\n\nUpdate import paths for ModuleFederationConfig.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```js {% fileName=\"apps/shell/webpack.config.js\" %}\nimport { ModuleFederationConfig } from '@nx/webpack';\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```js {% fileName=\"apps/shell/webpack.config.js\" %}\nimport { ModuleFederationConfig } from '@nx/module-federation';\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/angular/migrations/update-20-2-0-update-with-module-federation-import.json b/docs/generated/packages/angular/migrations/update-20-2-0-update-with-module-federation-import.json index 7b3e99bfb9..358079fe12 100644 --- a/docs/generated/packages/angular/migrations/update-20-2-0-update-with-module-federation-import.json +++ b/docs/generated/packages/angular/migrations/update-20-2-0-update-with-module-federation-import.json @@ -10,5 +10,5 @@ "path": "/packages/angular", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Migrate withModuleFederation Import to New Package\n\nUpdate the withModuleFederation import to use @nx/module-federation/webpack.\n\n#### Sample Code Changes\n\nUpdate import paths for `withModuleFederation` and `withModuleFederationForSSR`.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```ts {% fileName=\"apps/shell/webpack.config.ts\" %}\nimport {\n withModuleFederation,\n withModuleFederationForSSR,\n} from '@nx/angular/module-federation';\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```ts {% fileName=\"apps/shell/webpack.config.ts\" %}\nimport {\n withModuleFederation,\n withModuleFederationForSSR,\n} from '@nx/module-federation/angular';\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/angular/migrations/update-angular-cli-version-19-0-0.json b/docs/generated/packages/angular/migrations/update-angular-cli-version-19-0-0.json index 453460c1d3..f56ae0a562 100644 --- a/docs/generated/packages/angular/migrations/update-angular-cli-version-19-0-0.json +++ b/docs/generated/packages/angular/migrations/update-angular-cli-version-19-0-0.json @@ -11,5 +11,5 @@ "path": "/packages/angular", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Update `@angular/cli` to `~19.0.0`\n\nUpdate the version of the Angular CLI if it is specified in `package.json`\n\n#### Sample Code Changes\n\nUpdate in `devDependencies`:\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```{% fileName=\"package.json\" %}\n{\n \"devDependencies\": {\n \"@angular/cli\": \"~13.3.0\"\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```{% fileName=\"package.json\" %}\n{\n \"devDependencies\": {\n \"@angular/cli\": \"~19.0.0\"\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n\nUpdate in `dependencies`:\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```{% fileName=\"package.json\" %}\n{\n \"dependencies\": {\n \"@angular/cli\": \"~13.3.0\"\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```{% fileName=\"package.json\" %}\n{\n \"dependencies\": {\n \"@angular/cli\": \"~19.0.0\"\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/angular/migrations/update-angular-cli-version-19-1-0.json b/docs/generated/packages/angular/migrations/update-angular-cli-version-19-1-0.json index de94b18b83..dea8263537 100644 --- a/docs/generated/packages/angular/migrations/update-angular-cli-version-19-1-0.json +++ b/docs/generated/packages/angular/migrations/update-angular-cli-version-19-1-0.json @@ -11,5 +11,5 @@ "path": "/packages/angular", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Update `@angular/cli` to `~19.1.0`\n\nUpdate the version of the Angular CLI if it is specified in `package.json`\n\n#### Sample Code Changes\n\nUpdate in `devDependencies`:\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```{% fileName=\"package.json\" %}\n{\n \"devDependencies\": {\n \"@angular/cli\": \"~13.3.0\"\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```{% fileName=\"package.json\" %}\n{\n \"devDependencies\": {\n \"@angular/cli\": \"~19.1.0\"\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n\nUpdate in `dependencies`:\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```{% fileName=\"package.json\" %}\n{\n \"dependencies\": {\n \"@angular/cli\": \"~13.3.0\"\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```{% fileName=\"package.json\" %}\n{\n \"dependencies\": {\n \"@angular/cli\": \"~19.1.0\"\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/angular/migrations/update-angular-ssr-imports-to-use-node-entry-point.json b/docs/generated/packages/angular/migrations/update-angular-ssr-imports-to-use-node-entry-point.json index 2481605b93..8df87a686c 100644 --- a/docs/generated/packages/angular/migrations/update-angular-ssr-imports-to-use-node-entry-point.json +++ b/docs/generated/packages/angular/migrations/update-angular-ssr-imports-to-use-node-entry-point.json @@ -11,5 +11,5 @@ "path": "/packages/angular", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Update Angular SSR Imports to Use Node Entry Point\n\nUpdate '@angular/ssr' import paths to use the new '/node' entry point when 'CommonEngine' is detected.\n\n#### Sample Code Changes\n\nUpdate import paths for SSR CommonEngine properties to use `@angular/ssr/node`.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```ts {% fileName=\"apps/app1/server.ts\" %}\nimport { CommonEngine } from '@angular/ssr';\nimport type {\n CommonEngineOptions,\n CommonEngineRenderOptions,\n} from '@angular/ssr';\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```ts {% fileName=\"apps/app1/server.ts\" %}\nimport { CommonEngine } from '@angular/ssr/node';\nimport type {\n CommonEngineOptions,\n CommonEngineRenderOptions,\n} from '@angular/ssr/node';\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/eslint/migrations/add-file-extensions-to-overrides.json b/docs/generated/packages/eslint/migrations/add-file-extensions-to-overrides.json index 1dfc5c5bdf..1cf0e7b85a 100644 --- a/docs/generated/packages/eslint/migrations/add-file-extensions-to-overrides.json +++ b/docs/generated/packages/eslint/migrations/add-file-extensions-to-overrides.json @@ -8,5 +8,5 @@ "path": "/packages/eslint", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Update ESLint Config File Extensions in Overrides\n\nUpdate ESLint flat config to include .cjs, .mjs, .cts, and .mts files in overrides (if needed)\n\n#### Sample Code Changes\n\nAdd `.cjs`, `.mjs`, `.cts`, `.mts` file extensions to overrides converted using `convert-to-flat-config`\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```js {% fileName=\"eslint.config.js\" %}\nconst { FlatCompat } = require('@eslint/eslintrc');\nconst js = require('@eslint/js');\nconst nxEslintPlugin = require('@nx/eslint-plugin');\n\nconst compat = new FlatCompat({\n baseDirectory: __dirname,\n recommendedConfig: js.configs.recommended,\n});\n\nmodule.exports = [\n ...compat\n .config({\n extends: ['plugin:@nx/typescript'],\n })\n .map((config) => ({\n ...config,\n files: ['**/*.ts', '**/*.tsx'],\n rules: {\n ...config.rules,\n },\n })),\n ...compat\n .config({\n extends: ['plugin:@nx/javascript'],\n })\n .map((config) => ({\n ...config,\n files: ['**/*.js', '**/*.jsx'],\n rules: {\n ...config.rules,\n },\n })),\n];\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```js {% highlightLines=[17,28] fileName=\"eslint.config.js\" %}\nconst { FlatCompat } = require('@eslint/eslintrc');\nconst js = require('@eslint/js');\nconst nxEslintPlugin = require('@nx/eslint-plugin');\n\nconst compat = new FlatCompat({\n baseDirectory: __dirname,\n recommendedConfig: js.configs.recommended,\n});\n\nmodule.exports = [\n ...compat\n .config({\n extends: ['plugin:@nx/typescript'],\n })\n .map((config) => ({\n ...config,\n files: ['**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts'],\n rules: {\n ...config.rules,\n },\n })),\n ...compat\n .config({\n extends: ['plugin:@nx/javascript'],\n })\n .map((config) => ({\n ...config,\n files: ['**/*.js', '**/*.jsx', '**/*.cjs', '**/*.mjs'],\n rules: {\n ...config.rules,\n },\n })),\n];\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/eslint/migrations/update-typescript-eslint-v8.13.0.json b/docs/generated/packages/eslint/migrations/update-typescript-eslint-v8.13.0.json index ed15c3bc2d..a98e9b4f7d 100644 --- a/docs/generated/packages/eslint/migrations/update-typescript-eslint-v8.13.0.json +++ b/docs/generated/packages/eslint/migrations/update-typescript-eslint-v8.13.0.json @@ -8,5 +8,5 @@ "path": "/packages/eslint", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Update TypeScript ESLint to v8.13.0\n\nUpdate TypeScript ESLint packages to v8.13.0 if they are already on v8\n\n#### Sample Code Changes\n\nThis migration will update `typescript-eslint`, `@typescript-eslint/eslint-plugin`, `@typescript-eslint/parser` and `@typescript-eslint/utils` to `8.13.0` if they are between version `8.0.0` and `8.13.0`.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"package.json\" %}\n{\n \"devDependencies\": {\n \"typescript-eslint\": \"^8.0.0\",\n \"@typescript-eslint/eslint-plugin\": \"^8.0.0\",\n \"@typescript-eslint/parser\": \"^8.0.0\",\n \"@typescript-eslint/utils\": \"^8.0.0\"\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```json {% fileName=\"package.json\" %}\n{\n \"devDependencies\": {\n \"typescript-eslint\": \"^8.13.0\",\n \"@typescript-eslint/eslint-plugin\": \"^8.13.0\",\n \"@typescript-eslint/parser\": \"^8.13.0\",\n \"@typescript-eslint/utils\": \"^8.13.0\"\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/gradle/migrations/add-include-subprojects-tasks.json b/docs/generated/packages/gradle/migrations/add-include-subprojects-tasks.json index 4314a1703f..b9aef994f0 100644 --- a/docs/generated/packages/gradle/migrations/add-include-subprojects-tasks.json +++ b/docs/generated/packages/gradle/migrations/add-include-subprojects-tasks.json @@ -10,5 +10,5 @@ "path": "/packages/gradle", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Add includeSubprojectsTasks to build.gradle File\n\nAdd includeSubprojectsTasks to build.gradle file\n\n#### Sample Code Changes\n\nUpdate import paths for `withModuleFederation` and `withModuleFederationForSSR`.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"nx.json\" %}\n{\n \"plugins\": [\"@nx/gradle\"]\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```json {% highlightLines=[5] fileName=\"nx.json\" %}\n{\n \"plugins\": [\n {\n \"options\": {\n \"includeSubprojectsTasks\": true\n },\n \"plugin\": \"@nx/gradle\"\n }\n ]\n}\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/jest/migrations/replace-getJestProjects-with-getJestProjectsAsync.json b/docs/generated/packages/jest/migrations/replace-getJestProjects-with-getJestProjectsAsync.json index 5bf4c22b84..044ef0191a 100644 --- a/docs/generated/packages/jest/migrations/replace-getJestProjects-with-getJestProjectsAsync.json +++ b/docs/generated/packages/jest/migrations/replace-getJestProjects-with-getJestProjectsAsync.json @@ -9,5 +9,5 @@ "path": "/packages/jest", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Replace getJestProjects with getJestProjectsAsync\n\nReplace getJestProjects with getJestProjectsAsync\n\n#### Sample Code Changes\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```ts {% fileName=\"jest.config.ts\" %}\nimport { getJestProjects } from '@nx/jest';\n\nexport default {\n projects: getJestProjects(),\n};\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```ts {% fileName=\"jest.config.ts\" %}\nimport { getJestProjectsAsync } from '@nx/jest';\n\nexport default async () => ({\n projects: await getJestProjectsAsync(),\n});\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/nx/migrations/move-use-daemon-process.json b/docs/generated/packages/nx/migrations/move-use-daemon-process.json index 77fce44902..e317b66b99 100644 --- a/docs/generated/packages/nx/migrations/move-use-daemon-process.json +++ b/docs/generated/packages/nx/migrations/move-use-daemon-process.json @@ -8,5 +8,5 @@ "path": "/packages/nx", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Move useDaemonProcess\n\nMove the `useDaemonProcess` to the root of `nx.json`\n\n#### Sample Code Changes\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"nx.json\" %}\n{\n \"tasksRunnerOptions\": {\n \"default\": {\n \"options\": {\n \"useDaemonProcess\": false\n }\n }\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```json {% fileName=\"nx.json\" %}\n{\n \"useDaemonProcess\": false\n}\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/nx/migrations/use-legacy-cache.json b/docs/generated/packages/nx/migrations/use-legacy-cache.json index 75d4c30b05..116031797d 100644 --- a/docs/generated/packages/nx/migrations/use-legacy-cache.json +++ b/docs/generated/packages/nx/migrations/use-legacy-cache.json @@ -9,5 +9,5 @@ "path": "/packages/nx", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Use Legacy Cache\n\nSet `useLegacyCache` to true for migrating workspaces\n\n#### Sample Code Changes\n\nAdd `useLegacyCache` to `nx.json` unless `enableDbCache` was set to true.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"nx.json\" %}\n{\n \"targetDefaults\": {}\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```json {% fileName=\"nx.json\" %}\n{\n \"targetDefaults\": {},\n \"useLegacyCache\": true\n}\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/react/migrations/add-mf-env-var-to-target-defaults.json b/docs/generated/packages/react/migrations/add-mf-env-var-to-target-defaults.json index 0fb39ced27..8c3b784112 100644 --- a/docs/generated/packages/react/migrations/add-mf-env-var-to-target-defaults.json +++ b/docs/generated/packages/react/migrations/add-mf-env-var-to-target-defaults.json @@ -10,5 +10,5 @@ "path": "/packages/react", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Add Module Federation Env Var to Target Defaults\n\nAdd NX_MF_DEV_REMOTES to inputs for task hashing when `@nx/webpack:webpack` or `@nx/rspack:rspack` is used for Module Federation.\n\n#### Sample Code Changes\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"nx.json\" %}\n{\n \"targetDefaults\": {\n \"@nx/webpack:webpack\": {\n \"inputs\": [\"^build\"]\n }\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```json {% highlightLines=[4,5,6] fileName=\"nx.json\" %}\n{\n \"targetDefaults\": {\n \"@nx/webpack:webpack\": {\n \"cache\": true,\n \"dependsOn\": [\"^build\"],\n \"inputs\": [\n \"^build\",\n {\n \"env\": \"NX_MF_DEV_REMOTES\"\n }\n ]\n }\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/react/migrations/add-module-federation-env-var-to-target-defaults.json b/docs/generated/packages/react/migrations/add-module-federation-env-var-to-target-defaults.json index 71c27ef1f6..c53cb65749 100644 --- a/docs/generated/packages/react/migrations/add-module-federation-env-var-to-target-defaults.json +++ b/docs/generated/packages/react/migrations/add-module-federation-env-var-to-target-defaults.json @@ -10,5 +10,5 @@ "path": "/packages/react", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Add Module Federation Env Var to Target Defaults\n\nAdd NX_MF_DEV_REMOTES to inputs for task hashing when `@nx/webpack:webpack` or `@nx/rspack:rspack` is used for Module Federation.\n\n#### Sample Code Changes\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"nx.json\" %}\n{\n \"targetDefaults\": {\n \"@nx/webpack:webpack\": {\n \"inputs\": [\"^build\"]\n }\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```json {% highlightLines=[4,5,6] fileName=\"nx.json\" %}\n{\n \"targetDefaults\": {\n \"@nx/webpack:webpack\": {\n \"cache\": true,\n \"dependsOn\": [\"^build\"],\n \"inputs\": [\n \"^build\",\n {\n \"env\": \"NX_MF_DEV_REMOTES\"\n }\n ]\n }\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/react/migrations/ensure-nx-module-federation-package.json b/docs/generated/packages/react/migrations/ensure-nx-module-federation-package.json index 4f1d228241..06d158ce7d 100644 --- a/docs/generated/packages/react/migrations/ensure-nx-module-federation-package.json +++ b/docs/generated/packages/react/migrations/ensure-nx-module-federation-package.json @@ -10,5 +10,5 @@ "path": "/packages/react", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Ensure the @nx/module-federation Package is Installed\n\nIf workspace includes Module Federation projects, ensure the new `@nx/module-federation` package is installed.\n\n#### Sample Code Changes\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"package.json\" %}\n{\n \"dependencies\": {}\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```json {% fileName=\"package.json\" %}\n{\n \"dependencies\": {\n \"@nx/module-federation\": \"20.3.0\"\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/react/migrations/update-20-2-0-update-module-federation-config-import.json b/docs/generated/packages/react/migrations/update-20-2-0-update-module-federation-config-import.json index 1a13810f75..a80e6fa2f5 100644 --- a/docs/generated/packages/react/migrations/update-20-2-0-update-module-federation-config-import.json +++ b/docs/generated/packages/react/migrations/update-20-2-0-update-module-federation-config-import.json @@ -10,5 +10,5 @@ "path": "/packages/react", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Migrate Module Federation Imports to New Package\n\nUpdate the ModuleFederationConfig imports to use @nx/module-federation.\n\n#### Sample Code Changes\n\nUpdate import paths for ModuleFederationConfig.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```js {% fileName=\"apps/shell/webpack.config.js\" %}\nimport { ModuleFederationConfig } from '@nx/webpack';\n```\n\n```js {% fileName=\"apps/shell/rspack.config.js\" %}\nimport { ModuleFederationConfig } from '@nx/rspack/module-federation';\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```js {% fileName=\"apps/shell/webpack.config.js\" %}\nimport { ModuleFederationConfig } from '@nx/module-federation';\n```\n\n```js {% fileName=\"apps/shell/rspack.config.js\" %}\nimport { ModuleFederationConfig } from '@nx/module-federation';\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/react/migrations/update-20-2-0-update-with-module-federation-import.json b/docs/generated/packages/react/migrations/update-20-2-0-update-with-module-federation-import.json index 790737999d..7a85895509 100644 --- a/docs/generated/packages/react/migrations/update-20-2-0-update-with-module-federation-import.json +++ b/docs/generated/packages/react/migrations/update-20-2-0-update-with-module-federation-import.json @@ -10,5 +10,5 @@ "path": "/packages/react", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Migrate withModuleFederation Import to New Package\n\nUpdate the withModuleFederation import to use @nx/module-federation/webpack.\n\n#### Sample Code Changes\n\nUpdate import paths for `withModuleFederation` and `withModuleFederationForSSR`.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```ts {% fileName=\"apps/shell/webpack.config.ts\" %}\nimport {\n withModuleFederation,\n withModuleFederationForSSR,\n} from '@nx/react/module-federation';\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```ts {% fileName=\"apps/shell/webpack.config.ts\" %}\nimport {\n withModuleFederation,\n withModuleFederationForSSR,\n} from '@nx/module-federation/webpack';\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/rspack/migrations/ensure-nx-module-federation-package.json b/docs/generated/packages/rspack/migrations/ensure-nx-module-federation-package.json index 22cfe67188..2aa9c8d3a7 100644 --- a/docs/generated/packages/rspack/migrations/ensure-nx-module-federation-package.json +++ b/docs/generated/packages/rspack/migrations/ensure-nx-module-federation-package.json @@ -10,5 +10,5 @@ "path": "/packages/rspack", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Ensure the @nx/module-federation Package is Installed\n\nIf workspace includes Module Federation projects, ensure the new `@nx/module-federation` package is installed.\n\n#### Sample Code Changes\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```json {% fileName=\"package.json\" %}\n{\n \"dependencies\": {}\n}\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```json {% fileName=\"package.json\" %}\n{\n \"dependencies\": {\n \"@nx/module-federation\": \"20.3.0\"\n }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/rspack/migrations/update-20-2-0-update-with-module-federation-import.json b/docs/generated/packages/rspack/migrations/update-20-2-0-update-with-module-federation-import.json index e01854a273..157624ba17 100644 --- a/docs/generated/packages/rspack/migrations/update-20-2-0-update-with-module-federation-import.json +++ b/docs/generated/packages/rspack/migrations/update-20-2-0-update-with-module-federation-import.json @@ -10,5 +10,5 @@ "path": "/packages/rspack", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Migrate withModuleFederation Import to New Package\n\nUpdate the withModuleFederation import to use @nx/module-federation/rspack.\n\n#### Sample Code Changes\n\nUpdate import paths for `withModuleFederation` and `withModuleFederationForSSR`.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```ts {% fileName=\"apps/shell/rspack.config.ts\" %}\nimport {\n withModuleFederation,\n withModuleFederationForSSR,\n} from '@nx/rspack/module-federation';\n```\n\n{% /tab %}\n{% tab label=\"After\" %}\n\n```ts {% fileName=\"apps/shell/rspack.config.ts\" %}\nimport {\n withModuleFederation,\n withModuleFederationForSSR,\n} from '@nx/module-federation/rspack';\n```\n\n{% /tab %}\n{% /tabs %}\n" } diff --git a/docs/generated/packages/vite/migrations/update-20-0-4.json b/docs/generated/packages/vite/migrations/update-20-0-4.json index ca8e5fa06f..aca5d30e74 100644 --- a/docs/generated/packages/vite/migrations/update-20-0-4.json +++ b/docs/generated/packages/vite/migrations/update-20-0-4.json @@ -8,5 +8,5 @@ "path": "/packages/vite", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Add Vite Temp Files to Git Ignore\n\nAdd gitignore entry for temporary vite config files.\n\n#### Sample Code Changes\n\nAdds the following entries to the `.gitignore` file.\n\n```text {% fileName=\".gitignore\" %}\nvite.config.*.timestamp*\nvitest.config.*.timestamp*\n```\n" } diff --git a/docs/generated/packages/vite/migrations/update-20-0-6.json b/docs/generated/packages/vite/migrations/update-20-0-6.json index 6cfe1aa7d0..40aa2eb2e5 100644 --- a/docs/generated/packages/vite/migrations/update-20-0-6.json +++ b/docs/generated/packages/vite/migrations/update-20-0-6.json @@ -8,5 +8,5 @@ "path": "/packages/vite", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Add Vite Temp Files to Git Ignore\n\nAdd gitignore entry for temporary vite config files.\n\n#### Sample Code Changes\n\nAdds the following entries to the `.gitignore` file.\n\n```text {% fileName=\".gitignore\" %}\nvite.config.*.timestamp*\nvitest.config.*.timestamp*\n```\n" } diff --git a/docs/generated/packages/vite/migrations/update-20-3-0.json b/docs/generated/packages/vite/migrations/update-20-3-0.json index 41ba3aab20..90c6e1a8e3 100644 --- a/docs/generated/packages/vite/migrations/update-20-3-0.json +++ b/docs/generated/packages/vite/migrations/update-20-3-0.json @@ -8,5 +8,5 @@ "path": "/packages/vite", "schema": null, "type": "migration", - "examplesFile": "" + "examplesFile": "#### Add Vitest Temp Files to Git Ignore\n\nAdd gitignore entry for temporary vitest config files.\n\n#### Sample Code Changes\n\nAdds the following entries to the `.gitignore` file.\n\n```text {% fileName=\".gitignore\" %}\nvite.config.*.timestamp*\nvitest.config.*.timestamp*\n```\n" } diff --git a/packages/angular/src/migrations/update-20-2-0/add-localize-polyfill-to-targets.md b/packages/angular/src/migrations/update-20-2-0/add-localize-polyfill-to-targets.md new file mode 100644 index 0000000000..ff9deda0d5 --- /dev/null +++ b/packages/angular/src/migrations/update-20-2-0/add-localize-polyfill-to-targets.md @@ -0,0 +1,49 @@ +#### Add Localize Polyfill to Targets + +Add the '@angular/localize/init' polyfill to the 'polyfills' option of targets using esbuild-based executors. + +#### Sample Code Changes + +Add the `@angular/localize/init` polyfill to any of these executors: + +- `@angular/build:application` +- `@angular-devkit/build-angular:application` +- `@nx/angular:application` +- `@angular-devkit/build-angular:browser-esbuild` +- `@nx/angular:browser-esbuild` + +{% tabs %} +{% tab label="Before" %} + +```json {% fileName="apps/app1/project.json" %} +{ + "targets": { + "build": { + "executor": "@angular/build:application", + "options": { + "localize": true + } + } + } +} +``` + +{% /tab %} +{% tab label="After" %} + +```json {% fileName="apps/app1/project.json" %} +{ + "targets": { + "build": { + "executor": "@angular/build:application", + "options": { + "localize": true, + "polyfills": ["@angular/localize/init"] + } + } + } +} +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/angular/src/migrations/update-20-2-0/disable-angular-eslint-prefer-standalone.md b/packages/angular/src/migrations/update-20-2-0/disable-angular-eslint-prefer-standalone.md new file mode 100644 index 0000000000..5c38b9ab95 --- /dev/null +++ b/packages/angular/src/migrations/update-20-2-0/disable-angular-eslint-prefer-standalone.md @@ -0,0 +1,480 @@ +#### Disable Angular ESLint Prefer Standalone + +Disable the Angular ESLint prefer-standalone rule if not set. + +#### Sample Code Changes + +Update import paths for `withModuleFederation` and `withModuleFederationForSSR`. + +{% tabs %} +{% tab label="Before" %} + +```json {% fileName="apps/app1/.eslintrc.json" %} +{ + "overrides": [ + { + "files": ["*.html"], + "rules": { + "some-rule-for-html": "error" + } + } + ] +} +``` + +{% /tab %} +{% tab label="After" %} + +```json {% fileName="apps/app1/.eslintrc.json" %} +{ + "overrides": [ + { + "files": ["*.html"], + "rules": { + "some-rule-for-html": "error" + } + }, + { + "files": ["*.ts"], + "rules": { + "@angular-eslint/prefer-standalone": "off" + } + } + ] +} +``` + +{% /tab %} +{% /tabs %} + +import { +addProjectConfiguration, +writeJson, +type ProjectConfiguration, +type ProjectGraph, +type Tree, +} from '@nx/devkit'; +import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; +import migration from './disable-angular-eslint-prefer-standalone'; + +let projectGraph: ProjectGraph; +jest.mock('@nx/devkit', () => ({ +...jest.requireActual('@nx/devkit'), +createProjectGraphAsync: () => Promise.resolve(projectGraph), +})); + +describe('disable-angular-eslint-prefer-standalone', () => { +let tree: Tree; + +beforeEach(() => { +tree = createTreeWithEmptyWorkspace(); + + const projectConfig: ProjectConfiguration = { + name: 'app1', + root: 'apps/app1', + }; + projectGraph = { + dependencies: { + app1: [ + { + source: 'app1', + target: 'npm:@angular/core', + type: 'static', + }, + ], + }, + nodes: { + app1: { + data: projectConfig, + name: 'app1', + type: 'app', + }, + }, + }; + addProjectConfiguration(tree, projectConfig.name, projectConfig); + +}); + +describe('.eslintrc.json', () => { +it('should not disable @angular-eslint/prefer-standalone when it is set', async () => { +writeJson(tree, 'apps/app1/.eslintrc.json', { +overrides: [ +{ +files: ['*.ts'], +rules: { '@angular-eslint/prefer-standalone': ['error'] }, +}, +], +}); + + await migration(tree); + + expect(tree.read('apps/app1/.eslintrc.json', 'utf8')) + .toMatchInlineSnapshot(` + "{ + "overrides": [ + { + "files": ["*.ts"], + "rules": { + "@angular-eslint/prefer-standalone": ["error"] + } + } + ] + } + " + `); + }); + + it('should not disable @angular-eslint/prefer-standalone when there are multiple overrides for angular eslint and the rule is set in one of them', async () => { + writeJson(tree, 'apps/app1/.eslintrc.json', { + overrides: [ + { + files: ['*.ts'], + rules: { + '@angular-eslint/directive-selector': [ + 'error', + { type: 'attribute', prefix: 'app', style: 'camelCase' }, + ], + }, + }, + { + files: ['*.ts'], + rules: { '@angular-eslint/prefer-standalone': ['error'] }, + }, + ], + }); + + await migration(tree); + + expect(tree.read('apps/app1/.eslintrc.json', 'utf8')) + .toMatchInlineSnapshot(` + "{ + "overrides": [ + { + "files": ["*.ts"], + "rules": { + "@angular-eslint/directive-selector": [ + "error", + { + "type": "attribute", + "prefix": "app", + "style": "camelCase" + } + ] + } + }, + { + "files": ["*.ts"], + "rules": { + "@angular-eslint/prefer-standalone": ["error"] + } + } + ] + } + " + `); + }); + + it('should disable @angular-eslint/prefer-standalone in an existing override for angular eslint', async () => { + writeJson(tree, 'apps/app1/.eslintrc.json', { + overrides: [ + { + files: ['*.ts'], + rules: { 'no-unused-vars': 'error' }, + }, + { + files: ['*.ts'], + rules: { + '@angular-eslint/directive-selector': [ + 'error', + { type: 'attribute', prefix: 'app', style: 'camelCase' }, + ], + }, + }, + ], + }); + + await migration(tree); + + expect(tree.read('apps/app1/.eslintrc.json', 'utf8')) + .toMatchInlineSnapshot(` + "{ + "overrides": [ + { + "files": ["*.ts"], + "rules": { + "no-unused-vars": "error" + } + }, + { + "files": ["*.ts"], + "rules": { + "@angular-eslint/directive-selector": [ + "error", + { + "type": "attribute", + "prefix": "app", + "style": "camelCase" + } + ], + "@angular-eslint/prefer-standalone": "off" + } + } + ] + } + " + `); + }); + + it('should disable @angular-eslint/prefer-standalone in an existing override for ts files', async () => { + writeJson(tree, 'apps/app1/.eslintrc.json', { + overrides: [ + { + files: ['*.ts'], + rules: { 'no-unused-vars': 'error' }, + }, + ], + }); + + await migration(tree); + + expect(tree.read('apps/app1/.eslintrc.json', 'utf8')) + .toMatchInlineSnapshot(` + "{ + "overrides": [ + { + "files": ["*.ts"], + "rules": { + "no-unused-vars": "error", + "@angular-eslint/prefer-standalone": "off" + } + } + ] + } + " + `); + }); + + it('should disable @angular-eslint/prefer-standalone in a new override', async () => { + writeJson(tree, 'apps/app1/.eslintrc.json', { + overrides: [ + { + files: ['*.html'], + rules: { 'some-rule-for-html': 'error' }, + }, + ], + }); + + await migration(tree); + + expect(tree.read('apps/app1/.eslintrc.json', 'utf8')) + .toMatchInlineSnapshot(` + "{ + "overrides": [ + { + "files": ["*.html"], + "rules": { + "some-rule-for-html": "error" + } + }, + { + "files": ["*.ts"], + "rules": { + "@angular-eslint/prefer-standalone": "off" + } + } + ] + } + " + `); + }); + +}); + +describe('flat config', () => { +it('should not disable @angular-eslint/prefer-standalone when it is set', async () => { +tree.write('eslint.config.js', 'module.exports = [];'); +tree.write( +'apps/app1/eslint.config.js', +`module.exports = [ + { + files: ['*.ts'], + rules: { '@angular-eslint/prefer-standalone': ['error'] }, + }, + ]; + ` +); + + await migration(tree); + + expect(tree.read('apps/app1/eslint.config.js', 'utf8')) + .toMatchInlineSnapshot(` + "module.exports = [ + { + files: ['*.ts'], + rules: { '@angular-eslint/prefer-standalone': ['error'] }, + }, + ]; + " + `); + }); + + it('should not disable @angular-eslint/prefer-standalone when there are multiple overrides for angular eslint and the rule is set in one of them', async () => { + tree.write('eslint.config.js', 'module.exports = [];'); + tree.write( + 'apps/app1/eslint.config.js', + `module.exports = [ + { + files: ['*.ts'], + rules: { + '@angular-eslint/directive-selector': [ + 'error', + { type: 'attribute', prefix: 'app', style: 'camelCase' }, + ], + }, + }, + { + files: ['*.ts'], + rules: { '@angular-eslint/prefer-standalone': ['error'] }, + }, + ]; + ` + ); + + await migration(tree); + + expect(tree.read('apps/app1/eslint.config.js', 'utf8')) + .toMatchInlineSnapshot(` + "module.exports = [ + { + files: ['*.ts'], + rules: { + '@angular-eslint/directive-selector': [ + 'error', + { type: 'attribute', prefix: 'app', style: 'camelCase' }, + ], + }, + }, + { + files: ['*.ts'], + rules: { '@angular-eslint/prefer-standalone': ['error'] }, + }, + ]; + " + `); + }); + + it('should disable @angular-eslint/prefer-standalone in an existing override for angular eslint', async () => { + tree.write('eslint.config.js', 'module.exports = [];'); + tree.write( + 'apps/app1/eslint.config.js', + `module.exports = [ + { + files: ['*.ts'], + rules: { 'no-unused-vars': 'error' }, + }, + { + files: ['*.ts'], + rules: { + '@angular-eslint/directive-selector': [ + 'error', + { type: 'attribute', prefix: 'app', style: 'camelCase' }, + ], + }, + }, + ]; + ` + ); + + await migration(tree); + + expect(tree.read('apps/app1/eslint.config.js', 'utf8')) + .toMatchInlineSnapshot(` + "module.exports = [ + { + files: ['*.ts'], + rules: { 'no-unused-vars': 'error' }, + }, + { + files: ['**/*.ts'], + rules: { + '@angular-eslint/directive-selector': [ + 'error', + { + type: 'attribute', + prefix: 'app', + style: 'camelCase', + }, + ], + '@angular-eslint/prefer-standalone': 'off', + }, + }, + ]; + " + `); + }); + + it('should disable @angular-eslint/prefer-standalone in an existing override for ts files', async () => { + tree.write('eslint.config.js', 'module.exports = [];'); + tree.write( + 'apps/app1/eslint.config.js', + `module.exports = [ + { + files: ['*.ts'], + rules: { 'no-unused-vars': 'error' }, + }, + ]; + ` + ); + + await migration(tree); + + expect(tree.read('apps/app1/eslint.config.js', 'utf8')) + .toMatchInlineSnapshot(` + "module.exports = [ + { + files: ['**/*.ts'], + rules: { + 'no-unused-vars': 'error', + '@angular-eslint/prefer-standalone': 'off', + }, + }, + ]; + " + `); + }); + + it('should disable @angular-eslint/prefer-standalone in a new override', async () => { + tree.write('eslint.config.js', 'module.exports = [];'); + tree.write( + 'apps/app1/eslint.config.js', + `module.exports = [ + { + files: ['*.html'], + rules: { 'some-rule-for-html': 'error' }, + }, + ]; + ` + ); + + await migration(tree); + + expect(tree.read('apps/app1/eslint.config.js', 'utf8')) + .toMatchInlineSnapshot(` + "module.exports = [ + { + files: ['*.html'], + rules: { 'some-rule-for-html': 'error' }, + }, + { + files: ['**/*.ts'], + rules: { + '@angular-eslint/prefer-standalone': 'off', + }, + }, + ]; + " + `); + }); + +}); +}); diff --git a/packages/angular/src/migrations/update-20-2-0/migrate-mf-imports-to-new-package.md b/packages/angular/src/migrations/update-20-2-0/migrate-mf-imports-to-new-package.md new file mode 100644 index 0000000000..56281358b2 --- /dev/null +++ b/packages/angular/src/migrations/update-20-2-0/migrate-mf-imports-to-new-package.md @@ -0,0 +1,24 @@ +#### Migrate Module Federation Imports to New Package + +Update the ModuleFederationConfig imports to use @nx/module-federation. + +#### Sample Code Changes + +Update import paths for ModuleFederationConfig. + +{% tabs %} +{% tab label="Before" %} + +```js {% fileName="apps/shell/webpack.config.js" %} +import { ModuleFederationConfig } from '@nx/webpack'; +``` + +{% /tab %} +{% tab label="After" %} + +```js {% fileName="apps/shell/webpack.config.js" %} +import { ModuleFederationConfig } from '@nx/module-federation'; +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/angular/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.md b/packages/angular/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.md new file mode 100644 index 0000000000..072eba03b2 --- /dev/null +++ b/packages/angular/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.md @@ -0,0 +1,30 @@ +#### Migrate withModuleFederation Import to New Package + +Update the withModuleFederation import to use @nx/module-federation/webpack. + +#### Sample Code Changes + +Update import paths for `withModuleFederation` and `withModuleFederationForSSR`. + +{% tabs %} +{% tab label="Before" %} + +```ts {% fileName="apps/shell/webpack.config.ts" %} +import { + withModuleFederation, + withModuleFederationForSSR, +} from '@nx/angular/module-federation'; +``` + +{% /tab %} +{% tab label="After" %} + +```ts {% fileName="apps/shell/webpack.config.ts" %} +import { + withModuleFederation, + withModuleFederationForSSR, +} from '@nx/module-federation/angular'; +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/angular/src/migrations/update-20-2-0/remove-angular-eslint-rules.md b/packages/angular/src/migrations/update-20-2-0/remove-angular-eslint-rules.md new file mode 100644 index 0000000000..c25117e1c7 --- /dev/null +++ b/packages/angular/src/migrations/update-20-2-0/remove-angular-eslint-rules.md @@ -0,0 +1,42 @@ +#### Remove Angular ESLint Rules + +Remove Angular ESLint rules that were removed in v19.0.0. + +#### Sample Code Changes + +Removes `@angular-eslint/no-host-metadata-property`, `@angular-eslint/sort-ngmodule-metadata-arrays` and `@angular-eslint/prefer-standalone-component` from any ESLint config file. Files to be searched include `.eslintrc.json`, `.eslintrc.base.json`, `.eslint.config.js` and `.eslint.config.base.js`. + +{% tabs %} +{% tab label="Before" %} + +```json {% fileName="apps/app1/.eslintrc.json" %} +{ + "overrides": [ + { + "files": ["*.ts"], + "rules": { + "@angular-eslint/no-host-metadata-property": ["error"], + "@angular-eslint/sort-ngmodule-metadata-arrays": ["error"], + "@angular-eslint/prefer-standalone-component": ["error"] + } + } + ] +} +``` + +{% /tab %} +{% tab label="After" %} + +```json {% fileName="apps/app1/.eslintrc.json" %} +{ + "overrides": [ + { + "files": ["*.ts"], + "rules": {} + } + ] +} +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/angular/src/migrations/update-20-2-0/remove-tailwind-config-from-ng-packagr-executors.md b/packages/angular/src/migrations/update-20-2-0/remove-tailwind-config-from-ng-packagr-executors.md new file mode 100644 index 0000000000..1a183e3eae --- /dev/null +++ b/packages/angular/src/migrations/update-20-2-0/remove-tailwind-config-from-ng-packagr-executors.md @@ -0,0 +1,79 @@ +#### Remove tailwindConfig from ng-packagr Executors + +Remove the deprecated 'tailwindConfig' option from ng-packagr executors. Tailwind CSS configurations located at the project or workspace root will be picked up automatically. + +#### Sample Code Changes + +Remove `tailwindConfig` from the `@nx/angular:ng-packagr-lite` or `@nx/angular:package` executor options in project configuration. + +{% tabs %} +{% tab label="Before" %} + +```json {% fileName="libs/my-lib/project.json" %} +{ + "targets": { + "build": { + "executor": "@nx/angular:ng-packagr-lite", + "options": { + "project": "libs/lib1/ng-package.json", + "tailwindConfig": "libs/lib1/tailwind.config.js" + } + } + } +} +``` + +{% /tab %} +{% tab label="After" %} + +```json {% fileName="libs/my-lib/project.json" %} +{ + "targets": { + "build": { + "executor": "@nx/angular:ng-packagr-lite", + "options": { + "project": "libs/lib1/ng-package.json" + } + } + } +} +``` + +{% /tab %} +{% /tabs %} + +Remove `tailwindConfig` from the `@nx/angular:ng-packagr-lite` or `@nx/angular:package` executor target defaults in `nx.json`. + +{% tabs %} +{% tab label="Before" %} + +```json {% fileName="nx.json" %} +{ + "targetDefaults": { + "@nx/angular:ng-packagr-lite": { + "options": { + "project": "{projectRoot}/ng-package.json", + "tailwindConfig": "{projectRoot}/tailwind.config.js" + } + } + } +} +``` + +{% /tab %} +{% tab label="After" %} + +```json {% fileName="nx.json" %} +{ + "targetDefaults": { + "@nx/angular:ng-packagr-lite": { + "options": { + "project": "{projectRoot}/ng-package.json" + } + } + } +} +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/angular/src/migrations/update-20-2-0/update-angular-cli.md b/packages/angular/src/migrations/update-20-2-0/update-angular-cli.md new file mode 100644 index 0000000000..ec99b17983 --- /dev/null +++ b/packages/angular/src/migrations/update-20-2-0/update-angular-cli.md @@ -0,0 +1,59 @@ +#### Update `@angular/cli` to `~19.0.0` + +Update the version of the Angular CLI if it is specified in `package.json` + +#### Sample Code Changes + +Update in `devDependencies`: + +{% tabs %} +{% tab label="Before" %} + +```{% fileName="package.json" %} +{ + "devDependencies": { + "@angular/cli": "~13.3.0" + } +} +``` + +{% /tab %} +{% tab label="After" %} + +```{% fileName="package.json" %} +{ + "devDependencies": { + "@angular/cli": "~19.0.0" + } +} +``` + +{% /tab %} +{% /tabs %} + +Update in `dependencies`: + +{% tabs %} +{% tab label="Before" %} + +```{% fileName="package.json" %} +{ + "dependencies": { + "@angular/cli": "~13.3.0" + } +} +``` + +{% /tab %} +{% tab label="After" %} + +```{% fileName="package.json" %} +{ + "dependencies": { + "@angular/cli": "~19.0.0" + } +} +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/angular/src/migrations/update-20-2-0/update-angular-ssr-imports-to-use-node-entry-point.md b/packages/angular/src/migrations/update-20-2-0/update-angular-ssr-imports-to-use-node-entry-point.md new file mode 100644 index 0000000000..204a1b4244 --- /dev/null +++ b/packages/angular/src/migrations/update-20-2-0/update-angular-ssr-imports-to-use-node-entry-point.md @@ -0,0 +1,32 @@ +#### Update Angular SSR Imports to Use Node Entry Point + +Update '@angular/ssr' import paths to use the new '/node' entry point when 'CommonEngine' is detected. + +#### Sample Code Changes + +Update import paths for SSR CommonEngine properties to use `@angular/ssr/node`. + +{% tabs %} +{% tab label="Before" %} + +```ts {% fileName="apps/app1/server.ts" %} +import { CommonEngine } from '@angular/ssr'; +import type { + CommonEngineOptions, + CommonEngineRenderOptions, +} from '@angular/ssr'; +``` + +{% /tab %} +{% tab label="After" %} + +```ts {% fileName="apps/app1/server.ts" %} +import { CommonEngine } from '@angular/ssr/node'; +import type { + CommonEngineOptions, + CommonEngineRenderOptions, +} from '@angular/ssr/node'; +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/angular/src/migrations/update-20-3-0/ensure-nx-module-federation-package.md b/packages/angular/src/migrations/update-20-3-0/ensure-nx-module-federation-package.md new file mode 100644 index 0000000000..f88709f9e7 --- /dev/null +++ b/packages/angular/src/migrations/update-20-3-0/ensure-nx-module-federation-package.md @@ -0,0 +1,28 @@ +#### Ensure the @nx/module-federation Package is Installed + +If workspace includes Module Federation projects, ensure the new `@nx/module-federation` package is installed. + +#### Sample Code Changes + +{% tabs %} +{% tab label="Before" %} + +```json {% fileName="package.json" %} +{ + "dependencies": {} +} +``` + +{% /tab %} +{% tab label="After" %} + +```json {% fileName="package.json" %} +{ + "dependencies": { + "@nx/module-federation": "20.3.0" + } +} +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/angular/src/migrations/update-20-4-0/update-angular-cli.md b/packages/angular/src/migrations/update-20-4-0/update-angular-cli.md new file mode 100644 index 0000000000..11ff4b8d75 --- /dev/null +++ b/packages/angular/src/migrations/update-20-4-0/update-angular-cli.md @@ -0,0 +1,59 @@ +#### Update `@angular/cli` to `~19.1.0` + +Update the version of the Angular CLI if it is specified in `package.json` + +#### Sample Code Changes + +Update in `devDependencies`: + +{% tabs %} +{% tab label="Before" %} + +```{% fileName="package.json" %} +{ + "devDependencies": { + "@angular/cli": "~13.3.0" + } +} +``` + +{% /tab %} +{% tab label="After" %} + +```{% fileName="package.json" %} +{ + "devDependencies": { + "@angular/cli": "~19.1.0" + } +} +``` + +{% /tab %} +{% /tabs %} + +Update in `dependencies`: + +{% tabs %} +{% tab label="Before" %} + +```{% fileName="package.json" %} +{ + "dependencies": { + "@angular/cli": "~13.3.0" + } +} +``` + +{% /tab %} +{% tab label="After" %} + +```{% fileName="package.json" %} +{ + "dependencies": { + "@angular/cli": "~19.1.0" + } +} +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/eslint/src/migrations/update-20-2-0/update-typescript-eslint-v8-13-0.md b/packages/eslint/src/migrations/update-20-2-0/update-typescript-eslint-v8-13-0.md new file mode 100644 index 0000000000..7bdbd2f5a3 --- /dev/null +++ b/packages/eslint/src/migrations/update-20-2-0/update-typescript-eslint-v8-13-0.md @@ -0,0 +1,38 @@ +#### Update TypeScript ESLint to v8.13.0 + +Update TypeScript ESLint packages to v8.13.0 if they are already on v8 + +#### Sample Code Changes + +This migration will update `typescript-eslint`, `@typescript-eslint/eslint-plugin`, `@typescript-eslint/parser` and `@typescript-eslint/utils` to `8.13.0` if they are between version `8.0.0` and `8.13.0`. + +{% tabs %} +{% tab label="Before" %} + +```json {% fileName="package.json" %} +{ + "devDependencies": { + "typescript-eslint": "^8.0.0", + "@typescript-eslint/eslint-plugin": "^8.0.0", + "@typescript-eslint/parser": "^8.0.0", + "@typescript-eslint/utils": "^8.0.0" + } +} +``` + +{% /tab %} +{% tab label="After" %} + +```json {% fileName="package.json" %} +{ + "devDependencies": { + "typescript-eslint": "^8.13.0", + "@typescript-eslint/eslint-plugin": "^8.13.0", + "@typescript-eslint/parser": "^8.13.0", + "@typescript-eslint/utils": "^8.13.0" + } +} +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/eslint/src/migrations/update-20-3-0/add-file-extensions-to-overrides.md b/packages/eslint/src/migrations/update-20-3-0/add-file-extensions-to-overrides.md new file mode 100644 index 0000000000..3cf95f1d89 --- /dev/null +++ b/packages/eslint/src/migrations/update-20-3-0/add-file-extensions-to-overrides.md @@ -0,0 +1,88 @@ +#### Update ESLint Config File Extensions in Overrides + +Update ESLint flat config to include .cjs, .mjs, .cts, and .mts files in overrides (if needed) + +#### Sample Code Changes + +Add `.cjs`, `.mjs`, `.cts`, `.mts` file extensions to overrides converted using `convert-to-flat-config` + +{% tabs %} +{% tab label="Before" %} + +```js {% fileName="eslint.config.js" %} +const { FlatCompat } = require('@eslint/eslintrc'); +const js = require('@eslint/js'); +const nxEslintPlugin = require('@nx/eslint-plugin'); + +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, +}); + +module.exports = [ + ...compat + .config({ + extends: ['plugin:@nx/typescript'], + }) + .map((config) => ({ + ...config, + files: ['**/*.ts', '**/*.tsx'], + rules: { + ...config.rules, + }, + })), + ...compat + .config({ + extends: ['plugin:@nx/javascript'], + }) + .map((config) => ({ + ...config, + files: ['**/*.js', '**/*.jsx'], + rules: { + ...config.rules, + }, + })), +]; +``` + +{% /tab %} +{% tab label="After" %} + +```js {% highlightLines=[17,28] fileName="eslint.config.js" %} +const { FlatCompat } = require('@eslint/eslintrc'); +const js = require('@eslint/js'); +const nxEslintPlugin = require('@nx/eslint-plugin'); + +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, +}); + +module.exports = [ + ...compat + .config({ + extends: ['plugin:@nx/typescript'], + }) + .map((config) => ({ + ...config, + files: ['**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts'], + rules: { + ...config.rules, + }, + })), + ...compat + .config({ + extends: ['plugin:@nx/javascript'], + }) + .map((config) => ({ + ...config, + files: ['**/*.js', '**/*.jsx', '**/*.cjs', '**/*.mjs'], + rules: { + ...config.rules, + }, + })), +]; +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/gradle/src/migrations/20-2-0/add-include-subprojects-tasks.md b/packages/gradle/src/migrations/20-2-0/add-include-subprojects-tasks.md new file mode 100644 index 0000000000..b6ddf6d0e5 --- /dev/null +++ b/packages/gradle/src/migrations/20-2-0/add-include-subprojects-tasks.md @@ -0,0 +1,35 @@ +#### Add includeSubprojectsTasks to build.gradle File + +Add includeSubprojectsTasks to build.gradle file + +#### Sample Code Changes + +Update import paths for `withModuleFederation` and `withModuleFederationForSSR`. + +{% tabs %} +{% tab label="Before" %} + +```json {% fileName="nx.json" %} +{ + "plugins": ["@nx/gradle"] +} +``` + +{% /tab %} +{% tab label="After" %} + +```json {% highlightLines=[5] fileName="nx.json" %} +{ + "plugins": [ + { + "options": { + "includeSubprojectsTasks": true + }, + "plugin": "@nx/gradle" + } + ] +} +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/jest/src/migrations/update-20-0-0/replace-getJestProjects-with-getJestProjectsAsync.md b/packages/jest/src/migrations/update-20-0-0/replace-getJestProjects-with-getJestProjectsAsync.md new file mode 100644 index 0000000000..5f05e4609a --- /dev/null +++ b/packages/jest/src/migrations/update-20-0-0/replace-getJestProjects-with-getJestProjectsAsync.md @@ -0,0 +1,30 @@ +#### Replace getJestProjects with getJestProjectsAsync + +Replace getJestProjects with getJestProjectsAsync + +#### Sample Code Changes + +{% tabs %} +{% tab label="Before" %} + +```ts {% fileName="jest.config.ts" %} +import { getJestProjects } from '@nx/jest'; + +export default { + projects: getJestProjects(), +}; +``` + +{% /tab %} +{% tab label="After" %} + +```ts {% fileName="jest.config.ts" %} +import { getJestProjectsAsync } from '@nx/jest'; + +export default async () => ({ + projects: await getJestProjectsAsync(), +}); +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/nx/src/migrations/update-20-0-0/move-use-daemon-process.md b/packages/nx/src/migrations/update-20-0-0/move-use-daemon-process.md new file mode 100644 index 0000000000..0ef7a8b52d --- /dev/null +++ b/packages/nx/src/migrations/update-20-0-0/move-use-daemon-process.md @@ -0,0 +1,32 @@ +#### Move useDaemonProcess + +Move the `useDaemonProcess` to the root of `nx.json` + +#### Sample Code Changes + +{% tabs %} +{% tab label="Before" %} + +```json {% fileName="nx.json" %} +{ + "tasksRunnerOptions": { + "default": { + "options": { + "useDaemonProcess": false + } + } + } +} +``` + +{% /tab %} +{% tab label="After" %} + +```json {% fileName="nx.json" %} +{ + "useDaemonProcess": false +} +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/nx/src/migrations/update-20-0-1/use-legacy-cache.md b/packages/nx/src/migrations/update-20-0-1/use-legacy-cache.md new file mode 100644 index 0000000000..08b3d7840f --- /dev/null +++ b/packages/nx/src/migrations/update-20-0-1/use-legacy-cache.md @@ -0,0 +1,29 @@ +#### Use Legacy Cache + +Set `useLegacyCache` to true for migrating workspaces + +#### Sample Code Changes + +Add `useLegacyCache` to `nx.json` unless `enableDbCache` was set to true. + +{% tabs %} +{% tab label="Before" %} + +```json {% fileName="nx.json" %} +{ + "targetDefaults": {} +} +``` + +{% /tab %} +{% tab label="After" %} + +```json {% fileName="nx.json" %} +{ + "targetDefaults": {}, + "useLegacyCache": true +} +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/react/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.md b/packages/react/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.md new file mode 100644 index 0000000000..700a897b9b --- /dev/null +++ b/packages/react/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.md @@ -0,0 +1,41 @@ +#### Add Module Federation Env Var to Target Defaults + +Add NX_MF_DEV_REMOTES to inputs for task hashing when `@nx/webpack:webpack` or `@nx/rspack:rspack` is used for Module Federation. + +#### Sample Code Changes + +{% tabs %} +{% tab label="Before" %} + +```json {% fileName="nx.json" %} +{ + "targetDefaults": { + "@nx/webpack:webpack": { + "inputs": ["^build"] + } + } +} +``` + +{% /tab %} +{% tab label="After" %} + +```json {% highlightLines=[4,5,6] fileName="nx.json" %} +{ + "targetDefaults": { + "@nx/webpack:webpack": { + "cache": true, + "dependsOn": ["^build"], + "inputs": [ + "^build", + { + "env": "NX_MF_DEV_REMOTES" + } + ] + } + } +} +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/react/src/migrations/update-20-2-0/migrate-mf-imports-to-new-package.md b/packages/react/src/migrations/update-20-2-0/migrate-mf-imports-to-new-package.md new file mode 100644 index 0000000000..35eb42c621 --- /dev/null +++ b/packages/react/src/migrations/update-20-2-0/migrate-mf-imports-to-new-package.md @@ -0,0 +1,32 @@ +#### Migrate Module Federation Imports to New Package + +Update the ModuleFederationConfig imports to use @nx/module-federation. + +#### Sample Code Changes + +Update import paths for ModuleFederationConfig. + +{% tabs %} +{% tab label="Before" %} + +```js {% fileName="apps/shell/webpack.config.js" %} +import { ModuleFederationConfig } from '@nx/webpack'; +``` + +```js {% fileName="apps/shell/rspack.config.js" %} +import { ModuleFederationConfig } from '@nx/rspack/module-federation'; +``` + +{% /tab %} +{% tab label="After" %} + +```js {% fileName="apps/shell/webpack.config.js" %} +import { ModuleFederationConfig } from '@nx/module-federation'; +``` + +```js {% fileName="apps/shell/rspack.config.js" %} +import { ModuleFederationConfig } from '@nx/module-federation'; +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/react/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.md b/packages/react/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.md new file mode 100644 index 0000000000..0ba58b9e6e --- /dev/null +++ b/packages/react/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.md @@ -0,0 +1,30 @@ +#### Migrate withModuleFederation Import to New Package + +Update the withModuleFederation import to use @nx/module-federation/webpack. + +#### Sample Code Changes + +Update import paths for `withModuleFederation` and `withModuleFederationForSSR`. + +{% tabs %} +{% tab label="Before" %} + +```ts {% fileName="apps/shell/webpack.config.ts" %} +import { + withModuleFederation, + withModuleFederationForSSR, +} from '@nx/react/module-federation'; +``` + +{% /tab %} +{% tab label="After" %} + +```ts {% fileName="apps/shell/webpack.config.ts" %} +import { + withModuleFederation, + withModuleFederationForSSR, +} from '@nx/module-federation/webpack'; +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/react/src/migrations/update-20-3-0/ensure-nx-module-federation-package.md b/packages/react/src/migrations/update-20-3-0/ensure-nx-module-federation-package.md new file mode 100644 index 0000000000..f88709f9e7 --- /dev/null +++ b/packages/react/src/migrations/update-20-3-0/ensure-nx-module-federation-package.md @@ -0,0 +1,28 @@ +#### Ensure the @nx/module-federation Package is Installed + +If workspace includes Module Federation projects, ensure the new `@nx/module-federation` package is installed. + +#### Sample Code Changes + +{% tabs %} +{% tab label="Before" %} + +```json {% fileName="package.json" %} +{ + "dependencies": {} +} +``` + +{% /tab %} +{% tab label="After" %} + +```json {% fileName="package.json" %} +{ + "dependencies": { + "@nx/module-federation": "20.3.0" + } +} +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/rspack/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.md b/packages/rspack/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.md new file mode 100644 index 0000000000..317f96a9d9 --- /dev/null +++ b/packages/rspack/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.md @@ -0,0 +1,30 @@ +#### Migrate withModuleFederation Import to New Package + +Update the withModuleFederation import to use @nx/module-federation/rspack. + +#### Sample Code Changes + +Update import paths for `withModuleFederation` and `withModuleFederationForSSR`. + +{% tabs %} +{% tab label="Before" %} + +```ts {% fileName="apps/shell/rspack.config.ts" %} +import { + withModuleFederation, + withModuleFederationForSSR, +} from '@nx/rspack/module-federation'; +``` + +{% /tab %} +{% tab label="After" %} + +```ts {% fileName="apps/shell/rspack.config.ts" %} +import { + withModuleFederation, + withModuleFederationForSSR, +} from '@nx/module-federation/rspack'; +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/rspack/src/migrations/update-20-3-0/ensure-nx-module-federation-package.md b/packages/rspack/src/migrations/update-20-3-0/ensure-nx-module-federation-package.md new file mode 100644 index 0000000000..f88709f9e7 --- /dev/null +++ b/packages/rspack/src/migrations/update-20-3-0/ensure-nx-module-federation-package.md @@ -0,0 +1,28 @@ +#### Ensure the @nx/module-federation Package is Installed + +If workspace includes Module Federation projects, ensure the new `@nx/module-federation` package is installed. + +#### Sample Code Changes + +{% tabs %} +{% tab label="Before" %} + +```json {% fileName="package.json" %} +{ + "dependencies": {} +} +``` + +{% /tab %} +{% tab label="After" %} + +```json {% fileName="package.json" %} +{ + "dependencies": { + "@nx/module-federation": "20.3.0" + } +} +``` + +{% /tab %} +{% /tabs %} diff --git a/packages/vite/src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore.md b/packages/vite/src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore.md new file mode 100644 index 0000000000..fa2cde3527 --- /dev/null +++ b/packages/vite/src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore.md @@ -0,0 +1,12 @@ +#### Add Vite Temp Files to Git Ignore + +Add gitignore entry for temporary vite config files. + +#### Sample Code Changes + +Adds the following entries to the `.gitignore` file. + +```text {% fileName=".gitignore" %} +vite.config.*.timestamp* +vitest.config.*.timestamp* +``` diff --git a/packages/vite/src/migrations/update-20-3-0/add-vitest-temp-files-to-git-ignore.md b/packages/vite/src/migrations/update-20-3-0/add-vitest-temp-files-to-git-ignore.md new file mode 100644 index 0000000000..a52bf71e6c --- /dev/null +++ b/packages/vite/src/migrations/update-20-3-0/add-vitest-temp-files-to-git-ignore.md @@ -0,0 +1,12 @@ +#### Add Vitest Temp Files to Git Ignore + +Add gitignore entry for temporary vitest config files. + +#### Sample Code Changes + +Adds the following entries to the `.gitignore` file. + +```text {% fileName=".gitignore" %} +vite.config.*.timestamp* +vitest.config.*.timestamp* +```