From 3f61354cd4be008ad3413ab63277c519f6a40931 Mon Sep 17 00:00:00 2001 From: Edouard Bozon Date: Sun, 24 Mar 2024 11:11:05 +0100 Subject: [PATCH] fix(semver): handle post targets with format `project:target` --- .../semver/src/generators/migrate-nx-release/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/semver/src/generators/migrate-nx-release/index.ts b/packages/semver/src/generators/migrate-nx-release/index.ts index 787418479..8b53d11a1 100644 --- a/packages/semver/src/generators/migrate-nx-release/index.ts +++ b/packages/semver/src/generators/migrate-nx-release/index.ts @@ -122,14 +122,18 @@ function removeSemverTargets( const [versionTarget, targetConfig] = findVersionTarget(projectConfig)!; const postTargets = (targetConfig.options?.postTargets ?? []).filter( (target) => { - const executor = projectConfig.targets?.[target].executor; + // Note: we are not using parseTargetString here as we need to pass the project graph, let's keep it simple. + const targetName = target.includes(':') ? target.split(':')[1] : target; + const executor = projectConfig.targets?.[targetName].executor; return ( executor?.includes('semver') || executor?.includes('ngx-deploy-npm') || // Drop targets defined with both format: // { command: "npm publish" } // { executor: "nx:run-commands", options: { commands: "npm publish" } } - /npm publish/.test(JSON.stringify(projectConfig.targets?.[target])) || + /npm publish/.test( + JSON.stringify(projectConfig.targets?.[targetName]), + ) || false ); },