From df15b0f3d160e6a1b45e3db6a17991b705b8468f Mon Sep 17 00:00:00 2001 From: Mitchell Valine Date: Fri, 17 Apr 2020 17:03:00 -0700 Subject: [PATCH] fix(jsii-pacmak): invalid dotnet version suffixes (#1568) Removes version suffix from version ranges in `.csproj` files generated by jsii-pacmak. Dotnet doesn't allow version suffixes that start with a number. Version ranges by default don't include prereleases so the resolved version is as intended without the suffix in this case. --- packages/jsii-pacmak/lib/targets/version-utils.ts | 2 +- packages/jsii-pacmak/test/targets/version-utils.test.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/jsii-pacmak/lib/targets/version-utils.ts b/packages/jsii-pacmak/lib/targets/version-utils.ts index 70d2d632ae..a7a6af1b64 100644 --- a/packages/jsii-pacmak/lib/targets/version-utils.ts +++ b/packages/jsii-pacmak/lib/targets/version-utils.ts @@ -20,7 +20,7 @@ export function toMavenVersionRange(semverRange: string, suffix?: string): strin * @see https://docs.microsoft.com/en-us/nuget/concepts/package-versioning#version-ranges-and-wildcards */ export function toNuGetVersionRange(semverRange: string): string { - return toBracketNotation(semverRange); + return toBracketNotation(semverRange, undefined, { semver: false }); } /** diff --git a/packages/jsii-pacmak/test/targets/version-utils.test.ts b/packages/jsii-pacmak/test/targets/version-utils.test.ts index 99192bcda8..9b227c7303 100644 --- a/packages/jsii-pacmak/test/targets/version-utils.test.ts +++ b/packages/jsii-pacmak/test/targets/version-utils.test.ts @@ -9,12 +9,12 @@ const examples: Record }, '~1.2.3': { maven: '[1.2.3,1.3.0)', - nuget: '[1.2.3,1.3.0-0)', + nuget: '[1.2.3,1.3.0)', python: '>=1.2.3, <1.3.0', }, '^1.2.3': { maven: '[1.2.3,2.0.0)', - nuget: '[1.2.3,2.0.0-0)', + nuget: '[1.2.3,2.0.0)', python: '>=1.2.3, <2.0.0', }, @@ -26,12 +26,12 @@ const examples: Record }, '~0.1.2': { maven: '[0.1.2,0.2.0)', - nuget: '[0.1.2,0.2.0-0)', + nuget: '[0.1.2,0.2.0)', python: '>=0.1.2, <0.2.0', }, '^0.1.2': { maven: '[0.1.2,0.2.0)', - nuget: '[0.1.2,0.2.0-0)', + nuget: '[0.1.2,0.2.0)', python: '>=0.1.2, <0.2.0', },