Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into alexcheema/docker-p…
Browse files Browse the repository at this point in the history
…arcel-bundler
  • Loading branch information
AlexCheema committed Apr 4, 2020
2 parents 157281e + 7b1e80d commit 74383e2
Show file tree
Hide file tree
Showing 17 changed files with 97 additions and 78 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^25.1.5",
"@types/jest": "^25.2.1",
"cdk-build-tools": "0.0.0",
"jest": "^24.9.0",
"pkglint": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-dynamodb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@types/jest": "^25.1.5",
"@types/jest": "^25.2.1",
"aws-sdk": "^2.653.0",
"aws-sdk-mock": "^5.1.0",
"cdk-build-tools": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-sam/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@types/jest": "^25.1.5",
"@types/jest": "^25.2.1",
"cdk-build-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^24.9.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk-assets-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^25.1.5",
"@types/jest": "^25.2.1",
"cdk-build-tools": "0.0.0",
"jest": "^24.9.0",
"pkglint": "0.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cloudformation-diff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"table": "^5.4.6"
},
"devDependencies": {
"@types/jest": "^25.1.5",
"@types/jest": "^25.2.1",
"@types/string-width": "^4.0.1",
"@types/table": "^4.0.7",
"cdk-build-tools": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cx-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^25.1.5",
"@types/jest": "^25.2.1",
"@types/mock-fs": "^4.10.0",
"@types/semver": "^7.1.0",
"cdk-build-tools": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@monocdk-experiment/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^25.1.5",
"@types/jest": "^25.2.1",
"cdk-build-tools": "0.0.0",
"jest": "^24.9.0",
"pkglint": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@monocdk-experiment/rewrite-imports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"devDependencies": {
"@types/glob": "^7.1.1",
"@types/jest": "^25.1.5",
"@types/jest": "^25.2.1",
"@types/node": "^10.17.18",
"cdk-build-tools": "0.0.0",
"pkglint": "0.0.0"
Expand Down
38 changes: 34 additions & 4 deletions packages/aws-cdk/lib/api/util/cloudformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ export class CloudFormationStack {
protected constructor(private readonly cfn: CloudFormation, public readonly stackName: string, private readonly stack?: CloudFormation.Stack) {
}

/**
* Retrieve the stack's deployed template
*
* Cached, so will only be retrieved once. Will throw an error
* if the stack does not exist.
*/
public async template(): Promise<Template> {
if (this._template === undefined) {
const response = await this.cfn.getTemplate({ StackName: this.stackName, TemplateStage: 'Original' }).promise();
Expand All @@ -45,38 +51,62 @@ export class CloudFormationStack {
return this._template;
}

/**
* Whether the stack exists
*/
public get exists() {
return this.stack !== undefined;
}

/**
* The stack's ID
*
* Throws if the stack doesn't exist.
*/
public get stackId() {
this.assertExists();
return this.stack!.StackId!;
}

/**
* The stack's current outputs
*
* Empty object if the stack doesn't exist
*/
public get outputs(): Record<string, string> {
this.assertExists();
if (!this.exists) { return {}; }
const result: { [name: string]: string } = {};
(this.stack!.Outputs || []).forEach(output => {
result[output.OutputKey!] = output.OutputValue!;
});
return result;
}

/**
* The stack's status
*
* Special status NOT_FOUND if the stack does not exist.
*/
public get stackStatus(): StackStatus {
if (!this.exists) {
return new StackStatus('NOT_FOUND', `Stack not found during lookup`);
}
return StackStatus.fromStackDescription(this.stack!);
}

/**
* The stack's current tags
*
* Empty list of the stack does not exist
*/
public get tags(): CloudFormation.Tags {
this.assertExists();
return this.stack!.Tags || [];
return this.stack?.Tags || [];
}

/**
* Return the names of all parameters
* Return the names of all current parameters to the stack
*
* Empty list if the stack does not exist.
*/
public get parameterNames(): string[] {
return this.exists ? (this.stack!.Parameters || []).map(p => p.ParameterKey!) : [];
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@types/archiver": "^3.1.0",
"@types/fs-extra": "^8.1.0",
"@types/glob": "^7.1.1",
"@types/jest": "^25.1.5",
"@types/jest": "^25.2.1",
"@types/minimatch": "^3.0.3",
"@types/mockery": "^1.4.29",
"@types/node": "^10.17.18",
Expand Down
14 changes: 14 additions & 0 deletions packages/aws-cdk/test/api/deploy-stack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,20 @@ test('deploy not skipped if template changed', async () => {
expect(cfnMocks.executeChangeSet).toHaveBeenCalled();
});

test('not executed and no error if --no-execute is given', async () => {
// WHEN
await deployStack({
stack: FAKE_STACK,
sdk,
sdkProvider,
execute: false,
resolvedEnvironment: mockResolvedEnvironment(),
});

// THEN
expect(cfnMocks.executeChangeSet).not.toHaveBeenCalled();
});

/**
* Set up the mocks so that it looks like the stack exists to start with
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/cdk-assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"devDependencies": {
"@types/archiver": "^3.1.0",
"@types/glob": "^7.1.1",
"@types/jest": "^25.1.5",
"@types/jest": "^25.2.1",
"@types/mock-fs": "^4.10.0",
"@types/node": "^10.17.18",
"@types/yargs": "^15.0.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/cdk-dasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"yaml": "1.8.3"
},
"devDependencies": {
"@types/jest": "^25.1.5",
"@types/jest": "^25.2.1",
"@types/yaml": "1.2.0",
"jest": "^24.9.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/decdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
},
"devDependencies": {
"@types/fs-extra": "^8.1.0",
"@types/jest": "^25.1.5",
"@types/jest": "^25.2.1",
"@types/yaml": "1.2.0",
"@types/yargs": "^15.0.4",
"jest": "^24.9.0",
Expand Down
2 changes: 1 addition & 1 deletion tools/cdk-build-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"license": "Apache-2.0",
"devDependencies": {
"@types/fs-extra": "^8.1.0",
"@types/jest": "^25.1.5",
"@types/jest": "^25.2.1",
"@types/yargs": "^15.0.4",
"pkglint": "0.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion tools/cfn2ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"devDependencies": {
"@types/fs-extra": "^8.1.0",
"@types/jest": "^25.1.5",
"@types/jest": "^25.2.1",
"@types/yargs": "^15.0.4",
"cdk-build-tools": "0.0.0",
"jest": "^24.9.0",
Expand Down
95 changes: 35 additions & 60 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -542,20 +542,20 @@
"@types/istanbul-reports" "^1.1.1"
"@types/yargs" "^13.0.0"

"@jest/types@^25.1.0":
version "25.1.0"
resolved "https://registry.yarnpkg.com/@jest/types/-/types-25.1.0.tgz#b26831916f0d7c381e11dbb5e103a72aed1b4395"
integrity sha512-VpOtt7tCrgvamWZh1reVsGADujKigBUFTi19mlRjqEGsE8qH4r3s+skY33dNdXOwyZIvuftZ5tqdF1IgsMejMA==
"@jest/types@^25.2.3":
version "25.2.3"
resolved "https://registry.yarnpkg.com/@jest/types/-/types-25.2.3.tgz#035c4fb94e2da472f359ff9a211915d59987f6b6"
integrity sha512-6oLQwO9mKif3Uph3RX5J1i3S7X7xtDHWBaaaoeKw8hOzV6YUd0qDcYcHZ6QXMHDIzSr7zzrEa51o2Ovlj6AtKQ==
dependencies:
"@types/istanbul-lib-coverage" "^2.0.0"
"@types/istanbul-reports" "^1.1.1"
"@types/yargs" "^15.0.0"
chalk "^3.0.0"

"@jest/types@^25.2.3":
version "25.2.3"
resolved "https://registry.yarnpkg.com/@jest/types/-/types-25.2.3.tgz#035c4fb94e2da472f359ff9a211915d59987f6b6"
integrity sha512-6oLQwO9mKif3Uph3RX5J1i3S7X7xtDHWBaaaoeKw8hOzV6YUd0qDcYcHZ6QXMHDIzSr7zzrEa51o2Ovlj6AtKQ==
"@jest/types@^25.2.6":
version "25.2.6"
resolved "https://registry.yarnpkg.com/@jest/types/-/types-25.2.6.tgz#c12f44af9bed444438091e4b59e7ed05f8659cb6"
integrity sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ==
dependencies:
"@types/istanbul-lib-coverage" "^2.0.0"
"@types/istanbul-reports" "^1.1.1"
Expand Down Expand Up @@ -1492,13 +1492,13 @@
"@types/istanbul-lib-coverage" "*"
"@types/istanbul-lib-report" "*"

"@types/jest@^25.1.5":
version "25.1.5"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-25.1.5.tgz#3c3c078b3cd19c6403e21277f1cfdc0ce5ebf9a9"
integrity sha512-FBmb9YZHoEOH56Xo/PIYtfuyTL0IzJLM3Hy0Sqc82nn5eqqXgefKcl/eMgChM8eSGVfoDee8cdlj7K74T8a6Yg==
"@types/jest@^25.2.1":
version "25.2.1"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-25.2.1.tgz#9544cd438607955381c1bdbdb97767a249297db5"
integrity sha512-msra1bCaAeEdkSyA0CZ6gW1ukMIvZ5YoJkdXw/qhQdsuuDlFTcEUrUw8CLCPt2rVRUfXlClVvK2gvPs9IokZaA==
dependencies:
jest-diff "25.1.0"
pretty-format "25.1.0"
jest-diff "^25.2.1"
pretty-format "^25.2.1"

"@types/json-schema@^7.0.3":
version "7.0.4"
Expand Down Expand Up @@ -3448,15 +3448,10 @@ diff-sequences@^24.9.0:
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5"
integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew==

diff-sequences@^25.1.0:
version "25.1.0"
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-25.1.0.tgz#fd29a46f1c913fd66c22645dc75bffbe43051f32"
integrity sha512-nFIfVk5B/NStCsJ+zaPO4vYuLjlzQ6uFvPxzYyHlejNZ/UGa7G/n7peOXVrVNvRuyfstt+mZQYGpjxg9Z6N8Kw==

diff-sequences@^25.2.1:
version "25.2.1"
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-25.2.1.tgz#fcfe8aa07dd9b0c648396a478dabca8e76c6ab27"
integrity sha512-foe7dXnGlSh3jR1ovJmdv+77VQj98eKCHHwJPbZ2eEf0fHwKbkZicpPxEch9smZ+n2dnF6QFwkOQdLq9hpeJUg==
diff-sequences@^25.2.6:
version "25.2.6"
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-25.2.6.tgz#5f467c00edd35352b7bca46d7927d60e687a76dd"
integrity sha512-Hq8o7+6GaZeoFjtpgvRBUknSXNeJiCx7V9Fr94ZMljNiCr9n9L8H8aJqgWOQiDDGdyn29fRNcDdRVJ5fdyihfg==

diff@^1.3.2:
version "1.4.0"
Expand Down Expand Up @@ -5549,16 +5544,6 @@ jest-config@^25.2.4:
pretty-format "^25.2.3"
realpath-native "^2.0.0"

jest-diff@25.1.0:
version "25.1.0"
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-25.1.0.tgz#58b827e63edea1bc80c1de952b80cec9ac50e1ad"
integrity sha512-nepXgajT+h017APJTreSieh4zCqnSHEJ1iT8HDlewu630lSJ4Kjjr9KNzm+kzGwwcpsDE6Snx1GJGzzsefaEHw==
dependencies:
chalk "^3.0.0"
diff-sequences "^25.1.0"
jest-get-type "^25.1.0"
pretty-format "^25.1.0"

jest-diff@^24.9.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da"
Expand All @@ -5569,15 +5554,15 @@ jest-diff@^24.9.0:
jest-get-type "^24.9.0"
pretty-format "^24.9.0"

jest-diff@^25.2.3:
version "25.2.3"
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-25.2.3.tgz#54d601a0a754ef26e808a8c8dbadd278c215aa3f"
integrity sha512-VtZ6LAQtaQpFsmEzps15dQc5ELbJxy4L2DOSo2Ev411TUEtnJPkAMD7JneVypeMJQ1y3hgxN9Ao13n15FAnavg==
jest-diff@^25.2.1, jest-diff@^25.2.3:
version "25.2.6"
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-25.2.6.tgz#a6d70a9ab74507715ea1092ac513d1ab81c1b5e7"
integrity sha512-KuadXImtRghTFga+/adnNrv9s61HudRMR7gVSbP35UKZdn4IK2/0N0PpGZIqtmllK9aUyye54I3nu28OYSnqOg==
dependencies:
chalk "^3.0.0"
diff-sequences "^25.2.1"
jest-get-type "^25.2.1"
pretty-format "^25.2.3"
diff-sequences "^25.2.6"
jest-get-type "^25.2.6"
pretty-format "^25.2.6"

jest-docblock@^24.3.0:
version "24.9.0"
Expand Down Expand Up @@ -5667,16 +5652,16 @@ jest-get-type@^24.9.0:
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.9.0.tgz#1684a0c8a50f2e4901b6644ae861f579eed2ef0e"
integrity sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q==

jest-get-type@^25.1.0:
version "25.1.0"
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-25.1.0.tgz#1cfe5fc34f148dc3a8a3b7275f6b9ce9e2e8a876"
integrity sha512-yWkBnT+5tMr8ANB6V+OjmrIJufHtCAqI5ic2H40v+tRqxDmE0PGnIiTyvRWFOMtmVHYpwRqyazDbTnhpjsGvLw==

jest-get-type@^25.2.1:
version "25.2.1"
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-25.2.1.tgz#6c83de603c41b1627e6964da2f5454e6aa3c13a6"
integrity sha512-EYjTiqcDTCRJDcSNKbLTwn/LcDPEE7ITk8yRMNAOjEsN6yp+Uu+V1gx4djwnuj/DvWg0YGmqaBqPVGsPxlvE7w==

jest-get-type@^25.2.6:
version "25.2.6"
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-25.2.6.tgz#0b0a32fab8908b44d508be81681487dbabb8d877"
integrity sha512-DxjtyzOHjObRM+sM1knti6or+eOgcGU4xVSb2HNP1TqO4ahsT+rqZg+nyqHWJSvWgKC5cG3QjGFBqxLghiF/Ig==

jest-haste-map@^24.9.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.9.0.tgz#b38a5d64274934e21fa417ae9a9fbeb77ceaac7d"
Expand Down Expand Up @@ -8039,16 +8024,6 @@ prelude-ls@~1.1.2:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=

pretty-format@25.1.0:
version "25.1.0"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.1.0.tgz#ed869bdaec1356fc5ae45de045e2c8ec7b07b0c8"
integrity sha512-46zLRSGLd02Rp+Lhad9zzuNZ+swunitn8zIpfD2B4OPCRLXbM87RJT2aBLBWYOznNUML/2l/ReMyWNC80PJBUQ==
dependencies:
"@jest/types" "^25.1.0"
ansi-regex "^5.0.0"
ansi-styles "^4.0.0"
react-is "^16.12.0"

pretty-format@^24.9.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9"
Expand All @@ -8059,12 +8034,12 @@ pretty-format@^24.9.0:
ansi-styles "^3.2.0"
react-is "^16.8.4"

pretty-format@^25.1.0, pretty-format@^25.2.3:
version "25.2.3"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.2.3.tgz#ba6e9603a0d80fa2e470b1fed55de1f9bfd81421"
integrity sha512-IP4+5UOAVGoyqC/DiomOeHBUKN6q00gfyT2qpAsRH64tgOKB2yF7FHJXC18OCiU0/YFierACup/zdCOWw0F/0w==
pretty-format@^25.2.1, pretty-format@^25.2.3, pretty-format@^25.2.6:
version "25.2.6"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.2.6.tgz#542a1c418d019bbf1cca2e3620443bc1323cb8d7"
integrity sha512-DEiWxLBaCHneffrIT4B+TpMvkV9RNvvJrd3lY9ew1CEQobDzEXmYT1mg0hJhljZty7kCc10z13ohOFAE8jrUDg==
dependencies:
"@jest/types" "^25.2.3"
"@jest/types" "^25.2.6"
ansi-regex "^5.0.0"
ansi-styles "^4.0.0"
react-is "^16.12.0"
Expand Down

0 comments on commit 74383e2

Please sign in to comment.