@guardian/cdk 49.0.0 → 49.0.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/experimental/riff-raff-yaml-file/group-by.d.ts.map +1 -1
- package/lib/experimental/riff-raff-yaml-file/group-by.js +5 -11
- package/lib/experimental/riff-raff-yaml-file/group-by.js.map +1 -1
- package/lib/experimental/riff-raff-yaml-file/index.d.ts +1 -3
- package/lib/experimental/riff-raff-yaml-file/index.d.ts.map +1 -1
- package/lib/experimental/riff-raff-yaml-file/index.js +42 -57
- package/lib/experimental/riff-raff-yaml-file/index.js.map +1 -1
- package/lib/experimental/riff-raff-yaml-file/types.d.ts +1 -2
- package/lib/experimental/riff-raff-yaml-file/types.d.ts.map +1 -1
- package/lib/experimental/riff-raff-yaml-file/types.js.map +1 -1
- package/package.json +19 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-by.d.ts","sourceRoot":"","sources":["../../../src/experimental/riff-raff-yaml-file/group-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"group-by.d.ts","sourceRoot":"","sources":["../../../src/experimental/riff-raff-yaml-file/group-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,KAAK,EAAE,gBAAgB,EAA8B,MAAM,SAAS,CAAC;AAc5E,wBAAgB,gCAAgC,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAcvF"}
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.groupByClassNameStackRegionStage = void 0;
|
|
4
4
|
const array_1 = require("../../utils/array");
|
|
5
|
-
function groupByClassName(cdkStacks) {
|
|
6
|
-
return (0, array_1.groupBy)(cdkStacks, (stack) => stack.constructor.name);
|
|
7
|
-
}
|
|
8
5
|
function groupByStackTag(cdkStacks) {
|
|
9
6
|
return (0, array_1.groupBy)(cdkStacks, ({ stack }) => stack);
|
|
10
7
|
}
|
|
@@ -15,14 +12,11 @@ function groupByRegion(cdkStacks) {
|
|
|
15
12
|
return (0, array_1.groupBy)(cdkStacks, ({ region }) => region);
|
|
16
13
|
}
|
|
17
14
|
function groupByClassNameStackRegionStage(cdkStacks) {
|
|
18
|
-
return Object.entries(
|
|
19
|
-
...
|
|
20
|
-
[
|
|
21
|
-
...
|
|
22
|
-
[
|
|
23
|
-
...accRegion,
|
|
24
|
-
[region]: groupByStageTag(stacksGroupedByRegion),
|
|
25
|
-
}), {}),
|
|
15
|
+
return Object.entries(groupByStackTag(cdkStacks)).reduce((accStackTag, [stackTag, stacksGroupedByStackTag]) => ({
|
|
16
|
+
...accStackTag,
|
|
17
|
+
[stackTag]: Object.entries(groupByRegion(stacksGroupedByStackTag)).reduce((accRegion, [region, stacksGroupedByRegion]) => ({
|
|
18
|
+
...accRegion,
|
|
19
|
+
[region]: groupByStageTag(stacksGroupedByRegion),
|
|
26
20
|
}), {}),
|
|
27
21
|
}), {});
|
|
28
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-by.js","sourceRoot":"","sources":["../../../src/experimental/riff-raff-yaml-file/group-by.ts"],"names":[],"mappings":";;;AACA,6CAA4C;AAG5C,SAAS,
|
|
1
|
+
{"version":3,"file":"group-by.js","sourceRoot":"","sources":["../../../src/experimental/riff-raff-yaml-file/group-by.ts"],"names":[],"mappings":";;;AACA,6CAA4C;AAG5C,SAAS,eAAe,CAAC,SAAoB;IAC3C,OAAO,IAAA,eAAO,EAAC,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,eAAe,CAAC,SAAoB;IAC3C,OAAO,IAAA,eAAO,EAAC,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,aAAa,CAAC,SAAoB;IACzC,OAAO,IAAA,eAAO,EAAC,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;AACpD,CAAC;AAED,SAAgB,gCAAgC,CAAC,SAAoB;IACnE,OAAO,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CACtD,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,uBAAuB,CAAC,EAAE,EAAE,CAAC,CAAC;QACrD,GAAG,WAAW;QACd,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC,CAAC,MAAM,CACvE,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,qBAAqB,CAAC,EAAE,EAAE,CAAC,CAAC;YAC/C,GAAG,SAAS;YACZ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC,qBAAqB,CAAC;SACjD,CAAC,EACF,EAAE,CACH;KACF,CAAC,EACF,EAAE,CACH,CAAC;AACJ,CAAC;AAdD,4EAcC","sourcesContent":["import type { GuStack } from \"../../constructs/core\";\nimport { groupBy } from \"../../utils/array\";\nimport type { GroupedCdkStacks, Region, StackTag, StageTag } from \"./types\";\n\nfunction groupByStackTag(cdkStacks: GuStack[]): Record<StackTag, GuStack[]> {\n return groupBy(cdkStacks, ({ stack }) => stack);\n}\n\nfunction groupByStageTag(cdkStacks: GuStack[]): Record<StageTag, GuStack[]> {\n return groupBy(cdkStacks, ({ stage }) => stage);\n}\n\nfunction groupByRegion(cdkStacks: GuStack[]): Record<Region, GuStack[]> {\n return groupBy(cdkStacks, ({ region }) => region);\n}\n\nexport function groupByClassNameStackRegionStage(cdkStacks: GuStack[]): GroupedCdkStacks {\n return Object.entries(groupByStackTag(cdkStacks)).reduce(\n (accStackTag, [stackTag, stacksGroupedByStackTag]) => ({\n ...accStackTag,\n [stackTag]: Object.entries(groupByRegion(stacksGroupedByStackTag)).reduce(\n (accRegion, [region, stacksGroupedByRegion]) => ({\n ...accRegion,\n [region]: groupByStageTag(stacksGroupedByRegion),\n }),\n {}\n ),\n }),\n {}\n );\n}\n"]}
|
|
@@ -52,7 +52,7 @@ export declare class RiffRaffYamlFileExperimental {
|
|
|
52
52
|
private isCdkStackPresent;
|
|
53
53
|
/**
|
|
54
54
|
* Check there are the appropriate number of `GuStack`s.
|
|
55
|
-
* Expect to find an instance for each combination of `
|
|
55
|
+
* Expect to find an instance for each combination of `stack`, `region`, and `stage`.
|
|
56
56
|
*
|
|
57
57
|
* If not valid, a message is logged describing what is missing to aid debugging.
|
|
58
58
|
*
|
|
@@ -94,8 +94,6 @@ export declare class RiffRaffYamlFileExperimental {
|
|
|
94
94
|
* ```log
|
|
95
95
|
* Unable to produce a working riff-raff.yaml file; missing 1 definitions (details below)
|
|
96
96
|
*
|
|
97
|
-
* For the class: MyApplicationStack
|
|
98
|
-
*
|
|
99
97
|
* ┌───────────────┬────────────────────────────┐
|
|
100
98
|
* │ (index) │ eu-west-1 │
|
|
101
99
|
* ├───────────────┼────────────────────────────┤
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/experimental/riff-raff-yaml-file/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/experimental/riff-raff-yaml-file/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAqBvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,qBAAa,4BAA4B;IACvC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAY;IACzC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAa;IAC1C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAa;IAC1C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAW;IAEtC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC,OAAO,CAAC,iBAAiB;IASzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqDG;IACH,OAAO,CAAC,mBAAmB;IAwC3B,OAAO,CAAC,6BAA6B;IAQrC,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,oBAAoB;gBAKhB,GAAG,EAAE,GAAG;IA4DpB;;;OAGG;IACH,MAAM,IAAI,MAAM;IAiBhB;;;OAGG;IACH,KAAK,IAAI,IAAI;CAId"}
|
|
@@ -7,7 +7,6 @@ exports.RiffRaffYamlFileExperimental = void 0;
|
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
10
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
11
10
|
const js_yaml_1 = require("js-yaml");
|
|
12
11
|
const autoscaling_1 = require("../../constructs/autoscaling");
|
|
13
12
|
const core_1 = require("../../constructs/core");
|
|
@@ -60,16 +59,16 @@ const group_by_1 = require("./group-by");
|
|
|
60
59
|
* @see https://riffraff.gutools.co.uk/docs/magenta-lib/types
|
|
61
60
|
*/
|
|
62
61
|
class RiffRaffYamlFileExperimental {
|
|
63
|
-
isCdkStackPresent(
|
|
62
|
+
isCdkStackPresent(expectedStack, expectedRegion, expectedStage) {
|
|
64
63
|
const matches = this.allCdkStacks.find((cdkStack) => {
|
|
65
|
-
const {
|
|
66
|
-
return
|
|
64
|
+
const { stack, stage, region } = cdkStack;
|
|
65
|
+
return stack === expectedStack && stage === expectedStage && region === expectedRegion;
|
|
67
66
|
});
|
|
68
67
|
return !!matches;
|
|
69
68
|
}
|
|
70
69
|
/**
|
|
71
70
|
* Check there are the appropriate number of `GuStack`s.
|
|
72
|
-
* Expect to find an instance for each combination of `
|
|
71
|
+
* Expect to find an instance for each combination of `stack`, `region`, and `stage`.
|
|
73
72
|
*
|
|
74
73
|
* If not valid, a message is logged describing what is missing to aid debugging.
|
|
75
74
|
*
|
|
@@ -111,8 +110,6 @@ class RiffRaffYamlFileExperimental {
|
|
|
111
110
|
* ```log
|
|
112
111
|
* Unable to produce a working riff-raff.yaml file; missing 1 definitions (details below)
|
|
113
112
|
*
|
|
114
|
-
* For the class: MyApplicationStack
|
|
115
|
-
*
|
|
116
113
|
* ┌───────────────┬────────────────────────────┐
|
|
117
114
|
* │ (index) │ eu-west-1 │
|
|
118
115
|
* ├───────────────┼────────────────────────────┤
|
|
@@ -124,42 +121,32 @@ class RiffRaffYamlFileExperimental {
|
|
|
124
121
|
* @private
|
|
125
122
|
*/
|
|
126
123
|
validateStacksInApp() {
|
|
127
|
-
const {
|
|
128
|
-
const checks =
|
|
124
|
+
const { allStackTags, allStageTags, allRegions } = this;
|
|
125
|
+
const checks = allStackTags.reduce((accStackTag, stackTag) => {
|
|
129
126
|
return {
|
|
130
|
-
...
|
|
131
|
-
[
|
|
127
|
+
...accStackTag,
|
|
128
|
+
[stackTag]: allRegions.reduce((accRegion, region) => {
|
|
132
129
|
return {
|
|
133
|
-
...
|
|
134
|
-
[
|
|
130
|
+
...accRegion,
|
|
131
|
+
[region]: allStageTags.reduce((accStageTag, stageTag) => {
|
|
135
132
|
return {
|
|
136
|
-
...
|
|
137
|
-
[
|
|
138
|
-
return {
|
|
139
|
-
...accStageTag,
|
|
140
|
-
[stageTag]: this.isCdkStackPresent(name, stackTag, region, stageTag) ? "✅" : "❌",
|
|
141
|
-
};
|
|
142
|
-
}, {}),
|
|
133
|
+
...accStageTag,
|
|
134
|
+
[stageTag]: this.isCdkStackPresent(stackTag, region, stageTag) ? "✅" : "❌",
|
|
143
135
|
};
|
|
144
136
|
}, {}),
|
|
145
137
|
};
|
|
146
138
|
}, {}),
|
|
147
139
|
};
|
|
148
140
|
}, {});
|
|
149
|
-
const missingDefinitions = Object.values(checks).flatMap((
|
|
150
|
-
return Object.values(
|
|
151
|
-
return Object.values(
|
|
152
|
-
return Object.values(groupedByStage).filter((_) => _ === "❌");
|
|
153
|
-
});
|
|
141
|
+
const missingDefinitions = Object.values(checks).flatMap((groupedByRegion) => {
|
|
142
|
+
return Object.values(groupedByRegion).flatMap((groupedByStage) => {
|
|
143
|
+
return Object.values(groupedByStage).filter((_) => _ === "❌");
|
|
154
144
|
});
|
|
155
145
|
});
|
|
156
146
|
if (missingDefinitions.length > 0) {
|
|
157
147
|
const message = `Unable to produce a working riff-raff.yaml file; missing ${missingDefinitions.length} definitions`;
|
|
158
148
|
console.log(`${message} (details below)`);
|
|
159
|
-
|
|
160
|
-
console.log(`For the class: ${chalk_1.default.yellow(className)}`);
|
|
161
|
-
console.table(detail);
|
|
162
|
-
});
|
|
149
|
+
console.table(checks);
|
|
163
150
|
throw new Error(message);
|
|
164
151
|
}
|
|
165
152
|
}
|
|
@@ -187,34 +174,32 @@ class RiffRaffYamlFileExperimental {
|
|
|
187
174
|
this.outdir = app.outdir;
|
|
188
175
|
const deployments = new Map();
|
|
189
176
|
const groupedStacks = (0, group_by_1.groupByClassNameStackRegionStage)(this.allCdkStacks);
|
|
190
|
-
Object.values(groupedStacks).forEach((
|
|
191
|
-
Object.values(
|
|
192
|
-
Object.values(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
deployments.set(cfnDeployment.name, (0, cloudformation_1.addAmiParametersToCloudFormationDeployment)(cfnDeployment, asg));
|
|
217
|
-
});
|
|
177
|
+
Object.values(groupedStacks).forEach((regionGroup) => {
|
|
178
|
+
Object.values(regionGroup).forEach((stageGroup) => {
|
|
179
|
+
const stacks = Object.values(stageGroup).flat();
|
|
180
|
+
if (stacks.length === 0) {
|
|
181
|
+
throw new Error("Unable to produce a working riff-raff.yaml file; there are no stacks!");
|
|
182
|
+
}
|
|
183
|
+
// The items in `stacks` only differ by stage, so we can just use the first item in the list.
|
|
184
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- length of `stacks` is checked above
|
|
185
|
+
const stack = stacks[0];
|
|
186
|
+
const lambdas = this.getLambdas(stack);
|
|
187
|
+
const autoscalingGroups = this.getAutoScalingGroups(stack);
|
|
188
|
+
const artifactUploads = [
|
|
189
|
+
lambdas.map(lambda_2.uploadLambdaArtifact),
|
|
190
|
+
autoscalingGroups.map(autoscaling_2.uploadAutoscalingArtifact),
|
|
191
|
+
].flat();
|
|
192
|
+
artifactUploads.forEach(({ name, props }) => deployments.set(name, props));
|
|
193
|
+
const cfnDeployment = (0, cloudformation_1.cloudFormationDeployment)(stacks, artifactUploads, this.outdir);
|
|
194
|
+
deployments.set(cfnDeployment.name, cfnDeployment.props);
|
|
195
|
+
lambdas.forEach((lambda) => {
|
|
196
|
+
const lambdaDeployment = (0, lambda_2.updateLambdaDeployment)(lambda, cfnDeployment);
|
|
197
|
+
deployments.set(lambdaDeployment.name, lambdaDeployment.props);
|
|
198
|
+
});
|
|
199
|
+
autoscalingGroups.forEach((asg) => {
|
|
200
|
+
const asgDeployment = (0, autoscaling_2.autoscalingDeployment)(asg, cfnDeployment);
|
|
201
|
+
deployments.set(asgDeployment.name, asgDeployment.props);
|
|
202
|
+
deployments.set(cfnDeployment.name, (0, cloudformation_1.addAmiParametersToCloudFormationDeployment)(cfnDeployment, asg));
|
|
218
203
|
});
|
|
219
204
|
});
|
|
220
205
|
});
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,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,IAAA,2DAA0C,EAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC;oBACtG,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,YAAY,GAAG;YAClB,aAAa;YACb,WAAW;SACZ,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,qFAAqF;QACrF,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,KAAc,EAAE,EAAE;YAChD,IAAI,KAAK,YAAY,GAAG,EAAE;gBACxB,iGAAiG;gBACjG,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aAC1B;YACD,IAAI,KAAK,YAAY,GAAG,EAAE;gBACxB,iGAAiG;gBACjG,OAAO,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;aAClC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC;QAEF,OAAO,IAAA,cAAI,EAAC,IAAI,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,MAAM,OAAO,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;QACzD,IAAA,kBAAa,EAAC,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACxC,CAAC;CACF;AApPD,oEAoPC","sourcesContent":["import { writeFileSync } from \"fs\";\nimport path from \"path\";\nimport type { App } from \"aws-cdk-lib\";\nimport { Token } from \"aws-cdk-lib\";\nimport chalk from \"chalk\";\nimport { dump } from \"js-yaml\";\nimport { GuAutoScalingGroup } from \"../../constructs/autoscaling\";\nimport { GuStack } from \"../../constructs/core\";\nimport { GuLambdaFunction } from \"../../constructs/lambda\";\nimport { autoscalingDeployment, uploadAutoscalingArtifact } from \"./deployments/autoscaling\";\nimport { addAmiParametersToCloudFormationDeployment, cloudFormationDeployment } from \"./deployments/cloudformation\";\nimport { updateLambdaDeployment, uploadLambdaArtifact } from \"./deployments/lambda\";\nimport { groupByClassNameStackRegionStage } from \"./group-by\";\nimport type {\n ClassName,\n GroupedCdkStacks,\n Region,\n RiffRaffDeployment,\n RiffRaffDeploymentName,\n RiffRaffDeploymentProps,\n RiffRaffYaml,\n StackTag,\n StageTag,\n} from \"./types\";\n\n/**\n * A class that creates a `riff-raff.yaml` file.\n *\n * Rather than using this directly, prefer to use [[`GuRoot`]] instead.\n *\n * Supports:\n * - Multiple CloudFormation stacks\n * - Multiple regions\n * - Lambda applications\n * - EC2 (autoscaling) applications\n *\n * For lambda applications, 3 deployments will be defined:\n * 1. Lambda upload (`aws-lambda`, `action: [uploadLambda]`)\n * 2. CloudFormation deploy (`cloud-formation`)\n * 3. Lambda update (`aws-lambda`, `action: [updateLambda]`)\n *\n * For EC2 applications, 3 deployments will be defined:\n * 1. Artifact upload (`autoscaling`, `action: [uploadArtifacts]`)\n * 2. CloudFormation deploy (`cloud-formation`)\n * 3. Autoscaling deploy (`autoscaling`, `action: [deploy]`)\n *\n * It assumes a Riff-Raff bundle structure as follows:\n *\n * ```\n * .\n * ├── cdk.out\n * │ └── MyApplication.template.json\n * ├── my-application\n * │ └── my-application.deb\n * └── my-lambda\n * └── my-lambda.zip\n * ```\n *\n * That is, all CloudFormation templates are in a `cdk.out` directory, and there is a directory per app.\n * Application artifact(s) are in the app directory.\n *\n * NOTE: The file extension is decided by you, the above file tree is used for illustration purposes.\n *\n * NOTE: Resources will be looked up by tags (Stack, Stage, App). Ensure your CFN stack is tagged appropriately!\n *\n * @see https://riffraff.gutools.co.uk/docs/reference/riff-raff.yaml.md\n * @see https://riffraff.gutools.co.uk/docs/magenta-lib/types\n */\nexport class RiffRaffYamlFileExperimental {\n private readonly allCdkStacks: GuStack[];\n private readonly allStackTags: StackTag[];\n private readonly allStageTags: StageTag[];\n private readonly allRegions: Region[];\n\n private readonly riffRaffYaml: RiffRaffYaml;\n private readonly outdir: string;\n\n private isCdkStackPresent(\n expectedClassName: ClassName,\n expectedStack: StackTag,\n expectedRegion: Region,\n expectedStage: StageTag\n ): boolean {\n const matches = this.allCdkStacks.find((cdkStack) => {\n const {\n constructor: { name },\n stack,\n stage,\n region,\n } = cdkStack;\n return (\n name === expectedClassName && stack === expectedStack && stage === expectedStage && region === expectedRegion\n );\n });\n\n return !!matches;\n }\n\n /**\n * Check there are the appropriate number of `GuStack`s.\n * Expect to find an instance for each combination of `GuStack`, `stack`, `region`, and `stage`.\n *\n * If not valid, a message is logged describing what is missing to aid debugging.\n *\n * Given the following:\n *\n * ```ts\n * const app = new App();\n *\n * class MyApplicationStack extends GuStack { }\n *\n * new MyApplicationStack(app, \"App-CODE-deploy\", {\n * env: {\n * region: \"eu-west-1\",\n * },\n * stack: \"deploy\",\n * stage: \"CODE\"\n * });\n *\n * new MyApplicationStack(app, \"App-PROD-media-service\", {\n * env: {\n * region: \"eu-west-1\",\n * },\n * stack: \"media-service\",\n * stage: \"PROD\",\n * });\n *\n * new MyApplicationStack(app, \"App-PROD-deploy\", {\n * env: {\n * region: \"eu-west-1\",\n * },\n * stack: \"deploy\",\n * stage: \"PROD\"\n * });\n * ```\n *\n * This will log a message like this, where ❌ denotes something missing,\n * specifically there is no `CODE` template for `media-service`.\n *\n * ```log\n * Unable to produce a working riff-raff.yaml file; missing 1 definitions (details below)\n *\n * For the class: MyApplicationStack\n *\n * ┌───────────────┬────────────────────────────┐\n * │ (index) │ eu-west-1 │\n * ├───────────────┼────────────────────────────┤\n * │ deploy │ { CODE: '✅', PROD: '✅' } │\n * │ media-service │ { CODE: '❌', PROD: '✅' } │\n * └───────────────┴────────────────────────────┘\n * ```\n *\n * @private\n */\n private validateStacksInApp(): void {\n type Found = \"✅\";\n type NotFound = \"❌\";\n type AppValidation = Record<ClassName, Record<StackTag, Record<Region, Record<StageTag, Found | NotFound>>>>;\n\n const { allCdkStacks, allStackTags, allStageTags, allRegions } = this;\n\n const checks: AppValidation = allCdkStacks.reduce((accClassName, { constructor: { name } }) => {\n return {\n ...accClassName,\n [name]: allStackTags.reduce((accStackTag, stackTag) => {\n return {\n ...accStackTag,\n [stackTag]: allRegions.reduce((accRegion, region) => {\n return {\n ...accRegion,\n [region]: allStageTags.reduce((accStageTag, stageTag) => {\n return {\n ...accStageTag,\n [stageTag]: this.isCdkStackPresent(name, stackTag, region, stageTag) ? \"✅\" : \"❌\",\n };\n }, {}),\n };\n }, {}),\n };\n }, {}),\n };\n }, {});\n\n const missingDefinitions = Object.values(checks).flatMap((groupedByStackTag) => {\n return Object.values(groupedByStackTag).flatMap((groupedByRegion) => {\n return Object.values(groupedByRegion).flatMap((groupedByStage) => {\n return Object.values(groupedByStage).filter((_) => _ === \"❌\");\n });\n });\n });\n\n if (missingDefinitions.length > 0) {\n const message = `Unable to produce a working riff-raff.yaml file; missing ${missingDefinitions.length} definitions`;\n\n console.log(`${message} (details below)`);\n Object.entries(checks).forEach(([className, detail]) => {\n console.log(`For the class: ${chalk.yellow(className)}`);\n console.table(detail);\n });\n\n throw new Error(message);\n }\n }\n\n private validateAllRegionsAreResolved(): void {\n const unresolved = this.allRegions.filter((region) => Token.isUnresolved(region));\n\n if (unresolved.length !== 0) {\n throw new Error(`Unable to produce a working riff-raff.yaml file; all stacks must have an explicit region set`);\n }\n }\n\n private getLambdas(cdkStack: GuStack): GuLambdaFunction[] {\n return cdkStack.node.findAll().filter((_) => _ instanceof GuLambdaFunction) as GuLambdaFunction[];\n }\n\n private getAutoScalingGroups(cdkStack: GuStack): GuAutoScalingGroup[] {\n return cdkStack.node.findAll().filter((_) => _ instanceof GuAutoScalingGroup) as GuAutoScalingGroup[];\n }\n\n // eslint-disable-next-line custom-rules/valid-constructors -- this needs to sit above GuStack on the cdk tree\n constructor(app: App) {\n this.allCdkStacks = app.node.findAll().filter((_) => _ instanceof GuStack) as GuStack[];\n const allowedStages = new Set(this.allCdkStacks.map(({ stage }) => stage));\n this.allStageTags = Array.from(allowedStages);\n this.allStackTags = Array.from(new Set(this.allCdkStacks.map(({ stack }) => stack)));\n this.allRegions = Array.from(new Set(this.allCdkStacks.map(({ region }) => region)));\n\n this.validateStacksInApp();\n this.validateAllRegionsAreResolved();\n\n this.outdir = app.outdir;\n\n const deployments = new Map<RiffRaffDeploymentName, RiffRaffDeploymentProps>();\n\n const groupedStacks: GroupedCdkStacks = groupByClassNameStackRegionStage(this.allCdkStacks);\n\n Object.values(groupedStacks).forEach((stackTagGroup) => {\n Object.values(stackTagGroup).forEach((regionGroup) => {\n Object.values(regionGroup).forEach((stageGroup) => {\n const stacks: GuStack[] = Object.values(stageGroup).flat();\n\n if (stacks.length === 0) {\n throw new Error(\"Unable to produce a working riff-raff.yaml file; there are no stacks!\");\n }\n\n // The items in `stacks` only differ by stage, so we can just use the first item in the list.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- length of `stacks` is checked above\n const stack = stacks[0]!;\n\n const lambdas = this.getLambdas(stack);\n const autoscalingGroups = this.getAutoScalingGroups(stack);\n\n const artifactUploads: RiffRaffDeployment[] = [\n lambdas.map(uploadLambdaArtifact),\n autoscalingGroups.map(uploadAutoscalingArtifact),\n ].flat();\n artifactUploads.forEach(({ name, props }) => deployments.set(name, props));\n\n const cfnDeployment = cloudFormationDeployment(stacks, artifactUploads, this.outdir);\n deployments.set(cfnDeployment.name, cfnDeployment.props);\n\n lambdas.forEach((lambda) => {\n const lambdaDeployment = updateLambdaDeployment(lambda, cfnDeployment);\n deployments.set(lambdaDeployment.name, lambdaDeployment.props);\n });\n\n autoscalingGroups.forEach((asg) => {\n const asgDeployment = autoscalingDeployment(asg, cfnDeployment);\n deployments.set(asgDeployment.name, asgDeployment.props);\n\n deployments.set(cfnDeployment.name, addAmiParametersToCloudFormationDeployment(cfnDeployment, asg));\n });\n });\n });\n });\n\n this.riffRaffYaml = {\n allowedStages,\n deployments,\n };\n }\n\n /**\n * The `riff-raff.yaml` file as a string.\n * Useful for testing.\n */\n toYAML(): string {\n // Add support for ES6 Set and Map. See https://github.com/nodeca/js-yaml/issues/436.\n const replacer = (_key: string, value: unknown) => {\n if (value instanceof Set) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return -- this is how `js-yaml` is typed\n return Array.from(value);\n }\n if (value instanceof Map) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return -- this is how `js-yaml` is typed\n return Object.fromEntries(value);\n }\n return value;\n };\n\n return dump(this.riffRaffYaml, { replacer });\n }\n\n /**\n * Write the `riff-raff.yaml` file to disk.\n * It'll be located with the CFN JSON templates generated by `cdk synth`.\n */\n synth(): void {\n const outPath = path.join(this.outdir, \"riff-raff.yaml\");\n writeFileSync(outPath, this.toYAML());\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/experimental/riff-raff-yaml-file/index.ts"],"names":[],"mappings":";;;;;;AAAA,2BAAmC;AACnC,gDAAwB;AAExB,6CAAoC;AACpC,qCAA+B;AAC/B,8DAAkE;AAClE,gDAAgD;AAChD,oDAA2D;AAC3D,2DAA6F;AAC7F,iEAAoH;AACpH,iDAAoF;AACpF,yCAA8D;AAY9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAa,4BAA4B;IAS/B,iBAAiB,CAAC,aAAuB,EAAE,cAAsB,EAAE,aAAuB;QAChG,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAClD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC;YAC1C,OAAO,KAAK,KAAK,aAAa,IAAI,KAAK,KAAK,aAAa,IAAI,MAAM,KAAK,cAAc,CAAC;QACzF,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,CAAC,OAAO,CAAC;IACnB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;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,QAAQ,GAAG,CAAC,IAAY,EAAE,KAAc,EAAE,EAAE;YAChD,IAAI,KAAK,YAAY,GAAG,EAAE;gBACxB,iGAAiG;gBACjG,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aAC1B;YACD,IAAI,KAAK,YAAY,GAAG,EAAE;gBACxB,iGAAiG;gBACjG,OAAO,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;aAClC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC;QAEF,OAAO,IAAA,cAAI,EAAC,IAAI,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,MAAM,OAAO,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;QACzD,IAAA,kBAAa,EAAC,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACxC,CAAC;CACF;AA1ND,oEA0NC","sourcesContent":["import { writeFileSync } from \"fs\";\nimport path from \"path\";\nimport type { App } from \"aws-cdk-lib\";\nimport { Token } from \"aws-cdk-lib\";\nimport { dump } from \"js-yaml\";\nimport { GuAutoScalingGroup } from \"../../constructs/autoscaling\";\nimport { GuStack } from \"../../constructs/core\";\nimport { GuLambdaFunction } from \"../../constructs/lambda\";\nimport { autoscalingDeployment, uploadAutoscalingArtifact } from \"./deployments/autoscaling\";\nimport { addAmiParametersToCloudFormationDeployment, cloudFormationDeployment } from \"./deployments/cloudformation\";\nimport { updateLambdaDeployment, uploadLambdaArtifact } from \"./deployments/lambda\";\nimport { groupByClassNameStackRegionStage } from \"./group-by\";\nimport type {\n GroupedCdkStacks,\n Region,\n RiffRaffDeployment,\n RiffRaffDeploymentName,\n RiffRaffDeploymentProps,\n RiffRaffYaml,\n StackTag,\n StageTag,\n} from \"./types\";\n\n/**\n * A class that creates a `riff-raff.yaml` file.\n *\n * Rather than using this directly, prefer to use [[`GuRoot`]] instead.\n *\n * Supports:\n * - Multiple CloudFormation stacks\n * - Multiple regions\n * - Lambda applications\n * - EC2 (autoscaling) applications\n *\n * For lambda applications, 3 deployments will be defined:\n * 1. Lambda upload (`aws-lambda`, `action: [uploadLambda]`)\n * 2. CloudFormation deploy (`cloud-formation`)\n * 3. Lambda update (`aws-lambda`, `action: [updateLambda]`)\n *\n * For EC2 applications, 3 deployments will be defined:\n * 1. Artifact upload (`autoscaling`, `action: [uploadArtifacts]`)\n * 2. CloudFormation deploy (`cloud-formation`)\n * 3. Autoscaling deploy (`autoscaling`, `action: [deploy]`)\n *\n * It assumes a Riff-Raff bundle structure as follows:\n *\n * ```\n * .\n * ├── cdk.out\n * │ └── MyApplication.template.json\n * ├── my-application\n * │ └── my-application.deb\n * └── my-lambda\n * └── my-lambda.zip\n * ```\n *\n * That is, all CloudFormation templates are in a `cdk.out` directory, and there is a directory per app.\n * Application artifact(s) are in the app directory.\n *\n * NOTE: The file extension is decided by you, the above file tree is used for illustration purposes.\n *\n * NOTE: Resources will be looked up by tags (Stack, Stage, App). Ensure your CFN stack is tagged appropriately!\n *\n * @see https://riffraff.gutools.co.uk/docs/reference/riff-raff.yaml.md\n * @see https://riffraff.gutools.co.uk/docs/magenta-lib/types\n */\nexport class RiffRaffYamlFileExperimental {\n private readonly allCdkStacks: GuStack[];\n private readonly allStackTags: StackTag[];\n private readonly allStageTags: StageTag[];\n private readonly allRegions: Region[];\n\n private readonly riffRaffYaml: RiffRaffYaml;\n private readonly outdir: string;\n\n private isCdkStackPresent(expectedStack: StackTag, expectedRegion: Region, expectedStage: StageTag): boolean {\n const matches = this.allCdkStacks.find((cdkStack) => {\n const { stack, stage, region } = cdkStack;\n return stack === expectedStack && stage === expectedStage && region === expectedRegion;\n });\n\n return !!matches;\n }\n\n /**\n * Check there are the appropriate number of `GuStack`s.\n * Expect to find an instance for each combination of `stack`, `region`, and `stage`.\n *\n * If not valid, a message is logged describing what is missing to aid debugging.\n *\n * Given the following:\n *\n * ```ts\n * const app = new App();\n *\n * class MyApplicationStack extends GuStack { }\n *\n * new MyApplicationStack(app, \"App-CODE-deploy\", {\n * env: {\n * region: \"eu-west-1\",\n * },\n * stack: \"deploy\",\n * stage: \"CODE\"\n * });\n *\n * new MyApplicationStack(app, \"App-PROD-media-service\", {\n * env: {\n * region: \"eu-west-1\",\n * },\n * stack: \"media-service\",\n * stage: \"PROD\",\n * });\n *\n * new MyApplicationStack(app, \"App-PROD-deploy\", {\n * env: {\n * region: \"eu-west-1\",\n * },\n * stack: \"deploy\",\n * stage: \"PROD\"\n * });\n * ```\n *\n * This will log a message like this, where ❌ denotes something missing,\n * specifically there is no `CODE` template for `media-service`.\n *\n * ```log\n * Unable to produce a working riff-raff.yaml file; missing 1 definitions (details below)\n *\n * ┌───────────────┬────────────────────────────┐\n * │ (index) │ eu-west-1 │\n * ├───────────────┼────────────────────────────┤\n * │ deploy │ { CODE: '✅', PROD: '✅' } │\n * │ media-service │ { CODE: '❌', PROD: '✅' } │\n * └───────────────┴────────────────────────────┘\n * ```\n *\n * @private\n */\n private validateStacksInApp(): void {\n type Found = \"✅\";\n type NotFound = \"❌\";\n type AppValidation = Record<StackTag, Record<Region, Record<StageTag, Found | NotFound>>>;\n\n const { allStackTags, allStageTags, allRegions } = this;\n\n const checks: AppValidation = allStackTags.reduce((accStackTag, stackTag) => {\n return {\n ...accStackTag,\n [stackTag]: allRegions.reduce((accRegion, region) => {\n return {\n ...accRegion,\n [region]: allStageTags.reduce((accStageTag, stageTag) => {\n return {\n ...accStageTag,\n [stageTag]: this.isCdkStackPresent(stackTag, region, stageTag) ? \"✅\" : \"❌\",\n };\n }, {}),\n };\n }, {}),\n };\n }, {});\n\n const missingDefinitions = Object.values(checks).flatMap((groupedByRegion) => {\n return Object.values(groupedByRegion).flatMap((groupedByStage) => {\n return Object.values(groupedByStage).filter((_) => _ === \"❌\");\n });\n });\n\n if (missingDefinitions.length > 0) {\n const message = `Unable to produce a working riff-raff.yaml file; missing ${missingDefinitions.length} definitions`;\n\n console.log(`${message} (details below)`);\n console.table(checks);\n\n throw new Error(message);\n }\n }\n\n private validateAllRegionsAreResolved(): void {\n const unresolved = this.allRegions.filter((region) => Token.isUnresolved(region));\n\n if (unresolved.length !== 0) {\n throw new Error(`Unable to produce a working riff-raff.yaml file; all stacks must have an explicit region set`);\n }\n }\n\n private getLambdas(cdkStack: GuStack): GuLambdaFunction[] {\n return cdkStack.node.findAll().filter((_) => _ instanceof GuLambdaFunction) as GuLambdaFunction[];\n }\n\n private getAutoScalingGroups(cdkStack: GuStack): GuAutoScalingGroup[] {\n return cdkStack.node.findAll().filter((_) => _ instanceof GuAutoScalingGroup) as GuAutoScalingGroup[];\n }\n\n // eslint-disable-next-line custom-rules/valid-constructors -- this needs to sit above GuStack on the cdk tree\n constructor(app: App) {\n this.allCdkStacks = app.node.findAll().filter((_) => _ instanceof GuStack) as GuStack[];\n const allowedStages = new Set(this.allCdkStacks.map(({ stage }) => stage));\n this.allStageTags = Array.from(allowedStages);\n this.allStackTags = Array.from(new Set(this.allCdkStacks.map(({ stack }) => stack)));\n this.allRegions = Array.from(new Set(this.allCdkStacks.map(({ region }) => region)));\n\n this.validateStacksInApp();\n this.validateAllRegionsAreResolved();\n\n this.outdir = app.outdir;\n\n const deployments = new Map<RiffRaffDeploymentName, RiffRaffDeploymentProps>();\n\n const groupedStacks: GroupedCdkStacks = groupByClassNameStackRegionStage(this.allCdkStacks);\n\n Object.values(groupedStacks).forEach((regionGroup) => {\n Object.values(regionGroup).forEach((stageGroup) => {\n const stacks: GuStack[] = Object.values(stageGroup).flat();\n\n if (stacks.length === 0) {\n throw new Error(\"Unable to produce a working riff-raff.yaml file; there are no stacks!\");\n }\n\n // The items in `stacks` only differ by stage, so we can just use the first item in the list.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- length of `stacks` is checked above\n const stack = stacks[0]!;\n\n const lambdas = this.getLambdas(stack);\n const autoscalingGroups = this.getAutoScalingGroups(stack);\n\n const artifactUploads: RiffRaffDeployment[] = [\n lambdas.map(uploadLambdaArtifact),\n autoscalingGroups.map(uploadAutoscalingArtifact),\n ].flat();\n artifactUploads.forEach(({ name, props }) => deployments.set(name, props));\n\n const cfnDeployment = cloudFormationDeployment(stacks, artifactUploads, this.outdir);\n deployments.set(cfnDeployment.name, cfnDeployment.props);\n\n lambdas.forEach((lambda) => {\n const lambdaDeployment = updateLambdaDeployment(lambda, cfnDeployment);\n deployments.set(lambdaDeployment.name, lambdaDeployment.props);\n });\n\n autoscalingGroups.forEach((asg) => {\n const asgDeployment = autoscalingDeployment(asg, cfnDeployment);\n deployments.set(asgDeployment.name, asgDeployment.props);\n\n deployments.set(cfnDeployment.name, addAmiParametersToCloudFormationDeployment(cfnDeployment, asg));\n });\n });\n });\n\n this.riffRaffYaml = {\n allowedStages,\n deployments,\n };\n }\n\n /**\n * The `riff-raff.yaml` file as a string.\n * Useful for testing.\n */\n toYAML(): string {\n // Add support for ES6 Set and Map. See https://github.com/nodeca/js-yaml/issues/436.\n const replacer = (_key: string, value: unknown) => {\n if (value instanceof Set) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return -- this is how `js-yaml` is typed\n return Array.from(value);\n }\n if (value instanceof Map) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return -- this is how `js-yaml` is typed\n return Object.fromEntries(value);\n }\n return value;\n };\n\n return dump(this.riffRaffYaml, { replacer });\n }\n\n /**\n * Write the `riff-raff.yaml` file to disk.\n * It'll be located with the CFN JSON templates generated by `cdk synth`.\n */\n synth(): void {\n const outPath = path.join(this.outdir, \"riff-raff.yaml\");\n writeFileSync(outPath, this.toYAML());\n }\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { GuStack } from "../../constructs/core";
|
|
2
|
-
export type ClassName = string;
|
|
3
2
|
export type StackTag = string;
|
|
4
3
|
export type StageTag = string;
|
|
5
4
|
export type Region = string;
|
|
@@ -23,5 +22,5 @@ export interface RiffRaffDeployment {
|
|
|
23
22
|
name: RiffRaffDeploymentName;
|
|
24
23
|
props: RiffRaffDeploymentProps;
|
|
25
24
|
}
|
|
26
|
-
export type GroupedCdkStacks = Record<
|
|
25
|
+
export type GroupedCdkStacks = Record<StackTag, Record<Region, Record<StageTag, CdkStacksDifferingOnlyByStage>>>;
|
|
27
26
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/experimental/riff-raff-yaml-file/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/experimental/riff-raff-yaml-file/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC9B,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC9B,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAC5B,MAAM,MAAM,6BAA6B,GAAG,OAAO,EAAE,CAAC;AAEtD,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7B,WAAW,EAAE,GAAG,CAAC,sBAAsB,EAAE,uBAAuB,CAAC,CAAC;CACnE;AAED,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAE5C,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,MAAM,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACtE,YAAY,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACxC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,KAAK,EAAE,uBAAuB,CAAC;CAChC;AAQD,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,6BAA6B,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/experimental/riff-raff-yaml-file/types.ts"],"names":[],"mappings":"","sourcesContent":["// type aliases to, hopefully, improve readability\nimport type { GuStack } from \"../../constructs/core\";\n\nexport type
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/experimental/riff-raff-yaml-file/types.ts"],"names":[],"mappings":"","sourcesContent":["// type aliases to, hopefully, improve readability\nimport type { GuStack } from \"../../constructs/core\";\n\nexport type StackTag = string;\nexport type StageTag = string;\nexport type Region = string;\nexport type CdkStacksDifferingOnlyByStage = GuStack[];\n\nexport interface RiffRaffYaml {\n allowedStages: Set<StageTag>;\n deployments: Map<RiffRaffDeploymentName, RiffRaffDeploymentProps>;\n}\n\nexport type RiffRaffDeploymentName = string;\n\nexport interface RiffRaffDeploymentProps {\n type: string;\n regions: Set<Region>;\n stacks: Set<StackTag>;\n app: string;\n contentDirectory: string;\n parameters: Record<string, string | boolean | Record<string, string>>;\n dependencies?: RiffRaffDeploymentName[];\n actions?: string[];\n}\n\nexport interface RiffRaffDeployment {\n name: RiffRaffDeploymentName;\n props: RiffRaffDeploymentProps;\n}\n\n/*\n The aim here is to produce an identity of a `GuStack` as a composite of:\n - Stack tag\n - Region\n Finally, group by stage to help form the `templateStagePaths` property for the `cloud-formation` deployment type in `riff-raff.yaml`.\n */\nexport type GroupedCdkStacks = Record<StackTag, Record<Region, Record<StageTag, CdkStacksDifferingOnlyByStage>>>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guardian/cdk",
|
|
3
3
|
"description": "Generic Guardian flavoured AWS CDK components",
|
|
4
|
-
"version": "49.0.
|
|
4
|
+
"version": "49.0.2-beta.1",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -28,36 +28,36 @@
|
|
|
28
28
|
"cli:dev": "ts-node src/bin/index.ts"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@guardian/eslint-config-typescript": "
|
|
31
|
+
"@guardian/eslint-config-typescript": "3.0.0",
|
|
32
32
|
"@types/git-url-parse": "^9.0.1",
|
|
33
|
-
"@types/jest": "^29.2.
|
|
33
|
+
"@types/jest": "^29.2.5",
|
|
34
34
|
"@types/js-yaml": "^4.0.5",
|
|
35
35
|
"@types/lodash.camelcase": "^4.3.7",
|
|
36
36
|
"@types/lodash.kebabcase": "^4.1.7",
|
|
37
37
|
"@types/lodash.upperfirst": "^4.3.7",
|
|
38
|
-
"@types/node": "18.11.
|
|
39
|
-
"@types/yargs": "^17.0.
|
|
40
|
-
"aws-cdk": "2.
|
|
38
|
+
"@types/node": "18.11.18",
|
|
39
|
+
"@types/yargs": "^17.0.19",
|
|
40
|
+
"aws-cdk": "2.59.0",
|
|
41
41
|
"cz-conventional-changelog": "^3.3.0",
|
|
42
|
-
"eslint": "^8.
|
|
42
|
+
"eslint": "^8.31.0",
|
|
43
43
|
"eslint-plugin-custom-rules": "file:tools/eslint",
|
|
44
44
|
"gh-pages": "^4.0.0",
|
|
45
45
|
"jest": "^29.3.1",
|
|
46
|
-
"prettier": "^2.8.
|
|
46
|
+
"prettier": "^2.8.3",
|
|
47
47
|
"semantic-release": "^19.0.5",
|
|
48
48
|
"serve": "^14.1.2",
|
|
49
|
-
"ts-jest": "^29.0.
|
|
49
|
+
"ts-jest": "^29.0.5",
|
|
50
50
|
"ts-node": "^10.9.1",
|
|
51
|
-
"typedoc": "^0.23.
|
|
52
|
-
"typescript": "~4.9.
|
|
51
|
+
"typedoc": "^0.23.24",
|
|
52
|
+
"typescript": "~4.9.4"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@oclif/core": "1.
|
|
56
|
-
"aws-cdk-lib": "2.
|
|
57
|
-
"aws-sdk": "^2.
|
|
55
|
+
"@oclif/core": "1.24.2",
|
|
56
|
+
"aws-cdk-lib": "2.59.0",
|
|
57
|
+
"aws-sdk": "^2.1296.0",
|
|
58
58
|
"chalk": "^4.1.2",
|
|
59
|
-
"codemaker": "^1.
|
|
60
|
-
"constructs": "10.1.
|
|
59
|
+
"codemaker": "^1.73.0",
|
|
60
|
+
"constructs": "10.1.215",
|
|
61
61
|
"git-url-parse": "^13.1.0",
|
|
62
62
|
"js-yaml": "^4.1.0",
|
|
63
63
|
"lodash.camelcase": "^4.3.0",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"yargs": "^17.6.2"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"aws-cdk": "2.
|
|
71
|
-
"aws-cdk-lib": "2.
|
|
72
|
-
"constructs": "10.1.
|
|
70
|
+
"aws-cdk": "2.59.0",
|
|
71
|
+
"aws-cdk-lib": "2.59.0",
|
|
72
|
+
"constructs": "10.1.215"
|
|
73
73
|
},
|
|
74
74
|
"config": {
|
|
75
75
|
"commitizen": {
|