Skip to content

Commit

Permalink
chore: set peer range during update:versions:default (#5748)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe authored Jan 31, 2024
1 parent 04df491 commit 1751692
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clients/client-sso-oidc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
},
"license": "Apache-2.0",
"peerDependencies": {
"@aws-sdk/credential-provider-node": "*"
"@aws-sdk/credential-provider-node": "^3.503.1"
},
"browser": {
"./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser"
Expand Down
2 changes: 1 addition & 1 deletion clients/client-sts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
},
"license": "Apache-2.0",
"peerDependencies": {
"@aws-sdk/credential-provider-node": "*"
"@aws-sdk/credential-provider-node": "^3.503.1"
},
"browser": {
"./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser"
Expand Down
2 changes: 2 additions & 0 deletions scripts/update-versions/current.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// in dependencies/devDependencies/peerDependencies

import { getDepToCurrentVersionHash } from "./getDepToCurrentVersionHash.mjs";
import { runUpdatePeers } from "./peers.mjs";
import { updateVersions } from "./updateVersions.mjs";

updateVersions(getDepToCurrentVersionHash());
runUpdatePeers();
2 changes: 2 additions & 0 deletions scripts/update-versions/default.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// in dependencies/devDependencies/peerDependencies

import { getDepToDefaultVersionHash } from "./getDepToDefaultVersionHash.mjs";
import { runUpdatePeers } from "./peers.mjs";
import { updateVersions } from "./updateVersions.mjs";

updateVersions(getDepToDefaultVersionHash());
runUpdatePeers();
17 changes: 17 additions & 0 deletions scripts/update-versions/peers.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { readFileSync } from "fs";
import { dirname, join } from "path";
import { fileURLToPath } from "url";

import { updatePeerVersions } from "./updateVersions.mjs";

const __dirname = dirname(fileURLToPath(import.meta.url));

const currentCredentialProviderNode = JSON.parse(
readFileSync(join(__dirname, "..", "..", "packages", "credential-provider-node", "package.json"), "utf-8")
);

export const runUpdatePeers = () => {
updatePeerVersions({
"@aws-sdk/credential-provider-node": `^${currentCredentialProviderNode.version}`,
});
};
15 changes: 15 additions & 0 deletions scripts/update-versions/updateVersions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,18 @@ export const updateVersions = (depToVersionHash) => {
writeFileSync(packageJsonPath, format(JSON.stringify(updatedPackageJson), { parser: "json-stringify" }));
});
};

export const updatePeerVersions = (depToVersionHash) => {
getWorkspacePaths().forEach((workspacePath) => {
const packageJsonPath = join(workspacePath, "package.json");
const packageJson = JSON.parse(readFileSync(packageJsonPath).toString());
if (packageJson.peerDependencies) {
for (const peer of Object.keys(packageJson.peerDependencies)) {
if (peer in depToVersionHash) {
packageJson.peerDependencies[peer] = depToVersionHash[peer];
}
}
}
writeFileSync(packageJsonPath, format(JSON.stringify(packageJson), { parser: "json-stringify" }));
});
};

0 comments on commit 1751692

Please sign in to comment.