Skip to content

Commit 55dac82

Browse files
rix0rrrmrgrain
andauthored
chore: trigger transitive releases when packages update (#83)
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]>
1 parent eeaf58b commit 55dac82

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

Diff for: .projenrc.ts

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as path from 'path';
12
import { yarn, CdkCliIntegTestsWorkflow } from 'cdklabs-projen-project-types';
23
import * as pj from 'projen';
34
import { Stability } from 'projen/lib/cdk';
@@ -142,6 +143,14 @@ function jestOptionsForProject(options: pj.javascript.JestOptions): pj.javascrip
142143
};
143144
}
144145

146+
function transitiveFeaturesAndFixes(thisPkg: string, depPkgs: string[]) {
147+
return pj.ReleasableCommits.featuresAndFixes([
148+
'.',
149+
...depPkgs.map(p => path.relative(`packages/${thisPkg}`, `packages/${p}`))
150+
].join(' '));
151+
}
152+
153+
145154
const repoProject = new yarn.Monorepo({
146155
projenrcTs: true,
147156
name: 'aws-cdk-cli',
@@ -791,6 +800,8 @@ const cli = configureProject(
791800

792801
// Append a specific version string for testing
793802
nextVersionCommand: 'tsx ../../projenrc/next-version.ts maybeRc',
803+
804+
releasableCommits: transitiveFeaturesAndFixes('aws-cdk', [cloudAssemblySchema.name, cloudFormationDiff.name]),
794805
}),
795806
);
796807

@@ -923,8 +934,7 @@ const cliLib = configureProject(
923934
devDeps: ['aws-cdk-lib', cli, 'constructs'],
924935
disableTsconfig: true,
925936
nextVersionCommand: `tsx ../../../projenrc/next-version.ts copyVersion:../../../${cliPackageJson} append:-alpha.0`,
926-
// Watch 2 directories at once
927-
releasableCommits: pj.ReleasableCommits.featuresAndFixes(`. ../../${cli.name}`),
937+
releasableCommits: transitiveFeaturesAndFixes('@aws-cdk/cli-lib-alpha', [cli.name, cloudAssemblySchema.name, cloudFormationDiff.name]),
928938
eslintOptions: {
929939
dirs: ['lib'],
930940
ignorePatterns: [
@@ -1081,7 +1091,7 @@ const toolkitLib = configureProject(
10811091
'typedoc',
10821092
],
10831093
// Watch 2 directories at once
1084-
releasableCommits: pj.ReleasableCommits.featuresAndFixes(`. ../../${cli.name}`),
1094+
releasableCommits: transitiveFeaturesAndFixes('@aws-cdk/toolkit-lib', [cli.name, cloudAssemblySchema.name, cloudFormationDiff.name]),
10851095
eslintOptions: {
10861096
dirs: ['lib'],
10871097
ignorePatterns: [
@@ -1200,8 +1210,7 @@ const cdkCliWrapper = configureProject(
12001210
srcdir: 'lib',
12011211
devDeps: ['aws-cdk-lib', cli, 'constructs', '@aws-cdk/integ-runner'],
12021212
nextVersionCommand: `tsx ../../../projenrc/next-version.ts copyVersion:../../../${cliPackageJson}`,
1203-
// Watch 2 directories at once
1204-
releasableCommits: pj.ReleasableCommits.featuresAndFixes(`. ../../${cli.name}`),
1213+
releasableCommits: transitiveFeaturesAndFixes('@aws-cdk/cdk-cli-wrapper', [cli.name, cloudAssemblySchema.name, cloudFormationDiff.name]),
12051214

12061215
jestOptions: jestOptionsForProject({
12071216
jestConfig: {
@@ -1231,8 +1240,7 @@ const cdkAliasPackage = configureProject(
12311240
srcdir: 'lib',
12321241
deps: [cli],
12331242
nextVersionCommand: `tsx ../../projenrc/next-version.ts copyVersion:../../${cliPackageJson}`,
1234-
// Watch 2 directories at once
1235-
releasableCommits: pj.ReleasableCommits.featuresAndFixes(`. ../${cli.name}`),
1243+
releasableCommits: transitiveFeaturesAndFixes('cdk', [cli.name, cloudAssemblySchema.name, cloudFormationDiff.name]),
12361244
}),
12371245
);
12381246
void cdkAliasPackage;

Diff for: packages/@aws-cdk/cli-lib-alpha/.projen/tasks.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/aws-cdk/.projen/tasks.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/cdk/.projen/tasks.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)