fix(cdk-aspects): declare aws-cdk-lib and constructs as peerDependencies#1698
Merged
Merged
Conversation
kai-nguyen-aligent
approved these changes
May 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves
aws-cdk-libandconstructsfromdependenciestopeerDependenciesin@aligent/cdk-aspects, matching the convention used by every other@aligent/cdk-*construct package.Why
As regular
dependencies, a consumer whose ownaws-cdk-libresolves to a different version ends up with two copies in the tree — the app's, and a nested one under@aligent/cdk-aspects. The aspects'node instanceof CfnResourceguard compares against the nested copy's class, while the constructs being visited are instances of the app's copy. Different class objects →instanceofis alwaysfalse→visit()returns early for every node.Result: aspects silently become a no-op — no prefixes, no defaults, no checks — with a valid-but-untouched synth and no error or warning. Declaring them as peers guarantees a single shared instance with the consumer.
Changes
packages/cdk-aspects/package.json—aws-cdk-lib(^2.113.0) andconstructs(^10.5.0) moved topeerDependencies. Range widened from the old^2.257.0pin to the repo's dominant peer range; a peer should accept a broad span of consumer CDK versions, and the aspects only touch the stableCfnResourceAPI.yarn.lock— reflects the move; no duplicateaws-cdk-liblocator introduced..changeset/—patchbump.Verification
yarn nx build/test/lint cdk-aspects— all pass (55 tests green).yarn changeset:status— single patch bump for@aligent/cdk-aspects.aws-cdk-liblocator, no nested duplicate.Notes
Scoped to the peer-dependency packaging fix only. The separate
ResourcePrefixAspecttoken/empty-base-name regression reported alongside this is already fixed onmainby MI-323 (0.6.3) and is not part of this PR.