Skip to content

Commit

Permalink
Revert "fix(credential-providers): use pinned version for client peer…
Browse files Browse the repository at this point in the history
…Dependen…"

This reverts commit 20098c1.
  • Loading branch information
kuhe authored May 15, 2024
1 parent e7a5080 commit 75a64cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 deletions.
9 changes: 5 additions & 4 deletions scripts/update-versions/getUpdatedPackageJson.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
22 changes: 2 additions & 20 deletions scripts/update-versions/getUpdatedPackageJsonSection.mjs
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 75a64cb

Please sign in to comment.