-
Notifications
You must be signed in to change notification settings - Fork 0
/
.projenrc.ts
129 lines (124 loc) · 3.71 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
129
import { awscdk } from 'projen';
import { NodePackageManager, Transform } from 'projen/lib/javascript';
import { EcsAutoDiscover, LambdaAutoDiscover } from './projenrc/auto-discover';
const alphaVersion = '^2.151.0-alpha.0';
const project = new awscdk.AwsCdkTypeScriptApp({
cdkVersion: '2.151.0',
defaultReleaseBranch: 'main',
release: false,
buildWorkflow: false,
depsUpgrade: false,
githubOptions: {
mergify: false,
pullRequestLint: false,
},
name: 'cdk-example-app',
projenrcTs: true,
prettier: true,
prettierOptions: {
settings: {
singleQuote: true,
},
},
eslintOptions: {
dirs: [],
prettier: true,
},
packageManager: NodePackageManager.NPM,
deps: [
'express',
'@cdklabs/cdk-validator-cfnguard',
'hall-constructs',
`@aws-cdk/integ-tests-alpha@${alphaVersion}`,
`@aws-cdk/aws-redshift-alpha@${alphaVersion}`,
`@aws-cdk/integ-runner@${alphaVersion}`,
'cdk-monitoring-constructs',
'node-fetch',
],
lambdaAutoDiscover: false,
devDeps: [
'@swc/core',
'@swc/helpers',
'cdk-dia',
'aws-sdk-client-mock',
'supertest',
'@types/supertest',
'case',
'aws-xray-sdk',
'@aws-sdk/client-dynamodb',
'@aws-sdk/util-dynamodb',
'@types/aws-lambda',
'@types/express',
'@aws-lambda-powertools/commons',
'@aws-lambda-powertools/logger',
'@aws-lambda-powertools/metrics',
'@aws-lambda-powertools/tracer',
],
buildCommand: undefined,
jestOptions: {
jestConfig: {
transform: {
'^.+\\.ts$': new Transform('ts-jest', {
isolatedModules: true,
tsconfig: 'tsconfig.dev.json',
}),
},
},
},
// deps: [], /* Runtime dependencies of this module. */
// description: undefined, /* The description is just a string that helps people understand the purpose of the package. */
// devDeps: [], /* Build dependencies for this module. */
// packageName: undefined, /* The "name" in package.json. */
});
const eslint = project.tryFindObjectFile('.eslintrc.json');
// I don't want to show linting errors for things that get auto fixed
eslint?.addOverride('extends', ['plugin:import/typescript']);
project.tryFindObjectFile('package.json')?.addDeletionOverride('jest.globals');
project.removeTask('deploy');
project.addTask('deploy', {
steps: [
{
spawn: project.compileTask.name,
},
{
exec: 'npx cdk deploy --profile sandbox --method=direct --require-approval=never',
receiveArgs: true,
},
],
});
// project.cdkConfig.json.addOverride('app', 'npx ts-node -P tsconfig.json --prefer-ts-exts src/main.ts');
// project.cdkConfig.json.addOverride('app', 'npx node -r ts-node/register --inspect-brk src/main.ts');
const buildCommand = 'yarn projen && yarn projen compile && yarn projen bundle';
project.tsconfig?.file.addOverride('ts-node', {
swc: true,
});
project.tsconfigDev.file.addOverride('ts-node', {
swc: true,
});
project.cdkTasks.synthSilent.reset();
project.cdkTasks.synthSilent.exec(`npx cdk synth -q --build "${buildCommand}"`);
project.addTask('dia', {
steps: [
{
exec: 'npx cdk-dia --rendering cytoscape-html',
},
{
exec: 'npx http-server diagram -o',
},
],
});
const integTest = project.addTask('integ', {
exec: 'yarn integ-runner',
});
project.testTask.spawn(integTest);
const cdkjson = project.tryFindObjectFile('cdk.json');
cdkjson?.addToArray('watch.exclude', 'cdk-integ.out*');
project.gitignore.exclude('cdk-integ.out**');
const autoDiscoverOptions = {
cdkDeps: project.cdkDeps,
srcdir: project.srcdir,
tsconfigPath: project.tsconfigDev.fileName,
};
new LambdaAutoDiscover(project, autoDiscoverOptions);
new EcsAutoDiscover(project, autoDiscoverOptions);
project.synth();