From db0aa1528889d374c5ee7ccd0e9948fbf9147b2a Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Thu, 3 Dec 2020 14:35:37 -0800 Subject: [PATCH 1/5] Add function for retrieving existing versions of packages --- eng/scripts/Language-Settings.ps1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index e756134691dc..d32b95fda5be 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -241,3 +241,19 @@ function SetPackageVersion ($PackageName, $Version, $ServiceDirectory = $null, $ node ./set-version.js --artifact-name $PackageName --new-version $Version --release-date $ReleaseDate --repo-root $RepoRoot Pop-Location } + +# PackageName: Pass full pacjkage name e.g. @azure/abort-controller +# You can obtain full pacakge name using the 'Get-PkgProperties' function in 'eng\common\scripts\Package-Properties.Ps1' +function GetExistingPackageVersions ($PackageName, $GroupId = $null) +{ + try + { + $existingVersion = Invoke-RestMethod -Method GET -Uri "http://registry.npmjs.com/${PackageName}" + return ($existingVersion.versions | Get-Member -MemberType NoteProperty).Name + } + catch + { + LogError "Failed to retieve package versions. `n$_" + return $null + } +} From a8d215a79864ceb4453a177b5781303d1f80016a Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Fri, 4 Dec 2020 14:17:02 -0800 Subject: [PATCH 2/5] Add SetPackageVersion function --- eng/scripts/Language-Settings.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index d32b95fda5be..cbdba1b5eb95 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -257,3 +257,12 @@ function GetExistingPackageVersions ($PackageName, $GroupId = $null) return $null } } + +function SetPackageVersion ($PackageName, $Version, $ServiceName, $ReleaseDate) { + if($null -eq $ReleaseDate) + { + $ReleaseDate = Get-Date -Format "yyyy-MM-dd" + } + pip install -r "$EngDir/versioning/requirements.txt" -q -I + python "$EngDir/versioning/version_set.py" --package-name $PackageName --new-version $Version --service $ServiceName --release-date $ReleaseDate +} From 87b557ba7de45f96705c87b7b547e4b821bd0fa2 Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Fri, 4 Dec 2020 15:43:59 -0800 Subject: [PATCH 3/5] Update versioning tools --- eng/scripts/Language-Settings.ps1 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index cbdba1b5eb95..7fe9f71a565f 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -258,11 +258,14 @@ function GetExistingPackageVersions ($PackageName, $GroupId = $null) } } -function SetPackageVersion ($PackageName, $Version, $ServiceName, $ReleaseDate) { - if($null -eq $ReleaseDate) +function SetPackageVersion ($PackageName, $Version, $ServiceName = $null, $ReleaseDate, $BuildType = $null, $GroupName = $null) +{ + if ($null -eq $ReleaseDate) { $ReleaseDate = Get-Date -Format "yyyy-MM-dd" } - pip install -r "$EngDir/versioning/requirements.txt" -q -I - python "$EngDir/versioning/version_set.py" --package-name $PackageName --new-version $Version --service $ServiceName --release-date $ReleaseDate + Push-Location "$EngDir/tools/versioning" + npm install + node ./set-version.js --artifact-name $PackageName --new-version $Version --release-date $ReleaseDate --repo-root $RepoRoot + Pop-Location } From 4970733fd177c1772fc09f8278556c73f4b362da Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Mon, 7 Dec 2020 15:53:30 -0800 Subject: [PATCH 4/5] Add GetPackageInstallNotes function --- eng/scripts/Language-Settings.ps1 | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index 7fe9f71a565f..8ebc6d1a35ac 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -253,19 +253,7 @@ function GetExistingPackageVersions ($PackageName, $GroupId = $null) } catch { - LogError "Failed to retieve package versions. `n$_" + LogError "Failed to retrieve package versions. `n$_" return $null } } - -function SetPackageVersion ($PackageName, $Version, $ServiceName = $null, $ReleaseDate, $BuildType = $null, $GroupName = $null) -{ - if ($null -eq $ReleaseDate) - { - $ReleaseDate = Get-Date -Format "yyyy-MM-dd" - } - Push-Location "$EngDir/tools/versioning" - npm install - node ./set-version.js --artifact-name $PackageName --new-version $Version --release-date $ReleaseDate --repo-root $RepoRoot - Pop-Location -} From 159d5f19d1a254df37dcbf7d7c31b909eb611d18 Mon Sep 17 00:00:00 2001 From: Wes Haggard Date: Tue, 26 Jan 2021 14:31:51 -0800 Subject: [PATCH 5/5] Update eng/scripts/Language-Settings.ps1 --- eng/scripts/Language-Settings.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index 8ebc6d1a35ac..b35407cce65e 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -242,7 +242,7 @@ function SetPackageVersion ($PackageName, $Version, $ServiceDirectory = $null, $ Pop-Location } -# PackageName: Pass full pacjkage name e.g. @azure/abort-controller +# PackageName: Pass full package name e.g. @azure/abort-controller # You can obtain full pacakge name using the 'Get-PkgProperties' function in 'eng\common\scripts\Package-Properties.Ps1' function GetExistingPackageVersions ($PackageName, $GroupId = $null) {