-
Notifications
You must be signed in to change notification settings - Fork 6
/
root.ts
36 lines (35 loc) · 994 Bytes
/
root.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import type { StageSynthesisOptions } from "aws-cdk-lib";
import { App } from "aws-cdk-lib";
import type { CloudAssembly } from "aws-cdk-lib/cx-api";
import { RiffRaffYamlFile } from "../riff-raff-yaml-file";
/**
* A replacement for `App`, sitting at the root of a CDK application.
* `GuRoot` will synthesise a `riff-raff.yaml` file for a CDK application.
*
* Usage is a case of updating `/<repo-root>/cdk/bin/cdk.ts` from:
*
* ```ts
* import { App } from "aws-cdk-lib";
*
* const app = new App();
*
* new MyStack(app, "my-stack-CODE", {});
* new MyStack(app, "my-stack-PROD", {});
* ```
* To:
*
* ```ts
* import { GuRoot } from "@guardian/cdk/lib/constructs/root";
*
* const app = new GuRoot();
*
* new MyStack(app, "my-stack-CODE", {});
* new MyStack(app, "my-stack-PROD", {});
* ```
*/
export class GuRoot extends App {
override synth(options?: StageSynthesisOptions): CloudAssembly {
new RiffRaffYamlFile(this).synth();
return super.synth(options);
}
}