-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathpublish.js
More file actions
52 lines (47 loc) · 1.33 KB
/
publish.js
File metadata and controls
52 lines (47 loc) · 1.33 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const path = require("path");
const fs = require("fs");
module.exports = function(buildDir, newCloudformation, done) {
// Show pages uses the leo-cli lambda template which uses nodejs12.x runtime, so override it
newCloudformation.Resources.ShowPages.Properties.Runtime = "nodejs20.x";
// Set compression min size
newCloudformation.Resources.RestApi.Properties.MinimumCompressionSize = 100;
Object.entries(newCloudformation.Resources).forEach(([key, value]) => {
if (value.Type == "AWS::Lambda::Function") {
value.Properties.Architectures = ["arm64"];
value.Properties.Tags = [
{
"Key": "app",
"Value": "rstreams-bus-ui"
},
{
"Key": "environment",
"Value": {
"Fn::Sub": "${Environment}"
}
},
{
"Key": "chub:tech:component",
"Value": key
},
{
"Key": "chub:tech:app",
"Value": {
"Fn::Sub": "${AWS::StackName}"
}
},
{
"Key": "chub:tech:env",
"Value": {
"Fn::Sub": "${Environment}"
}
}
]
}
});
let file = path.resolve(buildDir, newCloudformation.Outputs.LeoTemplate.Value.replace(/^.*?\/(cloudformation-.*)$/, "$1"));
let localfile = path.resolve(__dirname, "cloudformation.json");
let output = JSON.stringify(newCloudformation, null, 2);
fs.writeFileSync(file, output);
fs.writeFileSync(localfile, output);
done();
};