From 358211540107a2bc619372dc45bc5ac8694474f3 Mon Sep 17 00:00:00 2001 From: Elizabeth Craig Date: Tue, 20 Jul 2021 13:40:08 -0700 Subject: [PATCH] sync: fix precedence of tag options --- change/beachball-321fb1a2-d8d9-431d-94e1-fa0b7408664f.json | 7 +++++++ src/commands/sync.ts | 1 - src/packageManager/listPackageVersions.ts | 6 ++++-- 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 change/beachball-321fb1a2-d8d9-431d-94e1-fa0b7408664f.json diff --git a/change/beachball-321fb1a2-d8d9-431d-94e1-fa0b7408664f.json b/change/beachball-321fb1a2-d8d9-431d-94e1-fa0b7408664f.json new file mode 100644 index 000000000..1ff54f573 --- /dev/null +++ b/change/beachball-321fb1a2-d8d9-431d-94e1-fa0b7408664f.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "sync: fix precedence of tag options", + "packageName": "beachball", + "email": "elcraig@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/src/commands/sync.ts b/src/commands/sync.ts index 10ccd074b..b4fdc0aa2 100644 --- a/src/commands/sync.ts +++ b/src/commands/sync.ts @@ -14,7 +14,6 @@ export async function sync(options: BeachballOptions) { const publishedVersions = await listPackageVersionsByTag( [...infos.values()], options.registry, - options.tag, options.token, options.authType ); diff --git a/src/packageManager/listPackageVersions.ts b/src/packageManager/listPackageVersions.ts index 0aea2b11f..219967cbb 100644 --- a/src/packageManager/listPackageVersions.ts +++ b/src/packageManager/listPackageVersions.ts @@ -23,10 +23,12 @@ export async function getNpmPackageInfo(packageName: string, registry: string, t return packageVersions[packageName]; } +/** + * List versions matching the appropriate tag for each package (based on combined CLI, package, and repo options) + */ export async function listPackageVersionsByTag( packageInfos: PackageInfo[], registry: string, - tag: string, token?: string, authType?: AuthType ) { @@ -38,7 +40,7 @@ export async function listPackageVersionsByTag( all.push( limit(async () => { const info = await getNpmPackageInfo(pkg.name, registry, token, authType); - const npmTag = tag || pkg.combinedOptions.tag || pkg.combinedOptions.defaultNpmTag; + const npmTag = pkg.combinedOptions.tag || pkg.combinedOptions.defaultNpmTag; versions[pkg.name] = info['dist-tags'] && info['dist-tags'][npmTag] ? info['dist-tags'][npmTag] : undefined; }) );