From 4be20d665669270d20fd6b841400bcd754ee652b Mon Sep 17 00:00:00 2001 From: Adel Khamatov Date: Thu, 8 Jan 2026 14:21:41 +0200 Subject: [PATCH] fix(nx-infra-plugin): normalize paths for cross-platform angular component generation --- packages/nx-infra-plugin/package.json | 2 ++ .../generate-components/angular-generator.ts | 9 ++++++--- pnpm-lock.yaml | 11 +++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/packages/nx-infra-plugin/package.json b/packages/nx-infra-plugin/package.json index 14a5e9e9c2b0..53c94ed5c72f 100644 --- a/packages/nx-infra-plugin/package.json +++ b/packages/nx-infra-plugin/package.json @@ -14,6 +14,7 @@ "dependencies": { "fs-extra": "^11.2.0", "glob": "11.1.0", + "normalize-path": "3.0.0", "rimraf": "3.0.2" }, "peerDependencies": { @@ -32,6 +33,7 @@ "@types/fs-extra": "^11.0.4", "@types/jest": "29.5.12", "@types/node": "^18.0.0", + "@types/normalize-path": "3.0.2", "prettier": "catalog:tools", "ts-jest": "29.1.3", "typescript": "4.9.5" diff --git a/packages/nx-infra-plugin/src/executors/generate-components/angular-generator.ts b/packages/nx-infra-plugin/src/executors/generate-components/angular-generator.ts index 72c838a3152b..470053ed3ef8 100644 --- a/packages/nx-infra-plugin/src/executors/generate-components/angular-generator.ts +++ b/packages/nx-infra-plugin/src/executors/generate-components/angular-generator.ts @@ -1,5 +1,6 @@ import * as path from 'path'; import { logger } from '@nx/devkit'; +import normalizePath from 'normalize-path'; import { GenerationConfig } from './framework-handlers'; export async function generateAngularComponents( @@ -24,10 +25,12 @@ export async function generateAngularComponents( AngularCommonReexportsGenerator, } = internalTools; - const componentsDir = config.out.componentsDir; - const indexFileName = config.out.indexFileName; + const componentsDir = normalizePath(config.out.componentsDir); + const indexFileName = normalizePath(config.out.indexFileName); - const metadataDir = path.join(path.dirname(componentsDir), 'metadata', 'generated'); + const metadataDir = normalizePath( + path.join(path.dirname(componentsDir), 'metadata', 'generated'), + ); logger.info('📝 Generating Angular-specific metadata...'); const metadataGenerator = new AngularMetadataGenerator(); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 07b288095cf2..092304ec8432 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2222,6 +2222,9 @@ importers: ng-packagr: specifier: '>=19.0.0' version: 19.2.2(@angular/compiler-cli@21.0.5(@angular/compiler@21.0.5)(typescript@4.9.5))(tslib@2.8.1)(typescript@4.9.5) + normalize-path: + specifier: 3.0.0 + version: 3.0.0 rimraf: specifier: 3.0.2 version: 3.0.2 @@ -2235,6 +2238,9 @@ importers: '@types/node': specifier: ^18.0.0 version: 18.19.64 + '@types/normalize-path': + specifier: 3.0.2 + version: 3.0.2 prettier: specifier: catalog:tools version: 3.5.3 @@ -7069,6 +7075,9 @@ packages: '@types/normalize-package-data@2.4.4': resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} + '@types/normalize-path@3.0.2': + resolution: {integrity: sha512-DO++toKYPaFn0Z8hQ7Tx+3iT9t77IJo/nDiqTXilgEP+kPNIYdpS9kh3fXuc53ugqwp9pxC1PVjCpV1tQDyqMA==} + '@types/pako@2.0.4': resolution: {integrity: sha512-VWDCbrLeVXJM9fihYodcLiIv0ku+AlOa/TQ1SvYOaBuyrSKgEcro95LJyIsJ4vSo6BXIxOKxiJAat04CmST9Fw==} @@ -26083,6 +26092,8 @@ snapshots: '@types/normalize-package-data@2.4.4': {} + '@types/normalize-path@3.0.2': {} + '@types/pako@2.0.4': {} '@types/parse-json@4.0.2': {}