Skip to content

Commit 86c1320

Browse files
authored
chore: upgrade cdk-from-cfn dependency to 0.157.0 (#29967)
### Reason for this change The latest version of `cdk-from-cfn` is 0.157.0 which has introduced improved error types and error messages. As a result, I am manually bumping the version so that I can fix the unit tests that were testing the old error messages. ### Description of changes Bumped `cdk-from-cfn` to 0.157.0, updated our error handling, and fixed broken unit tests. ### Description of how you validated changes Fixed broken unit tests and ensured that no existing unit tests are failing. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent c949076 commit 86c1320

File tree

6 files changed

+13
-41
lines changed

6 files changed

+13
-41
lines changed

packages/aws-cdk/THIRD_PARTY_LICENSES

+1-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
484484

485485
----------------
486486

487-
** cdk-from-cfn@0.156.0 - https://www.npmjs.com/package/cdk-from-cfn/v/0.156.0 | MIT OR Apache-2.0
487+
** cdk-from-cfn@0.157.0 - https://www.npmjs.com/package/cdk-from-cfn/v/0.157.0 | MIT OR Apache-2.0
488488

489489
----------------
490490

packages/aws-cdk/lib/commands/migrate.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,7 @@ export function generateStack(template: string, stackName: string, language: str
8686
try {
8787
return cdk_from_cfn.transmute(template, language, formattedStackName);
8888
} catch (e) {
89-
const errorMessage = (e as Error).message === 'unreachable'
90-
? 'template and/or language inputs caused the source code to panic'
91-
: (e as Error).message.replace('TransmuteError: ', '');
92-
throw new Error(`${formattedStackName} could not be generated because ${errorMessage}`);
89+
throw new Error(`${formattedStackName} could not be generated because ${(e as Error).message}`);
9390
}
9491
}
9592

packages/aws-cdk/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
"aws-sdk": "^2.1600.0",
106106
"camelcase": "^6.3.0",
107107
"cdk-assets": "0.0.0",
108-
"cdk-from-cfn": "^0.156.0",
108+
"cdk-from-cfn": "^0.157.0",
109109
"chalk": "^4",
110110
"chokidar": "^3.6.0",
111111
"decamelize": "^5.0.1",

packages/aws-cdk/test/cdk-toolkit.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,8 @@ describe('synth', () => {
916916
stackName: 'cannot-generate-template',
917917
fromPath: path.join(__dirname, 'commands', 'test-resources', 'templates', 'sqs-template.json'),
918918
language: 'rust',
919-
})).rejects.toThrowError('CannotGenerateTemplateStack could not be generated because template and/or language inputs caused the source code to panic');
920-
expect(stderrMock.mock.calls[1][0]).toContain(' ❌ Migrate failed for `cannot-generate-template`: CannotGenerateTemplateStack could not be generated because template and/or language inputs caused the source code to panic');
919+
})).rejects.toThrowError('CannotGenerateTemplateStack could not be generated because rust is not a supported language');
920+
expect(stderrMock.mock.calls[1][0]).toContain(' ❌ Migrate failed for `cannot-generate-template`: CannotGenerateTemplateStack could not be generated because rust is not a supported language');
921921
});
922922

923923
cliTest('migrate succeeds for valid template from local path when no lanugage is provided', async (workDir) => {

packages/aws-cdk/test/commands/migrate.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ describe('Migrate Function Tests', () => {
134134
});
135135

136136
test('generateStack throws error when called for other language', () => {
137-
expect(() => generateStack(validTemplate, 'BadBadBad', 'php')).toThrowError('BadBadBadStack could not be generated because template and/or language inputs caused the source code to panic');
137+
expect(() => generateStack(validTemplate, 'BadBadBad', 'php')).toThrowError('BadBadBadStack could not be generated because php is not a supported language');
138138
});
139139

140140
test('generateStack throws error for invalid resource property', () => {

yarn.lock

+7-32
Original file line numberDiff line numberDiff line change
@@ -6884,10 +6884,10 @@ [email protected], case@^1.6.3:
68846884
resolved "https://registry.npmjs.org/case/-/case-1.6.3.tgz#0a4386e3e9825351ca2e6216c60467ff5f1ea1c9"
68856885
integrity sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ==
68866886

6887-
cdk-from-cfn@^0.156.0:
6888-
version "0.156.0"
6889-
resolved "https://registry.npmjs.org/cdk-from-cfn/-/cdk-from-cfn-0.156.0.tgz#921134095983db664bd68556463dcde115d73cdb"
6890-
integrity sha512-nYK6SCC4yOPPxkPbrg23d6wTiu6Mtms5dWPI9kymwblpcXfIr+YaoiVlvlT9CFyyddGugG7AaTA6UN7U9LUOAg==
6887+
cdk-from-cfn@^0.157.0:
6888+
version "0.157.0"
6889+
resolved "https://registry.npmjs.org/cdk-from-cfn/-/cdk-from-cfn-0.157.0.tgz#4ff0dcd8f31c52561127c462358d72090ad9178a"
6890+
integrity sha512-CQdB41IdhEG6lQx+KDnmttwWntendz0IVJwU8BFBNhT+Ci9hTR9pxxtqzV32Hl4d3uH0XeH/b/V2xcD/sMBP2A==
68916891

68926892
cdk-generate-synthetic-examples@^0.2.0:
68936893
version "0.2.0"
@@ -14809,16 +14809,7 @@ string-length@^4.0.1:
1480914809
char-regex "^1.0.2"
1481014810
strip-ansi "^6.0.0"
1481114811

14812-
"string-width-cjs@npm:string-width@^4.2.0":
14813-
version "4.2.3"
14814-
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
14815-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
14816-
dependencies:
14817-
emoji-regex "^8.0.0"
14818-
is-fullwidth-code-point "^3.0.0"
14819-
strip-ansi "^6.0.1"
14820-
14821-
string-width@*, string-width@^1.0.1, "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3, string-width@^5.0.1, string-width@^5.1.2:
14812+
"string-width-cjs@npm:string-width@^4.2.0", string-width@*, string-width@^1.0.1, "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3, string-width@^5.0.1, string-width@^5.1.2:
1482214813
version "4.2.3"
1482314814
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
1482414815
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -14896,7 +14887,7 @@ stringify-package@^1.0.1:
1489614887
resolved "https://registry.npmjs.org/stringify-package/-/stringify-package-1.0.1.tgz#e5aa3643e7f74d0f28628b72f3dad5cecfc3ba85"
1489714888
integrity sha512-sa4DUQsYciMP1xhKWGuFM04fB0LG/9DlluZoSVywUMRNvzid6XucHK0/90xGxRoHrAaROrcHK1aPKaijCtSrhg==
1489814889

14899-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
14890+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
1490014891
version "6.0.1"
1490114892
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
1490214893
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -14910,13 +14901,6 @@ strip-ansi@^3.0.1:
1491014901
dependencies:
1491114902
ansi-regex "^2.0.0"
1491214903

14913-
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
14914-
version "6.0.1"
14915-
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
14916-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
14917-
dependencies:
14918-
ansi-regex "^5.0.1"
14919-
1492014904
strip-ansi@^7.0.1, strip-ansi@^7.1.0:
1492114905
version "7.1.0"
1492214906
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
@@ -15897,7 +15881,7 @@ workerpool@^6.5.1:
1589715881
resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544"
1589815882
integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==
1589915883

15900-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
15884+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
1590115885
version "7.0.0"
1590215886
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
1590315887
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -15915,15 +15899,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0:
1591515899
string-width "^4.1.0"
1591615900
strip-ansi "^6.0.0"
1591715901

15918-
wrap-ansi@^7.0.0:
15919-
version "7.0.0"
15920-
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
15921-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
15922-
dependencies:
15923-
ansi-styles "^4.0.0"
15924-
string-width "^4.1.0"
15925-
strip-ansi "^6.0.0"
15926-
1592715902
wrap-ansi@^8.1.0:
1592815903
version "8.1.0"
1592915904
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"

0 commit comments

Comments
 (0)