-
Notifications
You must be signed in to change notification settings - Fork 0
/
auto-discover.ts
46 lines (42 loc) · 1.33 KB
/
auto-discover.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
// eslint-disable-next-line import/no-extraneous-dependencies
import { Project } from 'projen';
import { LambdaAutoDiscoverOptions } from 'projen/lib/awscdk';
import { AutoDiscoverBase } from 'projen/lib/cdk';
import { EcsService, TYPESCRIPT_ECS_EXT } from './ecs';
import { LambdaFunction, TYPESCRIPT_LAMBDA_EXT } from './lambda';
/**
* Creates lambdas from entry points discovered in the project's source tree.
*/
export class LambdaAutoDiscover extends AutoDiscoverBase {
constructor(project: Project, options: LambdaAutoDiscoverOptions) {
super(project, {
projectdir: options.srcdir,
extension: TYPESCRIPT_LAMBDA_EXT,
});
for (const entrypoint of this.entrypoints) {
new LambdaFunction(this.project, {
entrypoint,
cdkDeps: options.cdkDeps,
...options.lambdaOptions,
});
}
}
}
/**
* Creates lambdas from entry points discovered in the project's source tree.
*/
export class EcsAutoDiscover extends AutoDiscoverBase {
constructor(project: Project, options: LambdaAutoDiscoverOptions) {
super(project, {
projectdir: options.srcdir,
extension: TYPESCRIPT_ECS_EXT,
});
for (const entrypoint of this.entrypoints) {
new EcsService(this.project, {
entrypoint,
cdkDeps: options.cdkDeps,
...options.lambdaOptions,
});
}
}
}