Skip to content

Commit

Permalink
chore: trigger transitive releases when packages update (#83)
Browse files Browse the repository at this point in the history
For packages that include other packages, like the CLI does, it should
also include changes to bundled packages when looking at whether a
release should be triggered.

This includes `cloud-assembly-schema` and `cloudformation-diff` into the
release trigger of the CLI and all packages that include the CLI.

You'd think this could perhaps be done more declaratively, but I can't
rely on storing information on the `TypeScriptWorkSpace` project (like
"considered dependencies") because we need to pass this information to
its constructor. So I'm just copy/pasting long arrays.

---
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache-2.0 license

Co-authored-by: Momo Kornher <[email protected]>
  • Loading branch information
rix0rrr and mrgrain authored Feb 24, 2025
1 parent eeaf58b commit 55dac82
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
22 changes: 15 additions & 7 deletions .projenrc.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as path from 'path';
import { yarn, CdkCliIntegTestsWorkflow } from 'cdklabs-projen-project-types';
import * as pj from 'projen';
import { Stability } from 'projen/lib/cdk';
Expand Down Expand Up @@ -142,6 +143,14 @@ function jestOptionsForProject(options: pj.javascript.JestOptions): pj.javascrip
};
}

function transitiveFeaturesAndFixes(thisPkg: string, depPkgs: string[]) {
return pj.ReleasableCommits.featuresAndFixes([
'.',
...depPkgs.map(p => path.relative(`packages/${thisPkg}`, `packages/${p}`))
].join(' '));
}


const repoProject = new yarn.Monorepo({
projenrcTs: true,
name: 'aws-cdk-cli',
Expand Down Expand Up @@ -791,6 +800,8 @@ const cli = configureProject(

// Append a specific version string for testing
nextVersionCommand: 'tsx ../../projenrc/next-version.ts maybeRc',

releasableCommits: transitiveFeaturesAndFixes('aws-cdk', [cloudAssemblySchema.name, cloudFormationDiff.name]),
}),
);

Expand Down Expand Up @@ -923,8 +934,7 @@ const cliLib = configureProject(
devDeps: ['aws-cdk-lib', cli, 'constructs'],
disableTsconfig: true,
nextVersionCommand: `tsx ../../../projenrc/next-version.ts copyVersion:../../../${cliPackageJson} append:-alpha.0`,
// Watch 2 directories at once
releasableCommits: pj.ReleasableCommits.featuresAndFixes(`. ../../${cli.name}`),
releasableCommits: transitiveFeaturesAndFixes('@aws-cdk/cli-lib-alpha', [cli.name, cloudAssemblySchema.name, cloudFormationDiff.name]),
eslintOptions: {
dirs: ['lib'],
ignorePatterns: [
Expand Down Expand Up @@ -1081,7 +1091,7 @@ const toolkitLib = configureProject(
'typedoc',
],
// Watch 2 directories at once
releasableCommits: pj.ReleasableCommits.featuresAndFixes(`. ../../${cli.name}`),
releasableCommits: transitiveFeaturesAndFixes('@aws-cdk/toolkit-lib', [cli.name, cloudAssemblySchema.name, cloudFormationDiff.name]),
eslintOptions: {
dirs: ['lib'],
ignorePatterns: [
Expand Down Expand Up @@ -1200,8 +1210,7 @@ const cdkCliWrapper = configureProject(
srcdir: 'lib',
devDeps: ['aws-cdk-lib', cli, 'constructs', '@aws-cdk/integ-runner'],
nextVersionCommand: `tsx ../../../projenrc/next-version.ts copyVersion:../../../${cliPackageJson}`,
// Watch 2 directories at once
releasableCommits: pj.ReleasableCommits.featuresAndFixes(`. ../../${cli.name}`),
releasableCommits: transitiveFeaturesAndFixes('@aws-cdk/cdk-cli-wrapper', [cli.name, cloudAssemblySchema.name, cloudFormationDiff.name]),

jestOptions: jestOptionsForProject({
jestConfig: {
Expand Down Expand Up @@ -1231,8 +1240,7 @@ const cdkAliasPackage = configureProject(
srcdir: 'lib',
deps: [cli],
nextVersionCommand: `tsx ../../projenrc/next-version.ts copyVersion:../../${cliPackageJson}`,
// Watch 2 directories at once
releasableCommits: pj.ReleasableCommits.featuresAndFixes(`. ../${cli.name}`),
releasableCommits: transitiveFeaturesAndFixes('cdk', [cli.name, cloudAssemblySchema.name, cloudFormationDiff.name]),
}),
);
void cdkAliasPackage;
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/cli-lib-alpha/.projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/aws-cdk/.projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/cdk/.projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 55dac82

Please sign in to comment.