From c7061b5d3809436007598b71e90e484506098f38 Mon Sep 17 00:00:00 2001
From: Kendra Neil <53584728+TheRealAmazonKendra@users.noreply.github.com>
Date: Wed, 4 Oct 2023 09:49:57 -0700
Subject: [PATCH 1/2] chore: upgrade cdk migrate version with bug fixes
---
.../cli-lib-alpha/THIRD_PARTY_LICENSES | 2 +-
packages/aws-cdk/THIRD_PARTY_LICENSES | 2 +-
packages/aws-cdk/package.json | 6 ++---
.../aws-cdk/test/commands/migrate.test.ts | 16 +++++------
.../test-resources/stacks/S3Stack.java | 2 +-
.../test-resources/stacks/s3_stack.py | 27 +++++++++----------
yarn.lock | 8 +++---
7 files changed, 31 insertions(+), 32 deletions(-)
diff --git a/packages/@aws-cdk/cli-lib-alpha/THIRD_PARTY_LICENSES b/packages/@aws-cdk/cli-lib-alpha/THIRD_PARTY_LICENSES
index 00c827666c130..2d7b53c8de349 100644
--- a/packages/@aws-cdk/cli-lib-alpha/THIRD_PARTY_LICENSES
+++ b/packages/@aws-cdk/cli-lib-alpha/THIRD_PARTY_LICENSES
@@ -461,7 +461,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
----------------
-** cdk-from-cfn@0.35.0 - https://www.npmjs.com/package/cdk-from-cfn/v/0.35.0 | MIT OR Apache-2.0
+** cdk-from-cfn@0.45.0 - https://www.npmjs.com/package/cdk-from-cfn/v/0.45.0 | MIT OR Apache-2.0
----------------
diff --git a/packages/aws-cdk/THIRD_PARTY_LICENSES b/packages/aws-cdk/THIRD_PARTY_LICENSES
index fc32caf93b1a1..f89f4ee4f5e58 100644
--- a/packages/aws-cdk/THIRD_PARTY_LICENSES
+++ b/packages/aws-cdk/THIRD_PARTY_LICENSES
@@ -461,7 +461,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
----------------
-** cdk-from-cfn@0.36.0 - https://www.npmjs.com/package/cdk-from-cfn/v/0.36.0 | MIT OR Apache-2.0
+** cdk-from-cfn@0.45.0 - https://www.npmjs.com/package/cdk-from-cfn/v/0.45.0 | MIT OR Apache-2.0
----------------
diff --git a/packages/aws-cdk/package.json b/packages/aws-cdk/package.json
index e7a8612b549dc..536f6976f8a1c 100644
--- a/packages/aws-cdk/package.json
+++ b/packages/aws-cdk/package.json
@@ -82,7 +82,7 @@
"aws-cdk-lib": "0.0.0",
"aws-sdk-mock": "5.6.0",
"axios": "^0.27.2",
- "cdk-from-cfn": "^0.36.0",
+ "cdk-from-cfn": "^0.45.0",
"constructs": "^10.0.0",
"fast-check": "^3.13.1",
"jest": "^29.7.0",
@@ -105,7 +105,7 @@
"aws-sdk": "^2.1466.0",
"camelcase": "^6.3.0",
"cdk-assets": "0.0.0",
- "cdk-from-cfn": "^0.36.0",
+ "cdk-from-cfn": "^0.45.0",
"chalk": "^4",
"chokidar": "^3.5.3",
"decamelize": "^5.0.1",
@@ -155,4 +155,4 @@
"publishConfig": {
"tag": "latest"
}
-}
+}
\ No newline at end of file
diff --git a/packages/aws-cdk/test/commands/migrate.test.ts b/packages/aws-cdk/test/commands/migrate.test.ts
index 111ef36c2aa1a..9453030af9dcd 100644
--- a/packages/aws-cdk/test/commands/migrate.test.ts
+++ b/packages/aws-cdk/test/commands/migrate.test.ts
@@ -123,8 +123,8 @@ describe('Migrate Function Tests', () => {
expect(app.map(line => line.match(/new GoodTypeScriptStack\(app, \'GoodTypeScript\', \{/)).filter(line => line).length).toEqual(1);
// Replaced stack file is correctly generated
- const replacedStack = fs.readFileSync(path.join(workDir, 'GoodTypeScript', 'lib', 'good_type_script-stack.ts'));
- expect(replacedStack).toEqual(fs.readFileSync(path.join(...stackPath, 's3-stack.ts')));
+ const replacedStack = fs.readFileSync(path.join(workDir, 'GoodTypeScript', 'lib', 'good_type_script-stack.ts'), 'utf8');
+ expect(replacedStack).toEqual(fs.readFileSync(path.join(...stackPath, 's3-stack.ts'), 'utf8'));
});
cliTest('generateCdkApp generates the expected cdk app when called for python', async (workDir) => {
@@ -142,8 +142,8 @@ describe('Migrate Function Tests', () => {
expect(app.map(line => line.match(/GoodPythonStack\(app, "GoodPython",/)).filter(line => line).length).toEqual(1);
// Replaced stack file is correctly generated
- const replacedStack = fs.readFileSync(path.join(workDir, 'GoodPython', 'good_python', 'good_python_stack.py'));
- expect(replacedStack).toEqual(fs.readFileSync(path.join(...stackPath, 's3_stack.py')));
+ const replacedStack = fs.readFileSync(path.join(workDir, 'GoodPython', 'good_python', 'good_python_stack.py'), 'utf8');
+ expect(replacedStack).toEqual(fs.readFileSync(path.join(...stackPath, 's3_stack.py'), 'utf8'));
});
cliTest('generateCdkApp generates the expected cdk app when called for java', async (workDir) => {
@@ -161,8 +161,8 @@ describe('Migrate Function Tests', () => {
expect(app.map(line => line.match(/ new GoodJavaStack\(app, "GoodJava", StackProps.builder()/)).filter(line => line).length).toEqual(1);
// Replaced stack file is correctly generated
- const replacedStack = fs.readFileSync(path.join(workDir, 'GoodJava', 'src', 'main', 'java', 'com', 'myorg', 'GoodJavaStack.java'));
- expect(replacedStack).toEqual(fs.readFileSync(path.join(...stackPath, 'S3Stack.java')));
+ const replacedStack = fs.readFileSync(path.join(workDir, 'GoodJava', 'src', 'main', 'java', 'com', 'myorg', 'GoodJavaStack.java'), 'utf8');
+ expect(replacedStack).toEqual(fs.readFileSync(path.join(...stackPath, 'S3Stack.java'), 'utf8'));
});
cliTest('generateCdkApp generates the expected cdk app when called for csharp', async (workDir) => {
@@ -180,8 +180,8 @@ describe('Migrate Function Tests', () => {
expect(app.map(line => line.match(/ new GoodCSharpStack\(app, "GoodCSharp", new StackProps/)).filter(line => line).length).toEqual(1);
// Replaced stack file is correctly generated
- const replacedStack = fs.readFileSync(path.join(workDir, 'GoodCSharp', 'src', 'GoodCSharp', 'GoodCSharpStack.cs'));
- expect(replacedStack).toEqual(fs.readFileSync(path.join(...stackPath, 'S3Stack.cs')));
+ const replacedStack = fs.readFileSync(path.join(workDir, 'GoodCSharp', 'src', 'GoodCSharp', 'GoodCSharpStack.cs'), 'utf8');
+ expect(replacedStack).toEqual(fs.readFileSync(path.join(...stackPath, 'S3Stack.cs'), 'utf8'));
});
cliTest('generatedCdkApp generates the expected cdk app when called for go', async (workDir) => {
diff --git a/packages/aws-cdk/test/commands/test-resources/stacks/S3Stack.java b/packages/aws-cdk/test/commands/test-resources/stacks/S3Stack.java
index d41acc77d5211..5c3688f99f153 100644
--- a/packages/aws-cdk/test/commands/test-resources/stacks/S3Stack.java
+++ b/packages/aws-cdk/test/commands/test-resources/stacks/S3Stack.java
@@ -3,12 +3,12 @@
import software.constructs.Construct;
import java.util.*;
-import software.amazon.awscdk.*;
import software.amazon.awscdk.CfnMapping;
import software.amazon.awscdk.CfnTag;
import software.amazon.awscdk.Stack;
import software.amazon.awscdk.StackProps;
+import software.amazon.awscdk.*;
import software.amazon.awscdk.services.s3.*;
class GoodJavaStack extends Stack {
diff --git a/packages/aws-cdk/test/commands/test-resources/stacks/s3_stack.py b/packages/aws-cdk/test/commands/test-resources/stacks/s3_stack.py
index 44ea44ec1b29e..374b3ea813510 100644
--- a/packages/aws-cdk/test/commands/test-resources/stacks/s3_stack.py
+++ b/packages/aws-cdk/test/commands/test-resources/stacks/s3_stack.py
@@ -7,15 +7,6 @@
AWS CloudFormation Sample Template S3_Website_Bucket_With_Retain_On_Delete: Sample template showing how to create a publicly accessible S3 bucket configured for website access with a deletion policy of retain on delete.
"""
class GoodPythonStack(Stack):
- """
- URL for website hosted on S3
- """
- global website_u_r_l
- """
- Name of S3 bucket to hold website content
- """
- global s3_bucket_secure_u_r_l
-
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
@@ -30,18 +21,26 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
s3Bucket.cfn_options.deletion_policy = cdk.CfnDeletionPolicy.RETAIN
# Outputs
- self.website_u_r_l = s3Bucket.attr_website_u_r_l
+ """
+ URL for website hosted on S3
+ """
+ self.website_url = s3Bucket.attr_website_url
cdk.CfnOutput(self, 'WebsiteURL',
description = 'URL for website hosted on S3',
- value = self.website_u_r_l,
+ value = str(self.website_url),
)
- self.s3_bucket_secure_u_r_l = [
+
+ """
+ Name of S3 bucket to hold website content
+ """
+ self.s3_bucket_secure_url = ''.join([
'https://',
s3Bucket.attr_domain_name,
- ].join('')
+ ])
cdk.CfnOutput(self, 'S3BucketSecureURL',
description = 'Name of S3 bucket to hold website content',
- value = self.s3_bucket_secure_u_r_l,
+ value = str(self.s3_bucket_secure_url),
)
+
diff --git a/yarn.lock b/yarn.lock
index 1e9c133c58b53..ef5edcc5a5bbf 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5343,10 +5343,10 @@ case@1.6.3, case@^1.6.3:
resolved "https://registry.npmjs.org/case/-/case-1.6.3.tgz#0a4386e3e9825351ca2e6216c60467ff5f1ea1c9"
integrity sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ==
-cdk-from-cfn@^0.36.0:
- version "0.36.0"
- resolved "https://registry.npmjs.org/cdk-from-cfn/-/cdk-from-cfn-0.36.0.tgz#d5363d8475e10e09bcb7e8f5a64df19b8794df87"
- integrity sha512-UWDcoLhph/1qUul2u7V2C2MMlbWGo4VhguyWEOHVDTSN4CZ/XuMH3GNDCaNVoQgeLh/GVJFtZAd92WUZNzj4hw==
+cdk-from-cfn@^0.45.0:
+ version "0.45.0"
+ resolved "https://registry.npmjs.org/cdk-from-cfn/-/cdk-from-cfn-0.45.0.tgz#525c6969d2c74c8aba12bd7f45be6fe75967318b"
+ integrity sha512-ByVbADPN3QPlsLxMcANMSbXy53SQzd7wIg9G2YdK+kYopfJ3qLfvmzKAVxiPm248zQyb22SwVmUDtlMvgk9kRA==
cdk-generate-synthetic-examples@^0.1.291:
version "0.1.291"
From 36fa1b82cc35891e3ce0c9fb277fc42ceae60805 Mon Sep 17 00:00:00 2001
From: Kendra Neil <53584728+TheRealAmazonKendra@users.noreply.github.com>
Date: Thu, 5 Oct 2023 11:11:59 -0700
Subject: [PATCH 2/2] newest version
---
packages/@aws-cdk/cli-lib-alpha/THIRD_PARTY_LICENSES | 12 ++++++------
packages/aws-cdk/THIRD_PARTY_LICENSES | 2 +-
packages/aws-cdk/package.json | 6 +++---
.../test/commands/test-resources/stacks/s3-stack.ts | 8 ++++++++
yarn.lock | 8 ++++----
5 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/packages/@aws-cdk/cli-lib-alpha/THIRD_PARTY_LICENSES b/packages/@aws-cdk/cli-lib-alpha/THIRD_PARTY_LICENSES
index 2d7b53c8de349..8a792ecf69c82 100644
--- a/packages/@aws-cdk/cli-lib-alpha/THIRD_PARTY_LICENSES
+++ b/packages/@aws-cdk/cli-lib-alpha/THIRD_PARTY_LICENSES
@@ -1,6 +1,6 @@
The @aws-cdk/cli-lib-alpha package includes the following third-party software/licensing:
-** @jsii/check-node@1.88.0 - https://www.npmjs.com/package/@jsii/check-node/v/1.88.0 | Apache-2.0
+** @jsii/check-node@1.89.0 - https://www.npmjs.com/package/@jsii/check-node/v/1.89.0 | Apache-2.0
jsii
Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -264,7 +264,7 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH RE
----------------
-** aws-sdk@2.1461.0 - https://www.npmjs.com/package/aws-sdk/v/2.1461.0 | Apache-2.0
+** aws-sdk@2.1466.0 - https://www.npmjs.com/package/aws-sdk/v/2.1466.0 | Apache-2.0
AWS SDK for JavaScript
Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -461,7 +461,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
----------------
-** cdk-from-cfn@0.45.0 - https://www.npmjs.com/package/cdk-from-cfn/v/0.45.0 | MIT OR Apache-2.0
+** cdk-from-cfn@0.47.0 - https://www.npmjs.com/package/cdk-from-cfn/v/0.47.0 | MIT OR Apache-2.0
----------------
@@ -2717,10 +2717,10 @@ THE SOFTWARE.
----------------
-** sax@1.2.4 - https://www.npmjs.com/package/sax/v/1.2.4 | ISC
+** sax@1.3.0 - https://www.npmjs.com/package/sax/v/1.3.0 | ISC
The ISC License
-Copyright (c) Isaac Z. Schlueter and Contributors
+Copyright (c) 2010-2022 Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -2739,7 +2739,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
`String.fromCodePoint` by Mathias Bynens used according to terms of MIT
License, as follows:
- Copyright Mathias Bynens
+Copyright (c) 2010-2022 Mathias Bynens
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/packages/aws-cdk/THIRD_PARTY_LICENSES b/packages/aws-cdk/THIRD_PARTY_LICENSES
index f89f4ee4f5e58..cf66d05dcfa6c 100644
--- a/packages/aws-cdk/THIRD_PARTY_LICENSES
+++ b/packages/aws-cdk/THIRD_PARTY_LICENSES
@@ -461,7 +461,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
----------------
-** cdk-from-cfn@0.45.0 - https://www.npmjs.com/package/cdk-from-cfn/v/0.45.0 | MIT OR Apache-2.0
+** cdk-from-cfn@0.47.0 - https://www.npmjs.com/package/cdk-from-cfn/v/0.47.0 | MIT OR Apache-2.0
----------------
diff --git a/packages/aws-cdk/package.json b/packages/aws-cdk/package.json
index 536f6976f8a1c..320aacb543cc0 100644
--- a/packages/aws-cdk/package.json
+++ b/packages/aws-cdk/package.json
@@ -82,7 +82,7 @@
"aws-cdk-lib": "0.0.0",
"aws-sdk-mock": "5.6.0",
"axios": "^0.27.2",
- "cdk-from-cfn": "^0.45.0",
+ "cdk-from-cfn": "^0.47.0",
"constructs": "^10.0.0",
"fast-check": "^3.13.1",
"jest": "^29.7.0",
@@ -105,7 +105,7 @@
"aws-sdk": "^2.1466.0",
"camelcase": "^6.3.0",
"cdk-assets": "0.0.0",
- "cdk-from-cfn": "^0.45.0",
+ "cdk-from-cfn": "^0.47.0",
"chalk": "^4",
"chokidar": "^3.5.3",
"decamelize": "^5.0.1",
@@ -155,4 +155,4 @@
"publishConfig": {
"tag": "latest"
}
-}
\ No newline at end of file
+}
diff --git a/packages/aws-cdk/test/commands/test-resources/stacks/s3-stack.ts b/packages/aws-cdk/test/commands/test-resources/stacks/s3-stack.ts
index 8172e16a6e0b4..dcdbd7178d3a1 100644
--- a/packages/aws-cdk/test/commands/test-resources/stacks/s3-stack.ts
+++ b/packages/aws-cdk/test/commands/test-resources/stacks/s3-stack.ts
@@ -32,9 +32,17 @@ export class GoodTypeScriptStack extends cdk.Stack {
// Outputs
this.websiteUrl = s3Bucket.attrWebsiteUrl;
+ new cdk.CfnOutput(this, 'WebsiteURL', {
+ description: 'URL for website hosted on S3',
+ value: this.websiteUrl!.toString(),
+ });
this.s3BucketSecureUrl = [
'https://',
s3Bucket.attrDomainName,
].join('');
+ new cdk.CfnOutput(this, 'S3BucketSecureURL', {
+ description: 'Name of S3 bucket to hold website content',
+ value: this.s3BucketSecureUrl!.toString(),
+ });
}
}
diff --git a/yarn.lock b/yarn.lock
index 363cd4e167227..95dcea7efcb4a 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5515,10 +5515,10 @@ case@1.6.3, case@^1.6.3:
resolved "https://registry.npmjs.org/case/-/case-1.6.3.tgz#0a4386e3e9825351ca2e6216c60467ff5f1ea1c9"
integrity sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ==
-cdk-from-cfn@^0.45.0:
- version "0.45.0"
- resolved "https://registry.npmjs.org/cdk-from-cfn/-/cdk-from-cfn-0.45.0.tgz#525c6969d2c74c8aba12bd7f45be6fe75967318b"
- integrity sha512-ByVbADPN3QPlsLxMcANMSbXy53SQzd7wIg9G2YdK+kYopfJ3qLfvmzKAVxiPm248zQyb22SwVmUDtlMvgk9kRA==
+cdk-from-cfn@^0.47.0:
+ version "0.47.0"
+ resolved "https://registry.npmjs.org/cdk-from-cfn/-/cdk-from-cfn-0.47.0.tgz#76998b826245ba28809746a173ef1f844294c32b"
+ integrity sha512-GNTTgBlFT1A2WezIeH4pjoTE2zuRJxpjl3emQCiTpQmDeTeQSfe30fvatrKc4Dn0TJZtNhTubpRJeRf2dfDDeA==
cdk-generate-synthetic-examples@^0.1.291:
version "0.1.291"