From c8664b5b4d71a4f05d96ee321abc1889f5005e5b Mon Sep 17 00:00:00 2001 From: corymhall <43035978+corymhall@users.noreply.github.com> Date: Mon, 5 Dec 2022 19:28:47 +0000 Subject: [PATCH 1/2] chore(core): can't override bootstrapQualifier property On newer versions of typescript you will get an error like `'bootstrapQualifier' is defined as a property in class 'StackSynthesizer', but is overridden here in 'DefaultStackSynthesizer' as an accessor.` Just make the property mutable instead. --- .../lib/stack-synthesizers/cli-credentials-synthesizer.ts | 5 +---- .../core/lib/stack-synthesizers/default-synthesizer.ts | 5 +---- packages/@aws-cdk/core/lib/stack-synthesizers/nested.ts | 1 - .../core/lib/stack-synthesizers/stack-synthesizer.ts | 2 +- packages/@aws-cdk/core/lib/stack-synthesizers/types.ts | 2 +- 5 files changed, 4 insertions(+), 11 deletions(-) diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/cli-credentials-synthesizer.ts b/packages/@aws-cdk/core/lib/stack-synthesizers/cli-credentials-synthesizer.ts index 7bdef5d8a051f..0eec4bb88ca04 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/cli-credentials-synthesizer.ts +++ b/packages/@aws-cdk/core/lib/stack-synthesizers/cli-credentials-synthesizer.ts @@ -117,15 +117,12 @@ export class CliCredentialsStackSynthesizer extends StackSynthesizer { } } - public get bootstrapQualifier(): string | undefined { - return this.qualifier; - } - public bind(stack: Stack): void { super.bind(stack); const qualifier = this.props.qualifier ?? stack.node.tryGetContext(BOOTSTRAP_QUALIFIER_CONTEXT) ?? DefaultStackSynthesizer.DEFAULT_QUALIFIER; this.qualifier = qualifier; + this.bootstrapQualifier = this.qualifier; const spec = new StringSpecializer(stack, qualifier); diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts b/packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts index 109029d05e184..b1861ebbdc6fd 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts +++ b/packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts @@ -324,15 +324,12 @@ export class DefaultStackSynthesizer extends StackSynthesizer { } } - public get bootstrapQualifier(): string | undefined { - return this.qualifier; - } - public bind(stack: Stack): void { super.bind(stack); const qualifier = this.props.qualifier ?? stack.node.tryGetContext(BOOTSTRAP_QUALIFIER_CONTEXT) ?? DefaultStackSynthesizer.DEFAULT_QUALIFIER; this.qualifier = qualifier; + this.bootstrapQualifier = this.qualifier; const spec = new StringSpecializer(stack, qualifier); diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/nested.ts b/packages/@aws-cdk/core/lib/stack-synthesizers/nested.ts index bf89868bd0fc6..31a820abd69c9 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/nested.ts +++ b/packages/@aws-cdk/core/lib/stack-synthesizers/nested.ts @@ -11,7 +11,6 @@ import { IStackSynthesizer, ISynthesisSession } from './types'; * App builder do not need to use this class directly. */ export class NestedStackSynthesizer extends StackSynthesizer { - public readonly bootstrapQualifier?: string; constructor(private readonly parentDeployment: IStackSynthesizer) { super(); this.bootstrapQualifier = parentDeployment.bootstrapQualifier; diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/stack-synthesizer.ts b/packages/@aws-cdk/core/lib/stack-synthesizers/stack-synthesizer.ts index d3cbcbcfc1880..39d9bcdc3b413 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/stack-synthesizer.ts +++ b/packages/@aws-cdk/core/lib/stack-synthesizers/stack-synthesizer.ts @@ -19,7 +19,7 @@ import { IStackSynthesizer, ISynthesisSession } from './types'; * and could not be accessed by external implementors. */ export abstract class StackSynthesizer implements IStackSynthesizer { - public readonly bootstrapQualifier?: string; + public bootstrapQualifier?: string; private _boundStack?: Stack; diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/types.ts b/packages/@aws-cdk/core/lib/stack-synthesizers/types.ts index 18c437da224da..290f837c4cb8c 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/types.ts +++ b/packages/@aws-cdk/core/lib/stack-synthesizers/types.ts @@ -11,7 +11,7 @@ export interface IStackSynthesizer { * * @default - no qualifier */ - readonly bootstrapQualifier?: string; + bootstrapQualifier?: string; /** * Bind to the stack this environment is going to be used on From c96eadab3f47c7126406d643cdec3f4caa7594ca Mon Sep 17 00:00:00 2001 From: corymhall <43035978+corymhall@users.noreply.github.com> Date: Mon, 5 Dec 2022 21:04:26 +0000 Subject: [PATCH 2/2] switching things around --- .../lib/stack-synthesizers/cli-credentials-synthesizer.ts | 8 +++++++- .../core/lib/stack-synthesizers/default-synthesizer.ts | 8 +++++++- packages/@aws-cdk/core/lib/stack-synthesizers/nested.ts | 4 ++++ .../core/lib/stack-synthesizers/stack-synthesizer.ts | 2 -- packages/@aws-cdk/core/lib/stack-synthesizers/types.ts | 2 +- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/cli-credentials-synthesizer.ts b/packages/@aws-cdk/core/lib/stack-synthesizers/cli-credentials-synthesizer.ts index 0eec4bb88ca04..66857c02b0b08 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/cli-credentials-synthesizer.ts +++ b/packages/@aws-cdk/core/lib/stack-synthesizers/cli-credentials-synthesizer.ts @@ -117,12 +117,18 @@ export class CliCredentialsStackSynthesizer extends StackSynthesizer { } } + /** + * The qualifier used to bootstrap this stack + */ + public get bootstrapQualifier(): string | undefined { + return this.qualifier; + } + public bind(stack: Stack): void { super.bind(stack); const qualifier = this.props.qualifier ?? stack.node.tryGetContext(BOOTSTRAP_QUALIFIER_CONTEXT) ?? DefaultStackSynthesizer.DEFAULT_QUALIFIER; this.qualifier = qualifier; - this.bootstrapQualifier = this.qualifier; const spec = new StringSpecializer(stack, qualifier); diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts b/packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts index b1861ebbdc6fd..6d5aa60a3517f 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts +++ b/packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts @@ -324,12 +324,18 @@ export class DefaultStackSynthesizer extends StackSynthesizer { } } + /** + * The qualifier used to bootstrap this stack + */ + public get bootstrapQualifier(): string | undefined { + return this.qualifier; + } + public bind(stack: Stack): void { super.bind(stack); const qualifier = this.props.qualifier ?? stack.node.tryGetContext(BOOTSTRAP_QUALIFIER_CONTEXT) ?? DefaultStackSynthesizer.DEFAULT_QUALIFIER; this.qualifier = qualifier; - this.bootstrapQualifier = this.qualifier; const spec = new StringSpecializer(stack, qualifier); diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/nested.ts b/packages/@aws-cdk/core/lib/stack-synthesizers/nested.ts index 31a820abd69c9..6ccccacc5062b 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/nested.ts +++ b/packages/@aws-cdk/core/lib/stack-synthesizers/nested.ts @@ -11,6 +11,10 @@ import { IStackSynthesizer, ISynthesisSession } from './types'; * App builder do not need to use this class directly. */ export class NestedStackSynthesizer extends StackSynthesizer { + /** + * The qualifier used to bootstrap this stack + */ + public readonly bootstrapQualifier?: string; constructor(private readonly parentDeployment: IStackSynthesizer) { super(); this.bootstrapQualifier = parentDeployment.bootstrapQualifier; diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/stack-synthesizer.ts b/packages/@aws-cdk/core/lib/stack-synthesizers/stack-synthesizer.ts index 39d9bcdc3b413..311a648561bd3 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/stack-synthesizer.ts +++ b/packages/@aws-cdk/core/lib/stack-synthesizers/stack-synthesizer.ts @@ -19,8 +19,6 @@ import { IStackSynthesizer, ISynthesisSession } from './types'; * and could not be accessed by external implementors. */ export abstract class StackSynthesizer implements IStackSynthesizer { - public bootstrapQualifier?: string; - private _boundStack?: Stack; /** diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/types.ts b/packages/@aws-cdk/core/lib/stack-synthesizers/types.ts index 290f837c4cb8c..18c437da224da 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/types.ts +++ b/packages/@aws-cdk/core/lib/stack-synthesizers/types.ts @@ -11,7 +11,7 @@ export interface IStackSynthesizer { * * @default - no qualifier */ - bootstrapQualifier?: string; + readonly bootstrapQualifier?: string; /** * Bind to the stack this environment is going to be used on