From 75a64cba121f2a0374682f837ea5a7539fb676ea Mon Sep 17 00:00:00 2001 From: George Fu Date: Wed, 15 May 2024 11:24:07 -0400 Subject: [PATCH] =?UTF-8?q?Revert=20"fix(credential-providers):=20use=20pi?= =?UTF-8?q?nned=20version=20for=20client=20peerDependen=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 20098c1f949721ad2286f47f3367a92a85877be7. --- .../update-versions/getUpdatedPackageJson.mjs | 9 ++++---- .../getUpdatedPackageJsonSection.mjs | 22 ++----------------- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/scripts/update-versions/getUpdatedPackageJson.mjs b/scripts/update-versions/getUpdatedPackageJson.mjs index 8f9e7f71bad13..83ac50855a2f0 100644 --- a/scripts/update-versions/getUpdatedPackageJson.mjs +++ b/scripts/update-versions/getUpdatedPackageJson.mjs @@ -7,10 +7,11 @@ export const getUpdatedPackageJson = (packageJson, depToVersionHash) => .reduce( (acc, sectionName) => ({ ...acc, - [sectionName]: getUpdatedPackageJsonSection(packageJson[sectionName], depToVersionHash, { - isPeer: sectionName === "peerDependencies", - packageName: packageJson.name, - }), + [sectionName]: getUpdatedPackageJsonSection( + packageJson[sectionName], + depToVersionHash, + sectionName === "peerDependencies" + ), }), packageJson ); diff --git a/scripts/update-versions/getUpdatedPackageJsonSection.mjs b/scripts/update-versions/getUpdatedPackageJsonSection.mjs index fe05f3fd70a9e..5b44503e16f53 100644 --- a/scripts/update-versions/getUpdatedPackageJsonSection.mjs +++ b/scripts/update-versions/getUpdatedPackageJsonSection.mjs @@ -1,29 +1,11 @@ // @ts-check -export const getUpdatedPackageJsonSection = (section, depToVersionHash, { isPeer, packageName }) => +export const getUpdatedPackageJsonSection = (section, depToVersionHash, isPeer = false) => Object.entries(section) .filter(([key, value]) => key.startsWith("@aws-sdk/") && !value.startsWith("file:")) .reduce((acc, [key]) => { const newVersion = depToVersionHash[key]; if (newVersion) { - // Use exact version if it's asterisk or not a peer dependency. - if (newVersion === "*" || !isPeer) { - acc[key] = newVersion; - return acc; - } - - // Use exact version for client peerDependencies in credential-provider packages. - const moduleName = packageName.substring(packageName.indexOf("/") + 1); - const authProviderPrefixArray = ["credential-provider", "token-provider"]; - if ( - authProviderPrefixArray.some((authProviderPrefix) => moduleName.startsWith(authProviderPrefix)) && - key.startsWith("@aws-sdk/client-") - ) { - acc[key] = newVersion; - return acc; - } - - // Use caret version for other peerDependencies. - acc[key] = `^${newVersion}`; + acc[key] = isPeer && newVersion !== "*" ? `^${newVersion}` : newVersion; } return acc; }, section);