How to automatically manage and update CDK version with Projen?

Viewed 736

Context:

Projen is an awesome tool to generate and manage (JSII-built) AWS CDK projects.

Background:

Previously I have managed CDK dependencies with RenovateBot's group:aws-cdkMonorepo preset. This will result in RenovateBot creating a single Github Pull Request for AWS CDK depedency updates.

Question:

With Projen, one controls the CDK version in .projenrc.js:

const { AwsCdkConstructLibrary } = require('projen');

const project = new AwsCdkConstructLibrary({
  authorName: "Example",
  authorAddress: "contact@example.com",
  cdkVersion: "1.64.0",
  name: "@example/project",
  repository: "https://github.com/example/project.git",
});

project.synth();

So how can one manage that cdkVersion value with tooling such as DependaBot or RenovateBot?

Since keeping one's CDK constructs up-to-date with current CDK version is critial and with multiple CDK constructs doing it by hand will be painful.

1 Answers

The central version management depends on your requirement. If you are using a centralized construct library it is a must-have. For managing the dependencies in centrally in a single configuration, you need to add the following snippet in the .projenrc.js

cdkDependecies:[
'@aws-cdk/core'
]

Now, whenever you run projen the cdk app would be managed centrally and use the latest version.

Related