Repository: aws-samples/cdk-bootstrapless-synthesizer (language: python)

Issue:
Support CDK v2



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b0633df..3811936 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -23,6 +23,10 @@ jobs:
         run: |-
           git config user.name "github-actions"
           git config user.email "github-actions@github.com"
+      - name: Setup Node.js
+        uses: actions/setup-node@v2.2.0
+        with:
+          node-version: 14.17.0
       - name: Install dependencies
         run: yarn install --check-files --frozen-lockfile
       - name: build
@@ -52,4 +56,4 @@ jobs:
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     container:
-      image: jsii/superchain:1-buster-slim
+      image: jsii/superchain:1-buster-slim-node14
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 98c9c1c..d2e27f4 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -24,6 +24,10 @@ jobs:
         run: |-
           git config user.name "github-actions"
           git config user.email "github-actions@github.com"
+      - name: Setup Node.js
+        uses: actions/setup-node@v2.2.0
+        with:
+          node-version: 14.17.0
       - name: Install dependencies
         run: yarn install --check-files --frozen-lockfile
       - name: release
@@ -39,7 +43,7 @@ jobs:
           name: dist
           path: dist
     container:
-      image: jsii/superchain:1-buster-slim
+      image: jsii/superchain:1-buster-slim-node14
   release_github:
     name: Publish to GitHub Releases
     needs: release
diff --git a/.github/workflows/upgrade-main.yml b/.github/workflows/upgrade-main.yml
index be0ec74..3db119a 100644
--- a/.github/workflows/upgrade-main.yml
+++ b/.github/workflows/upgrade-main.yml
@@ -22,6 +22,10 @@ jobs:
         run: |-
           git config user.name "github-actions"
           git config user.email "github-actions@github.com"
+      - name: Setup Node.js
+        uses: actions/setup-node@v2.2.0
+        with:
+          node-version: 14.17.0
       - name: Install dependencies
         run: yarn install --check-files --frozen-lockfile
       - name: Upgrade dependencies
@@ -40,7 +44,7 @@ jobs:
           name: .upgrade.tmp.patch
           path: .upgrade.tmp.patch
     container:
-      image: jsii/superchain:1-buster-slim
+      image: jsii/superchain:1-buster-slim-node14
   pr:
     name: Create Pull Request
     needs: upgrade
diff --git a/.projen/deps.json b/.projen/deps.json
index 7d5560b..f02923b 100644
--- a/.projen/deps.json
+++ b/.projen/deps.json
@@ -1,20 +1,5 @@
 {
   "dependencies": [
-    {
-      "name": "@aws-cdk/cloud-assembly-schema",
-      "version": "1.124.0",
-      "type": "build"
-    },
-    {
-      "name": "@aws-cdk/core",
-      "version": "1.124.0",
-      "type": "build"
-    },
-    {
-      "name": "@aws-cdk/cx-api",
-      "version": "1.124.0",
-      "type": "build"
-    },
     {
       "name": "@types/jest",
       "type": "build"
@@ -39,6 +24,16 @@
       "version": "6.0.1",
       "type": "build"
     },
+    {
+      "name": "aws-cdk-lib",
+      "version": "2.0.0",
+      "type": "build"
+    },
+    {
+      "name": "constructs",
+      "version": "10.0.5",
+      "type": "build"
+    },
     {
       "name": "eslint-import-resolver-node",
       "type": "build"
@@ -108,33 +103,18 @@
       "type": "build"
     },
     {
-      "name": "@aws-cdk/cloud-assembly-schema",
-      "version": "1.124.0",
-      "type": "peer"
-    },
-    {
-      "name": "@aws-cdk/core",
-      "version": "1.124.0",
+      "name": "aws-cdk-lib",
+      "version": "2.0.0",
       "type": "peer"
     },
     {
-      "name": "@aws-cdk/cx-api",
-      "version": "1.124.0",
+      "name": "constructs",
+      "version": "^10.0.5",
       "type": "peer"
     },
     {
-      "name": "@aws-cdk/cloud-assembly-schema",
-      "version": "1.124.0",
-      "type": "runtime"
-    },
-    {
-      "name": "@aws-cdk/core",
-      "version": "1.124.0",
-      "type": "runtime"
-    },
-    {
-      "name": "@aws-cdk/cx-api",
-      "version": "1.124.0",
+      "name": "aws-cdk-lib",
+      "version": "2.0.0",
       "type": "runtime"
     }
   ],
diff --git a/.projen/tasks.json b/.projen/tasks.json
index 477fb3c..b02693c 100644
--- a/.projen/tasks.json
+++ b/.projen/tasks.json
@@ -222,7 +222,7 @@
       "description": "Run tests",
       "steps": [
         {
-          "exec": "jest --passWithNoTests --all --updateSnapshot"
+          "exec": "jest --passWithNoTests --all --updateSnapshot --coverageProvider=v8"
         },
         {
           "spawn": "eslint"
@@ -288,7 +288,7 @@
           "exec": "yarn install --check-files"
         },
         {
-          "exec": "yarn upgrade @aws-cdk/cloud-assembly-schema @aws-cdk/core @aws-cdk/cx-api @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser ansi-regex eslint-import-resolver-node eslint-import-resolver-typescript eslint-plugin-import eslint jest jest-junit jsii jsii-diff jsii-docgen jsii-pacmak json-schema npm-check-updates standard-version ts-jest typescript @aws-cdk/cloud-assembly-schema @aws-cdk/core @aws-cdk/cx-api @aws-cdk/cloud-assembly-schema @aws-cdk/core @aws-cdk/cx-api"
+          "exec": "yarn upgrade @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser ansi-regex aws-cdk-lib constructs eslint-import-resolver-node eslint-import-resolver-typescript eslint-plugin-import eslint jest jest-junit jsii jsii-diff jsii-docgen jsii-pacmak json-schema npm-check-updates standard-version ts-jest typescript aws-cdk-lib constructs aws-cdk-lib"
         },
         {
           "exec": "npx projen"
diff --git a/.projenrc.js b/.projenrc.js
index b6dcc3a..e1a0eff 100644
--- a/.projenrc.js
+++ b/.projenrc.js
@@ -26,14 +26,11 @@ const project = new JsiiProject({
   releaseEveryCommit: true,
   defaultReleaseBranch: 'main',
   deps: [
-    '@aws-cdk/cloud-assembly-schema@1.124.0',
-    '@aws-cdk/cx-api@1.124.0',
-    '@aws-cdk/core@1.124.0',
+    'aws-cdk-lib@2.0.0',
   ],
   peerDeps: [
-    '@aws-cdk/cloud-assembly-schema@1.124.0',
-    '@aws-cdk/cx-api@1.124.0',
-    '@aws-cdk/core@1.124.0',
+    'aws-cdk-lib@2.0.0',
+    'constructs@^10.0.5',
   ],
   devDeps: [
     'ansi-regex@6.0.1',
@@ -49,6 +46,7 @@ const project = new JsiiProject({
       ],
     },
   },
+  minNodeVersion: '14.17.0',
 });
 
 const sampleProject = new AwsCdkTypeScriptApp({
diff --git a/API.md b/API.md
index d71300a..e4fa669 100644
--- a/API.md
+++ b/API.md
@@ -220,7 +220,7 @@ public addDockerImageAsset(asset: DockerImageAssetSource)
 
 ###### `asset`<sup>Required</sup> <a name="cdk-bootstrapless-synthesizer.BootstraplessStackSynthesizer.parameter.asset" id="cdkbootstraplesssynthesizerbootstraplessstacksynthesizerparameterasset"></a>
 
-- *Type:* [`@aws-cdk/core.DockerImageAssetSource`](#@aws-cdk/core.DockerImageAssetSource)
+- *Type:* [`aws-cdk-lib.DockerImageAssetSource`](#aws-cdk-lib.DockerImageAssetSource)
 
 ---
 
@@ -232,7 +232,7 @@ public addFileAsset(asset: FileAssetSource)
 
 ###### `asset`<sup>Required</sup> <a name="cdk-bootstrapless-synthesizer.BootstraplessStackSynthesizer.parameter.asset" id="cdkbootstraplesssynthesizerbootstraplessstacksynthesizerparameterasset"></a>
 
-- *Type:* [`@aws-cdk/core.FileAssetSource`](#@aws-cdk/core.FileAssetSource)
+- *Type:* [`aws-cdk-lib.FileAssetSource`](#aws-cdk-lib.FileAssetSource)
 
 ---
 
@@ -244,7 +244,7 @@ public bind(stack: Stack)
 
 ###### `stack`<sup>Required</sup> <a name="cdk-bootstrapless-synthesizer.BootstraplessStackSynthesizer.parameter.stack" id="cdkbootstraplesssynthesizerbootstraplessstacksynthesizerparameterstack"></a>
 
-- *Type:* [`@aws-cdk/core.Stack`](#@aws-cdk/core.Stack)
+- *Type:* [`aws-cdk-lib.Stack`](#aws-cdk-lib.Stack)
 
 ---
 
@@ -262,7 +262,7 @@ public synthesize(session: ISynthesisSession)
 
 ###### `session`<sup>Required</sup> <a name="cdk-bootstrapless-synthesizer.BootstraplessStackSynthesizer.parameter.session" id="cdkbootstraplesssynthesizerbootstraplessstacksynthesizerparametersession"></a>
 
-- *Type:* [`@aws-cdk/core.ISynthesisSession`](#@aws-cdk/core.ISynthesisSession)
+- *Type:* [`aws-cdk-lib.ISynthesisSession`](#aws-cdk-lib.ISynthesisSession)
 
 ---
 
diff --git a/package.json b/package.json
index 59fa904..2eaab0f 100644
--- a/package.json
+++ b/package.json
@@ -36,21 +36,20 @@
     "organization": true
   },
   "devDependencies": {
-    "@aws-cdk/cloud-assembly-schema": "1.124.0",
-    "@aws-cdk/core": "1.124.0",
-    "@aws-cdk/cx-api": "1.124.0",
     "@types/jest": "*",
     "@types/node": "^14.17.0",
     "@typescript-eslint/eslint-plugin": "^5",
     "@typescript-eslint/parser": "^5",
     "ansi-regex": "6.0.1",
+    "aws-cdk-lib": "2.0.0",
+    "constructs": "10.0.5",
     "eslint": "^8",
     "eslint-import-resolver-node": "^0.3.6",
     "eslint-import-resolver-typescript": "^2.5.0",
     "eslint-plugin-import": "^2.25.3",
     "jest": "^27.4.3",
     "jest-junit": "^13",
-    "jsii": "^1.46.0",
+    "jsii": "1.46.0",
     "jsii-diff": "^1.46.0",
     "jsii-docgen": "^4.2.6",
     "jsii-pacmak": "^1.46.0",
@@ -62,14 +61,11 @@
     "typescript": "^4.5.2"
   },
   "peerDependencies": {
-    "@aws-cdk/cloud-assembly-schema": "1.124.0",
-    "@aws-cdk/core": "1.124.0",
-    "@aws-cdk/cx-api": "1.124.0"
+    "aws-cdk-lib": "2.0.0",
+    "constructs": "^10.0.5"
   },
   "dependencies": {
-    "@aws-cdk/cloud-assembly-schema": "1.124.0",
-    "@aws-cdk/core": "1.124.0",
-    "@aws-cdk/cx-api": "1.124.0"
+    "aws-cdk-lib": "2.0.0"
   },
   "bundledDependencies": [],
   "keywords": [
@@ -78,6 +74,9 @@
     "cloudformation",
     "synthesizer"
   ],
+  "engines": {
+    "node": ">= 14.17.0"
+  },
   "main": "lib/index.js",
   "license": "Apache-2.0",
   "version": "0.0.0",
diff --git a/src/index.ts b/src/index.ts
index e077fb2..dae225d 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,8 +1,8 @@
 import * as fs from 'fs';
 import * as path from 'path';
-import * as cxschema from '@aws-cdk/cloud-assembly-schema';
-import { DockerImageAssetLocation, DockerImageAssetSource, FileAssetLocation, FileAssetPackaging, FileAssetSource, Fn, ISynthesisSession, Stack, StackSynthesizer, Token } from '@aws-cdk/core';
-import * as cxapi from '@aws-cdk/cx-api';
+import * as cxschema from 'aws-cdk-lib/cloud-assembly-schema';
+import { DockerImageAssetLocation, DockerImageAssetSource, FileAssetLocation, FileAssetPackaging, FileAssetSource, Fn, ISynthesisSession, Stack, StackSynthesizer, Token } from 'aws-cdk-lib/core';
+import * as cxapi from 'aws-cdk-lib/cx-api';
 
 
 const REGION_PLACEHOLDER = '${AWS::Region}';
@@ -248,7 +248,6 @@ export class BootstraplessStackSynthesizer extends StackSynthesizer {
       objectKey,
       httpUrl,
       s3ObjectUrl,
-      s3Url: httpUrl,
     };
   }
 
diff --git a/yarn.lock b/yarn.lock
index dcf2af2..abad4cb 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2,41 +2,6 @@
 # yarn lockfile v1
 
 
-"@aws-cdk/cloud-assembly-schema@1.124.0":
-  version "1.124.0"
-  resolved "https://registry.yarnpkg.com/@aws-cdk/cloud-assembly-schema/-/cloud-assembly-schema-1.124.0.tgz#fcfa4051933a914073bc841af5b462bf74f309ea"
-  integrity sha512-emrkfHetGoh6lhrT7ato06VAZun1UVYjJueL9avHxFgzX5qiobP4iWk6M0EZpk7yHlDOtJtp86MJalYYMS6Oww==
-  dependencies:
-    jsonschema "^1.4.0"
-    semver "^7.3.5"
-
-"@aws-cdk/core@1.124.0":
-  version "1.124.0"
-  resolved "https://registry.yarnpkg.com/@aws-cdk/core/-/core-1.124.0.tgz#9187e0ce69225ad58feb11ec95c92cebaeddca53"
-  integrity sha512-QsTLvOuF+WJdtF11Bwuh+THWry7OmErs3XDaiHFweZPLMc2O3EEQvCgSKstH7Y9HUTpW7ZSGQHryxCjpTl1Wmg==
-  dependencies:
-    "@aws-cdk/cloud-assembly-schema" "1.124.0"
-    "@aws-cdk/cx-api" "1.124.0"
-    "@aws-cdk/region-info" "1.124.0"
-    "@balena/dockerignore" "^1.0.2"
-    constructs "^3.3.69"
-    fs-extra "^9.1.0"
-    ignore "^5.1.8"
-    minimatch "^3.0.4"
-
-"@aws-cdk/cx-api@1.124.0":
-  version "1.124.0"
-  resolved "https://registry.yarnpkg.com/@aws-cdk/cx-api/-/cx-api-1.124.0.tgz#456877af5fe5d9eef8e9ce1d896ee15960024b24"
-  integrity sha512-InBcAoFJ0Ail7/IhJhhw2OwGyWgBv4HShRA20/czxvlQ2pOezcUxQOCJr5USM6dGvTOlDL38XVrw469m9boUzw==
-  dependencies:
-    "@aws-cdk/cloud-assembly-schema" "1.124.0"
-    semver "^7.3.5"
-
-"@aws-cdk/region-info@1.124.0":
-  version "1.124.0"
-  resolved "https://registry.yarnpkg.com/@aws-cdk/region-info/-/region-info-1.124.0.tgz#541a6372b89a3385cc0cf3e2d71f1b917503be24"
-  integrity sha512-v8Msal5kCv5Juscj6Dxjzx4HHiYKD3rWDLBAvaDN/V3zCNGga3s8M2aM/n7po7HLjVW333VzyuOCHBYnSrtMIg==
-
 "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.0":
   version "7.16.0"
   resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.0.tgz#0dfc80309beec8411e65e706461c408b0bb9b431"
@@ -1167,6 +1132,21 @@ available-typed-arrays@^1.0.5:
   resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7"
   integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==
 
+aws-cdk-lib@2.0.0:
+  version "2.0.0"
+  resolved "https://registry.yarnpkg.com/aws-cdk-lib/-/aws-cdk-lib-2.0.0.tgz#da7cf476363771f5ce4eb2aa73388b91db50553e"
+  integrity sha512-ETom3THcblmS3GSoS6rb2AGy7HZpcpoHvwNlxeVIVbmGOiKrrqjvECK2uOJtNboV/vDTHHjx/s/1SwptLo9dlg==
+  dependencies:
+    "@balena/dockerignore" "^1.0.2"
+    case "1.6.3"
+    fs-extra "^9.1.0"
+    ignore "^5.1.9"
+    jsonschema "^1.4.0"
+    minimatch "^3.0.4"
+    punycode "^2.1.1"
+    semver "^7.3.5"
+    yaml "1.10.2"
+
 aws-sign2@~0.7.0:
   version "0.7.0"
   resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8"
@@ -1393,7 +1373,7 @@ caniuse-lite@^1.0.30001280:
   resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001284.tgz#d3653929ded898cd0c1f09a56fd8ca6952df4fca"
   integrity sha512-t28SKa7g6kiIQi6NHeOcKrOrGMzCRrXvlasPwWC26TH2QNdglgzQIRUuJ0cR3NeQPH+5jpuveeeSFDLm2zbkEw==
 
-case@^1.6.3:
+case@1.6.3, case@^1.6.3:
   version "1.6.3"
   resolved "https://registry.yarnpkg.com/case/-/case-1.6.3.tgz#0a4386e3e9825351ca2e6216c60467ff5f1ea1c9"
   integrity sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ==
@@ -1609,10 +1589,10 @@ console-control-strings@^1.0.0, console-control-strings@~1.1.0:
   resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e"
   integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=
 
-constructs@^3.3.69:
-  version "3.3.162"
-  resolved "https://registry.yarnpkg.com/constructs/-/constructs-3.3.162.tgz#c87e0fe75f533353ff9d156028ee765542821980"
-  integrity sha512-ODzbe3frWuIyIhBJs86pqWQWQYFRHHiM0DW4mnJcFgrMn6pyt2viUaAy38RFLDIGrlejy2oOFrEaOArx/CqFRw==
+constructs@10.0.5:
+  version "10.0.5"
+  resolved "https://registry.yarnpkg.com/constructs/-/constructs-10.0.5.tgz#48c0402f1b98bbf5664efff74a8015e6e8a9f41e"
+  integrity sha512-IwOwekzrASFC3qt4ozCtV09rteAIAesuCGsW0p+uBfqHd2XcvA5CXqJjgf4eUqm6g8e/noXlVCMDWwC8GaLtrg==
 
 conventional-changelog-angular@^5.0.12:
   version "5.0.13"
@@ -3115,7 +3095,7 @@ ignore@^4.0.6:
   resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc"
   integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==
 
-ignore@^5.1.4, ignore@^5.1.8:
+ignore@^5.1.4, ignore@^5.1.8, ignore@^5.1.9:
   version "5.1.9"
   resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.9.tgz#9ec1a5cbe8e1446ec60d4420060d43aa6e7382fb"
   integrity sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==
@@ -4067,7 +4047,7 @@ jsii-rosetta@^1.46.0:
     workerpool "^6.1.5"
     yargs "^16.2.0"
 
-jsii@1.46.0, jsii@^1.46.0:
+jsii@1.46.0:
   version "1.46.0"
   resolved "https://registry.yarnpkg.com/jsii/-/jsii-1.46.0.tgz#c36294a8fa24c309b94f7bf40d91d72caac594a5"
   integrity sha512-PuO7cwz3XDBOMIVKJ822GtJeq9wAu/7S8/Xqn2BuvBjGHaAxksCYR7MEOnhOK9Kj2y43fBGXo0MtHx4eZOHIEg==
@@ -6431,7 +6411,7 @@ yallist@^4.0.0:
   resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
   integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
 
-yaml@^1.10.2:
+yaml@1.10.2, yaml@^1.10.2:
   version "1.10.2"
   resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b"
   integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==


Test patch:
diff --git a/test/BootstraplessStackSynthesizer.test.ts b/test/BootstraplessStackSynthesizer.test.ts
index 4ef9617..3869f94 100644
--- a/test/BootstraplessStackSynthesizer.test.ts
+++ b/test/BootstraplessStackSynthesizer.test.ts
@@ -1,7 +1,7 @@
 import * as fs from 'fs';
-import * as cxschema from '@aws-cdk/cloud-assembly-schema';
-import { FileAssetPackaging, Stack, App } from '@aws-cdk/core';
-import * as cxapi from '@aws-cdk/cx-api';
+import * as cxschema from 'aws-cdk-lib/cloud-assembly-schema';
+import { FileAssetPackaging, Stack, App } from 'aws-cdk-lib/core';
+import * as cxapi from 'aws-cdk-lib/cx-api';
 import { BootstraplessStackSynthesizer, BootstraplessStackSynthesizerProps } from '../src';
 
 beforeEach(() => {