From c764a62060acfdf88224b9a79565e7a8a0adff1a Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 10 Jun 2024 21:13:51 +0400 Subject: [PATCH] fix(release): false positive npm dist-tag add (#26494) --- .../src/executors/release-publish/release-publish.impl.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/js/src/executors/release-publish/release-publish.impl.ts b/packages/js/src/executors/release-publish/release-publish.impl.ts index a15f813b9a7150..91c3b08b38109e 100644 --- a/packages/js/src/executors/release-publish/release-publish.impl.ts +++ b/packages/js/src/executors/release-publish/release-publish.impl.ts @@ -110,7 +110,12 @@ export default async function runExecutor( }; } - if (resultJson.versions.includes(currentVersion)) { + // If only one version of a package exists in the registry, versions will be a string instead of an array. + const versions = Array.isArray(resultJson.versions) + ? resultJson.versions + : [resultJson.versions]; + + if (versions.includes(currentVersion)) { try { if (!isDryRun) { execSync(npmDistTagAddCommandSegments.join(' '), {