File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88DIR=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd )
99ROOT_DIR=$DIR /..
1010
11- updateAwsCdk () {
12- # `npx` to avoid a devDependency (and the Dependabot PRs)
11+ updateDependency () {
12+ DEPENDENCY_NAME=$1
13+
14+ echo " Updating $DEPENDENCY_NAME (if available)"
15+
16+ # `npx` to avoid a devDependency (and the Dependabot PRs).
1317 # See https://www.npmjs.com/package/npm-check-updates
14- npx npm-check-updates@16.3.25 " aws-cdk-lib" " aws-cdk" " constructs" --upgrade --deep --target minor
18+ npx npm-check-updates " $DEPENDENCY_NAME " --upgrade --deep --target minor
19+
20+ FILE=package.json
21+ TMP_FILE=package.json.tmp
22+
23+ NEW_VERSION=$( jq -r " .devDependencies.\" ${DEPENDENCY_NAME} \" " < " $ROOT_DIR /$FILE " )
24+
25+ # Peer dependencies describe the version clients need.
26+ # The ^ allows them to use a matching or higher minor/patch version.
27+ # The means clients can use Dependabot.
28+ NEW_PEER_VERSION=" ^${NEW_VERSION} "
29+
30+ # Synchronise the version within peerDependencies in package.json.
31+ # As jq doesn't support in-place editing, write to a temp file and move it back.
32+ jq " .peerDependencies.\" ${DEPENDENCY_NAME} \" |= \" ${NEW_PEER_VERSION} \" " $FILE > $TMP_FILE && mv $TMP_FILE $FILE
33+ }
34+
35+ updateAwsCdk () {
36+ updateDependency aws-cdk
37+ updateDependency aws-cdk-lib
38+ updateDependency constructs
1539
1640 # Deliberately NOT `npm ci` as we're going to raise a PR with the resulting changes to package-lock.json
1741 # --ignore-scripts for speed
You can’t perform that action at this time.
0 commit comments