@@ -156,6 +156,21 @@ function transitiveFeaturesAndFixes(thisPkg: string, depPkgs: string[]) {
156
156
] . join ( ' ' ) ) ;
157
157
}
158
158
159
+ /**
160
+ * Returns all packages that are considered part of the toolkit,
161
+ * as relative paths from the provided package.
162
+ */
163
+ function transitiveToolkitPackages ( thisPkg : string ) {
164
+ const toolkitPackages = [
165
+ 'aws-cdk' ,
166
+ '@aws-cdk/tmp-toolkit-helpers' ,
167
+ '@aws-cdk/cloud-assembly-schema' ,
168
+ '@aws-cdk/cloudformation-diff' ,
169
+ ] ;
170
+
171
+ return transitiveFeaturesAndFixes ( thisPkg , toolkitPackages . filter ( name => name !== thisPkg ) ) ;
172
+ }
173
+
159
174
const repoProject = new yarn . Monorepo ( {
160
175
projenrcTs : true ,
161
176
name : 'aws-cdk-cli' ,
@@ -668,6 +683,38 @@ cdkAssets.eslint?.addRules({ 'jest/no-export': ['off'] });
668
683
669
684
//////////////////////////////////////////////////////////////////////
670
685
686
+ const tmpToolkitHelpers = configureProject (
687
+ new yarn . TypeScriptWorkspace ( {
688
+ ...genericCdkProps ( {
689
+ private : true ,
690
+ } ) ,
691
+ parent : repo ,
692
+ name : '@aws-cdk/tmp-toolkit-helpers' ,
693
+ description : 'A temporary package to hold code shared between aws-cdk and @aws-cdk/toolkit-lib' ,
694
+ deps : [ ] ,
695
+ devDeps : [
696
+ cdkBuildTools ,
697
+ ] ,
698
+ tsconfig : {
699
+ compilerOptions : {
700
+ target : 'es2022' ,
701
+ lib : [ 'es2022' , 'esnext.disposable' ] ,
702
+ module : 'NodeNext' ,
703
+ esModuleInterop : false ,
704
+ } ,
705
+ } ,
706
+ } ) ,
707
+ ) ;
708
+
709
+ // Prevent imports of private API surface
710
+ tmpToolkitHelpers . package . addField ( 'exports' , {
711
+ '.' : './lib/index.js' ,
712
+ './package.json' : './package.json' ,
713
+ './api' : './lib/api/index.js' ,
714
+ } ) ;
715
+
716
+ //////////////////////////////////////////////////////////////////////
717
+
671
718
let CLI_SDK_VERSION : '2' | '3' = ( '3' as any ) ;
672
719
673
720
const cli = configureProject (
@@ -683,6 +730,7 @@ const cli = configureProject(
683
730
cdkBuildTools ,
684
731
yargsGen ,
685
732
cliPluginContract ,
733
+ tmpToolkitHelpers ,
686
734
'@octokit/rest' ,
687
735
'@types/archiver' ,
688
736
'@types/fs-extra@^9' ,
@@ -826,7 +874,7 @@ const cli = configureProject(
826
874
// Append a specific version string for testing
827
875
nextVersionCommand : 'tsx ../../projenrc/next-version.ts maybeRc' ,
828
876
829
- releasableCommits : transitiveFeaturesAndFixes ( 'aws-cdk' , [ cloudAssemblySchema . name , cloudFormationDiff . name ] ) ,
877
+ releasableCommits : transitiveToolkitPackages ( 'aws-cdk' ) ,
830
878
} ) ,
831
879
) ;
832
880
@@ -962,7 +1010,7 @@ const cliLib = configureProject(
962
1010
devDeps : [ 'aws-cdk-lib' , cli , 'constructs' ] ,
963
1011
disableTsconfig : true ,
964
1012
nextVersionCommand : `tsx ../../../projenrc/next-version.ts copyVersion:../../../${ cliPackageJson } append:-alpha.0` ,
965
- releasableCommits : transitiveFeaturesAndFixes ( '@aws-cdk/cli-lib-alpha' , [ cli . name , cloudAssemblySchema . name , cloudFormationDiff . name ] ) ,
1013
+ releasableCommits : transitiveToolkitPackages ( '@aws-cdk/cli-lib-alpha' ) ,
966
1014
eslintOptions : {
967
1015
dirs : [ 'lib' ] ,
968
1016
ignorePatterns : [
@@ -1118,13 +1166,14 @@ const toolkitLib = configureProject(
1118
1166
'@types/fs-extra' ,
1119
1167
'@types/split2' ,
1120
1168
cli ,
1169
+ tmpToolkitHelpers ,
1121
1170
'aws-cdk-lib' ,
1122
1171
'aws-sdk-client-mock' ,
1123
1172
'esbuild' ,
1124
1173
'typedoc' ,
1125
1174
] ,
1126
1175
// Watch 2 directories at once
1127
- releasableCommits : transitiveFeaturesAndFixes ( '@aws-cdk/toolkit-lib' , [ cli . name , cloudAssemblySchema . name , cloudFormationDiff . name ] ) ,
1176
+ releasableCommits : transitiveToolkitPackages ( '@aws-cdk/toolkit-lib' ) ,
1128
1177
eslintOptions : {
1129
1178
dirs : [ 'lib' ] ,
1130
1179
ignorePatterns : [
@@ -1170,6 +1219,11 @@ toolkitLib.eslint?.addRules({
1170
1219
target : './' ,
1171
1220
from : '../../aws-cdk' ,
1172
1221
message : 'All `aws-cdk` code must be used via lib/api/aws-cdk.ts' ,
1222
+ } ,
1223
+ {
1224
+ target : './' ,
1225
+ from : '../tmp-toolkit-helpers' ,
1226
+ message : 'All `@aws-cdk/tmp-toolkit-helpers` code must be used via lib/api/shared-*.ts' ,
1173
1227
} ] ,
1174
1228
} ] ,
1175
1229
} ) ;
@@ -1265,7 +1319,7 @@ const cdkCliWrapper = configureProject(
1265
1319
srcdir : 'lib' ,
1266
1320
devDeps : [ 'aws-cdk-lib' , cli , 'constructs' , '@aws-cdk/integ-runner' ] ,
1267
1321
nextVersionCommand : `tsx ../../../projenrc/next-version.ts copyVersion:../../../${ cliPackageJson } ` ,
1268
- releasableCommits : transitiveFeaturesAndFixes ( '@aws-cdk/cdk-cli-wrapper' , [ cli . name , cloudAssemblySchema . name , cloudFormationDiff . name ] ) ,
1322
+ releasableCommits : transitiveToolkitPackages ( '@aws-cdk/cdk-cli-wrapper' ) ,
1269
1323
1270
1324
jestOptions : jestOptionsForProject ( {
1271
1325
jestConfig : {
@@ -1295,7 +1349,7 @@ const cdkAliasPackage = configureProject(
1295
1349
srcdir : 'lib' ,
1296
1350
deps : [ cli ] ,
1297
1351
nextVersionCommand : `tsx ../../projenrc/next-version.ts copyVersion:../../${ cliPackageJson } ` ,
1298
- releasableCommits : transitiveFeaturesAndFixes ( 'cdk' , [ cli . name , cloudAssemblySchema . name , cloudFormationDiff . name ] ) ,
1352
+ releasableCommits : transitiveToolkitPackages ( 'cdk' ) ,
1299
1353
} ) ,
1300
1354
) ;
1301
1355
void cdkAliasPackage ;
0 commit comments