-
Notifications
You must be signed in to change notification settings - Fork 0
/
.projenrc.ts
128 lines (119 loc) · 3.54 KB
/
.projenrc.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { NxMonorepoProject } from "@aws-prototyping-sdk/nx-monorepo";
import { awscdk } from "projen";
import { TypeScriptProject } from "projen/lib/typescript";
const project = new NxMonorepoProject({
name: "aws-serverless-prometheus-push-gateway",
defaultReleaseBranch: "main",
projenrcTs: true,
prettier: true,
devDeps: [
"@aws-prototyping-sdk/nx-monorepo",
"@types/jest",
"@commitlint/cli",
"@commitlint/config-conventional",
"commitizen",
"cz-conventional-changelog",
],
gitignore: [
".DS_Store",
".idea",
".vscode",
"**/*.js",
"**/*.d.ts",
"cdk.out",
],
});
// Commit lint and commitizen settings
project.addFields({
config: {
commitizen: {
path: "./node_modules/cz-conventional-changelog",
},
},
commitlint: {
extends: ["@commitlint/config-conventional"],
},
});
const awsServerlessPrometheusPushGateway =
"aws-serverless-prometheus-push-gateway";
const pushGateway = new TypeScriptProject({
parent: project,
name: awsServerlessPrometheusPushGateway,
defaultReleaseBranch: "main",
description:
"A serverless gateway to allow any source application/device to send metrics to a Prometheus workspace without long running services.",
license: "Apache-2.0",
outdir: "aws-serverless-prometheus-push-gateway",
devDeps: ["@types/jest", "@types/node"],
bundledDeps: [
"@opentelemetry/api",
"@opentelemetry/core",
"@opentelemetry/exporter-metrics-otlp-proto",
"@opentelemetry/resources",
"@opentelemetry/sdk-metrics",
"@types/aws-lambda",
"loglevel",
],
tsconfig: {
compilerOptions: {
lib: ["es2020", "dom"],
target: "es2020",
module: "commonjs",
esModuleInterop: true,
},
exclude: ["node_modules", "**/*.test.ts"],
},
eslintOptions: {
dirs: ["."],
ignorePatterns: [
"**/*.test.ts",
"*.js",
"!.projenrc.js",
"*.d.ts",
"node_modules/",
"*.generated.ts",
"coverage",
],
},
prettier: true,
package: false,
});
const pushGatewayBundle = pushGateway.bundler.addBundle("src/index.ts", {
target: "es2020",
platform: "node",
});
const pushGatewayConstruct = new awscdk.AwsCdkConstructLibrary({
parent: project,
author: "Jeff Strunk",
authorAddress: "strunkjd@amazon.com",
cdkVersion: "2.130.0",
defaultReleaseBranch: "main",
name: "cdk-aws-serverless-prometheus-push-gateway",
license: "Apache-2.0",
description:
"A CDK Construct to deploy a gateway to allow any source application/device to send metrics to a Prometheus workspace without long running services.",
repositoryUrl:
"https://github.com/awslabs/aws-serverless-prometheus-push-gateway.git",
keywords: ["iot", "prometheus"],
outdir: "cdk",
deps: ["aws-cdk-lib", "cdk-nag"],
devDeps: ["@types/jest", "@types/node"],
prettier: true,
lambdaAutoDiscover: false,
sampleCode: false,
});
pushGatewayConstruct.addPackageIgnore("example/*");
const pgcPostCompile = pushGatewayConstruct.tasks.tryFind("post-compile");
if (pgcPostCompile) {
pgcPostCompile.exec(`mkdir -p ${pushGatewayConstruct.libdir}/lambda/`);
pgcPostCompile.exec(
`cp ../${awsServerlessPrometheusPushGateway}/${pushGatewayBundle.outfile} ${pushGatewayConstruct.libdir}/lambda/`
);
pgcPostCompile.exec(
`cp ../${awsServerlessPrometheusPushGateway}/src/otel-config.yaml ${pushGatewayConstruct.libdir}/lambda/`
);
}
project.addImplicitDependency(pushGatewayConstruct, pushGateway);
project.synth();