From f1ffa232ffa96f20d35d9569e8d633ed8d03ba13 Mon Sep 17 00:00:00 2001 From: MartyHenderson Date: Mon, 24 May 2021 15:15:08 -0500 Subject: [PATCH] fix(npm): Prevents canary releases with double dashed version numbers --- plugins/npm/src/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/npm/src/index.ts b/plugins/npm/src/index.ts index 283857019..1eaf86403 100644 --- a/plugins/npm/src/index.ts +++ b/plugins/npm/src/index.ts @@ -1005,6 +1005,9 @@ export default class NPMPlugin implements IPlugin { } }; + canaryIdentifier = canaryIdentifier.replace(/^-/, "") + + if (isMonorepo()) { const isIndependent = getLernaJson().version === "independent"; auto.logger.verbose.info("Detected monorepo, using lerna"); @@ -1054,7 +1057,7 @@ export default class NPMPlugin implements IPlugin { "--exact", "--ignore-scripts", "--preid", - canaryIdentifier.replace(/^-/, ""), + canaryIdentifier, ...verboseArgs, ]); @@ -1080,7 +1083,7 @@ export default class NPMPlugin implements IPlugin { "--no-git-tag-version", // no need to tag and commit, "--exact", // do not add ^ to canary versions, this can result in `npm i` resolving the wrong canary version ...(isIndependent - ? ["--preid", canaryIdentifier.replace(/^-/, "")] + ? ["--preid", canaryIdentifier] : []), ...verboseArgs, ]);