From c9f490f17f42aed92646543f7978ac8e4fc9ebb6 Mon Sep 17 00:00:00 2001 From: Todd Hainsworth Date: Fri, 29 May 2026 15:07:05 +0930 Subject: [PATCH] fix: declare aws-cdk-lib and constructs as peerDependencies in cdk-aspects --- .changeset/cdk-aspects-peer-dependencies.md | 7 +++++++ packages/cdk-aspects/package.json | 6 ++++-- yarn.lock | 5 +++-- 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 .changeset/cdk-aspects-peer-dependencies.md diff --git a/.changeset/cdk-aspects-peer-dependencies.md b/.changeset/cdk-aspects-peer-dependencies.md new file mode 100644 index 00000000..74dd5814 --- /dev/null +++ b/.changeset/cdk-aspects-peer-dependencies.md @@ -0,0 +1,7 @@ +--- +"@aligent/cdk-aspects": patch +--- + +Move `aws-cdk-lib` and `constructs` from `dependencies` to `peerDependencies`, matching the convention used by every `@aligent/cdk-*` construct package. + +As regular dependencies, a consumer whose own `aws-cdk-lib` resolved to a different version ended up with two copies in the tree. The aspects' `instanceof CfnResource` checks compared against the nested copy's class, so `visit()` returned early for every node — aspects silently became a no-op (no prefixes, no defaults, no checks) with a valid-but-untouched synth. Declaring them as peers guarantees a single shared instance with the consumer. diff --git a/packages/cdk-aspects/package.json b/packages/cdk-aspects/package.json index 151fdbcc..faa22ae7 100644 --- a/packages/cdk-aspects/package.json +++ b/packages/cdk-aspects/package.json @@ -28,9 +28,11 @@ "typescript": "^5.3.2" }, "dependencies": { - "aws-cdk-lib": "^2.257.0", - "constructs": "^10.5.0", "esbuild": "^0.28.0", "source-map-support": "^0.5.21" + }, + "peerDependencies": { + "aws-cdk-lib": "^2.113.0", + "constructs": "^10.5.0" } } diff --git a/yarn.lock b/yarn.lock index 42d8dd3a..c772fc95 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12,14 +12,15 @@ __metadata: "@types/jest": "npm:^29.5.10" "@types/node": "npm:^24.12.4" aws-cdk: "npm:^2.1124.1" - aws-cdk-lib: "npm:^2.257.0" - constructs: "npm:^10.5.0" esbuild: "npm:^0.28.0" jest: "npm:^29.7.0" source-map-support: "npm:^0.5.21" ts-jest: "npm:^29.4.9" ts-node: "npm:^10.9.1" typescript: "npm:^5.3.2" + peerDependencies: + aws-cdk-lib: ^2.113.0 + constructs: ^10.5.0 languageName: unknown linkType: soft