Skip to content

Commit

Permalink
fix(stacks.api): properly override property descriptor on prototype f…
Browse files Browse the repository at this point in the history
…or decorator workaround

Signed-off-by: Braden Mars <bradenmars@bradenmars.me>
  • Loading branch information
BradenM committed Sep 25, 2023
1 parent fe9b3a0 commit 30f1867
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
16 changes: 11 additions & 5 deletions packages/stacks/api/src/addons/arc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,20 @@ export class ARCScaleSet extends blueprints.HelmAddOn {
constructor(props?: ARCScaleSetProps) {
super({ ...scaleSetDefaultProps, ...props })
this.options = this.props as ARCScaleSetProps
}

deploy(clusterInfo: ClusterInfo): Promise<Construct> {
// TODO: resolve esbuild transform error that is occurring with tsx/esbuild.
blueprints.utils.dependable(
const newDeploy = blueprints.utils.dependable(
ARCScaleSetController.name,
blueprints.addons.SecretsStoreAddOn.name,
)(this, 'deploy', Object.getOwnPropertyDescriptor(this, 'deploy')!)
)(
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
Object.getPrototypeOf(this),
'deploy',
Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this), 'deploy')!,
)
Object.defineProperty(Object.getPrototypeOf(this), 'deploy', newDeploy)
}

deploy(clusterInfo: ClusterInfo): Promise<Construct> {
const resourceContext = clusterInfo.getResourceContext()

const sa = getRequiredResource<ServiceAccount>(
Expand Down
17 changes: 11 additions & 6 deletions packages/stacks/api/src/addons/crisiscleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,20 @@ export interface CrisisCleanupAddOnProps {
}

export class CrisisCleanupAddOn implements blueprints.ClusterAddOn {
constructor(readonly props: CrisisCleanupAddOnProps) {}

deploy(clusterInfo: blueprints.ClusterInfo): Promise<Construct> {
constructor(readonly props: CrisisCleanupAddOnProps) {
// TODO: resolve esbuild transform error that is occurring with tsx/esbuild.
blueprints.utils.dependable(blueprints.addons.SecretsStoreAddOn.name)(
this,
const newDeploy = blueprints.utils.dependable(
blueprints.addons.SecretsStoreAddOn.name,
)(
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
Object.getPrototypeOf(this),
'deploy',
Object.getOwnPropertyDescriptor(this, 'deploy')!,
Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this), 'deploy')!,
)
Object.defineProperty(Object.getPrototypeOf(this), 'deploy', newDeploy)
}

deploy(clusterInfo: blueprints.ClusterInfo): Promise<Construct> {
const cluster = clusterInfo.cluster
const chartConfig: CrisisCleanupChartConfig = this.props.config
.chart as CrisisCleanupChartConfig
Expand Down

0 comments on commit 30f1867

Please sign in to comment.