Skip to content

Commit

Permalink
feat(riff-raff.yaml): Introduce GuRoot
Browse files Browse the repository at this point in the history
The `GuRoot` class should allow for easy adoption of `riff-raff.yaml` generation.

Going from:

```ts
// bin/cdk.ts
import { App } from "aws-cdk-lib";

const app = new App();

new MyStack(app, "some-id", {});
```

To:

```ts
// bin/cdk.ts
import { GuRoot } from "@guardian/cdk/lib/constructs/root";

const app = new GuRoot();

new MyStack(app, "some-id", {});
```
  • Loading branch information
akash1810 committed Aug 4, 2022
1 parent 15c6fbe commit ca16c87
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/constructs/root.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Ideally this file would sit in `constructs/core`, however this creates violations of the `import/no-cycle` linting rule.
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 "../utils/riff-raff-yaml-file";

// Deliberately not called `GuApp` as `app` is overloaded (as is `stack`, and `stage` 😅)
export class GuRoot extends App {
override synth(options?: StageSynthesisOptions): CloudAssembly {
new RiffRaffYamlFile(this).synth();
return super.synth(options);
}
}

0 comments on commit ca16c87

Please sign in to comment.