@@ -16,10 +16,10 @@ function coerceValidSemver(value: string): semver.SemVer | null {
1616}
1717
1818/**
19- * Node/engine version: must be valid semver or coercible to one (e.g. major-only `20`).
19+ * Version string: valid semver or coercible to one (e.g. major-only `20`, full `2.220.0 `).
2020 * Parsed output is the original string — no normalization (e.g. `20` stays `20`, not `20.0.0`).
2121 */
22- const nodeVersionStringSchema = z . string ( ) . refine (
22+ const versionStringSchema = z . string ( ) . refine (
2323 ( s ) => coerceValidSemver ( s ) != null ,
2424 { message : 'Must be a valid semver or coercible to one' } ,
2525) ;
@@ -79,6 +79,8 @@ export interface AlmaCdkConstructLibraryOptions {
7979 readonly pnpmSettings ?: PnpmWorkspaceSpecification ;
8080 /** Appended to generated `sonar-project.properties` after the default lines (e.g. Sonar multicriteria ignores). */
8181 readonly sonarProjectPropertiesExtraLines ?: string [ ] ;
82+ /** AWS CDK version for the generated library (semver or coercible, same rules as Node version fields); when omitted, defaults to the exported `CDK_DEFAULT_VERSION` constant. */
83+ readonly cdkVersion ?: string ;
8284 readonly golang ?: boolean ;
8385 readonly python ?: boolean ;
8486}
@@ -92,6 +94,9 @@ const NODEJS_MIN_VERSION = '20';
9294const NODEJS_MAX_VERSION = '24' ;
9395const NODEJS_WORKFLOW_VERSION = NODEJS_MAX_VERSION ;
9496
97+ /** Default AWS CDK version passed to projen when `cdkVersion` is omitted from options. */
98+ export const CDK_DEFAULT_VERSION = '2.220.0' ;
99+
95100
96101/** Projen AwsCdkConstructLibrary options with validation and defaults (min/max/workflow Node versions, package name, etc.). */
97102// JSII cannot infer this schema shape cleanly, so we keep the runtime schema
@@ -114,11 +119,12 @@ export const almaCdkConstructLibraryOptionsSchema = z
114119 devDeps : z . array ( z . string ( ) ) . optional ( ) ,
115120 bundledDeps : z . array ( z . string ( ) ) . optional ( ) ,
116121 codeCov : z . boolean ( ) . default ( false ) ,
117- minNodeVersion : nodeVersionStringSchema . default ( NODEJS_MIN_VERSION ) ,
118- workflowNodeVersion : nodeVersionStringSchema . default ( NODEJS_WORKFLOW_VERSION ) ,
119- maxNodeVersion : nodeVersionStringSchema . default ( NODEJS_MAX_VERSION ) ,
122+ minNodeVersion : versionStringSchema . default ( NODEJS_MIN_VERSION ) ,
123+ workflowNodeVersion : versionStringSchema . default ( NODEJS_WORKFLOW_VERSION ) ,
124+ maxNodeVersion : versionStringSchema . default ( NODEJS_MAX_VERSION ) ,
120125 pnpmSettings : pnpmSettingsSchema . optional ( ) ,
121126 sonarProjectPropertiesExtraLines : z . array ( z . string ( ) ) . optional ( ) ,
127+ cdkVersion : versionStringSchema . default ( CDK_DEFAULT_VERSION ) ,
122128 golang : z . boolean ( ) . default ( true ) ,
123129 python : z . boolean ( ) . default ( true ) ,
124130 } )
0 commit comments