-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
param ( | ||
[Parameter(mandatory = $true)] | ||
$originalDistTags, | ||
[Parameter(mandatory = $true)] | ||
$intendedTag, | ||
[Parameter(mandatory = $true)] | ||
$intendedTagVersion, | ||
[Parameter(mandatory = $true)] | ||
$packageJson | ||
) | ||
|
||
# TODO: delete testing comments below | ||
#'@azure/eventhubs-checkpointstore-table' alpha, no beta, no GA | ||
#'@azure/openai' alpha, beta, no GA | ||
#'@azure/video-indexer-widgets' no alpha, no beta, GA | ||
#'@azure/template' alpha, beta, GA | ||
#$pkgProps.PackageId | ||
|
||
$ErrorActionPreference = 'Stop' | ||
$PSNativeCommandUseErrorActionPreference = $true | ||
|
||
$pkg = Get-Content -Raw $packageJson | ConvertFrom-Json | ||
$packageName = $pkg.Name | ||
|
||
Write-Host "Verify npm tag versions for package $packageName" | ||
|
||
$parsedOriginalDistTags = $originalDistTags | ConvertFrom-Json | ||
|
||
$npmPkgProp = npm view $packageName --json | ConvertFrom-Json | ||
$packageDistTags = $npmPkgProp."dist-tags" | ||
Write-Host "Current dist-tag: $packageDistTags" | ||
|
||
Write-Host "parsedOriginalDistTags: $parsedOriginalDistTags" | ||
Write-Host "packageDistTags: $packageDistTags" | ||
Write-Host "intendedTag: $($packageDistTags."$intendedTag")" | ||
Write-Host "intendedTagVersion: $intendedTagVersion" | ||
|
||
if ($packageDistTags."$intendedTag" -ne $intendedTagVersion) { | ||
Write-Warning "Tag not correctly set, current $intendedTag tag is version $($packageDistTags."$intendedTag") instead of $intendedTagVersion." | ||
$correctDistTags = $parsedOriginalDistTags | ||
$correctDistTags."$intendedTag" = $intendedTagVersion | ||
foreach($tag in $correctDistTags.PSObject.Properties) { | ||
Write-Host "npm dist-tag add $packageName@$($tag.value) $tag.Name" | ||
npm dist-tag add $packageName@$tag.value $tag.Name | ||
} | ||
$npmPkgProp = npm view $packageName --json | ConvertFrom-Json | ||
$packageDistTags = $npmPkgProp."dist-tags" | ||
Write-Host "Corrected dist tags to: $packageDistTags" | ||
} |