Skip to content

feat: allow override of constructs version#13

Merged
aripalo merged 1 commit into
mainfrom
feature/allow-construct-version-override
May 12, 2026
Merged

feat: allow override of constructs version#13
aripalo merged 1 commit into
mainfrom
feature/allow-construct-version-override

Conversation

@aripalo

@aripalo aripalo commented May 12, 2026

Copy link
Copy Markdown
Contributor

This pull request adds support for specifying the version of the constructs library when generating a CDK construct library project. It introduces a new constructsVersion option, provides a default version, and ensures this option is validated and documented. The changes also include corresponding updates to tests and exports.

New option for constructs library version:

  • Added an optional constructsVersion property to the AlmaCdkConstructLibraryOptions interface, allowing users to specify the version of the constructs library for the generated project. If omitted, it defaults to the new CONSTRUCTS_DEFAULT_VERSION constant. (src/schemas/almaCdkConstructLibraryOptions.ts, API.md) [1] [2] [3]

Defaults and validation:

  • Introduced the CONSTRUCTS_DEFAULT_VERSION constant (set to '10.3.0') and ensured it is used as the default in the schema validation for constructsVersion. (src/schemas/almaCdkConstructLibraryOptions.ts) [1] [2]
  • Updated the schema to validate constructsVersion as a semver string and included test cases for defaulting, overriding, and rejecting invalid values. (test/schemas/almaCdkConstructLibraryOptions.test.ts) [1] [2]

Exports and documentation:

  • Exported CONSTRUCTS_DEFAULT_VERSION from the main entry point for external usage. (src/index.ts)
  • Updated the API documentation to describe the new constructsVersion option and its default behavior. (API.md) [1] [2]

Code cleanup:

  • Removed the unused local CONSTRUCTS_VERSION constant from the implementation file, ensuring the new default constant is used consistently. (src/AlmaCdkConstructLibrary.ts) [1] [2]

Summary by CodeRabbit

  • New Features
    • Added optional constructsVersion configuration option to customize the constructs library version. Defaults to 10.3.0 if not specified.

Review Change Stack

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class support for overriding the constructs dependency version used when generating an AwsCdkConstructLibrary project, while keeping a stable default consistent with the previous hardcoded value.

Changes:

  • Introduces constructsVersion to AlmaCdkConstructLibraryOptions with validation + a new CONSTRUCTS_DEFAULT_VERSION default.
  • Removes the previously hardcoded constructsVersion from AlmaCdkConstructLibrary so the validated option/default flows through to projen.
  • Updates public exports, tests, and generated API docs to reflect the new option and default.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/schemas/almaCdkConstructLibraryOptions.test.ts Adds assertions for the new default and override/validation behavior for constructsVersion.
src/schemas/almaCdkConstructLibraryOptions.ts Adds constructsVersion, introduces CONSTRUCTS_DEFAULT_VERSION, and wires it into the Zod schema defaults.
src/index.ts Exports CONSTRUCTS_DEFAULT_VERSION alongside CDK_DEFAULT_VERSION.
src/AlmaCdkConstructLibrary.ts Removes hardcoded constructs version so the schema-provided value is used.
API.md Documents the new constructsVersion option and its default constant.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aripalo

aripalo commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown
✅ Actions performed

Full review triggered.

@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 13a10ee7-22db-4746-9027-f9149e4d0848

📥 Commits

Reviewing files that changed from the base of the PR and between 7e62f19 and 14793cc.

📒 Files selected for processing (5)
  • API.md
  • src/AlmaCdkConstructLibrary.ts
  • src/index.ts
  • src/schemas/almaCdkConstructLibraryOptions.ts
  • test/schemas/almaCdkConstructLibraryOptions.test.ts
💤 Files with no reviewable changes (1)
  • src/AlmaCdkConstructLibrary.ts

📝 Walkthrough

Walkthrough

This PR adds a new optional constructsVersion property to AlmaCdkConstructLibraryOptions, allowing projects to override the default constructs library version. The change introduces a CONSTRUCTS_DEFAULT_VERSION constant (10.3.0), updates the schema to validate semver strings, and removes the previously hardcoded version pinning from the library itself.

Changes

Constructs Version Configuration

Layer / File(s) Summary
Schema definition and validation
src/schemas/almaCdkConstructLibraryOptions.ts, test/schemas/almaCdkConstructLibraryOptions.test.ts
AlmaCdkConstructLibraryOptions interface gains an optional constructsVersion property; CONSTRUCTS_DEFAULT_VERSION constant is introduced and used as the default in the Zod schema. Tests verify the default value is applied, overrides are accepted, and invalid semver strings are rejected.
Integration and exports
src/index.ts, src/AlmaCdkConstructLibrary.ts
CONSTRUCTS_DEFAULT_VERSION is exported from the main entry point. The hardcoded CONSTRUCTS_VERSION constant is removed from AlmaCdkConstructLibrary.ts, and the explicit constructsVersion assignment in AwsCdkConstructLibraryOptions is deleted, allowing Projen to use its own defaults.
API documentation
API.md
The API reference for AlmaCdkConstructLibraryOptions is updated to document the new optional constructsVersion property, its type, and its default fallback behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A rabbit hops with joy to see,
New versions float so wild and free,
Defaults set at 10.3.0 bright,
Schema validated, tests all right!
✨ Constructs version, yours to choose!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding support for overriding the constructs library version.
Description check ✅ Passed The pull request description is comprehensive and well-structured, covering all major changes including new options, defaults, validation, exports, and documentation updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/allow-construct-version-override

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

@aripalo aripalo merged commit 8709a75 into main May 12, 2026
14 checks passed
@aripalo aripalo deleted the feature/allow-construct-version-override branch May 12, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants