-
Notifications
You must be signed in to change notification settings - Fork 0
/
.projenrc.ts
79 lines (71 loc) · 2.2 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
import { awscdk, javascript, SampleFile, TextFile } from 'projen';
import { CdkConfig } from 'projen/lib/awscdk';
import { NpmAccess } from 'projen/lib/javascript';
const project = new awscdk.AwsCdkConstructLibrary({
author: 'Roman Filippov',
authorAddress: 'roman@scaleleap.com',
cdkVersion: '2.41.0',
constructsVersion: '10.1.102',
defaultReleaseBranch: 'main',
name: '@scaleleap/cdk-shared-static-website-hosting',
packageManager: javascript.NodePackageManager.NPM,
npmAccess: NpmAccess.PUBLIC,
projenrcTs: true,
repositoryUrl: 'https://github.com/ScaleLeap/shared-static-website-hosting',
license: 'MIT',
devDeps: [
'@types/aws-lambda',
'@aws-cdk/integ-tests-alpha',
'esbuild',
'dotenv',
],
gitignore: [
'.env',
'cdk.context.json',
],
integrationTestAutoDiscover: true,
});
const DOT_ENV_EXAMPLE: Record<string, string> = {
AWS_ACCOUNT_ID: '000000000',
ROOT_ZONE_NAME: 'foo.example.com',
};
const dotEnvExample = new TextFile(project, '.env.example', {
lines: Object.entries(DOT_ENV_EXAMPLE).map((kv) => kv.join('=')),
});
new TextFile(project, `${project.testdir}/env.ts`, {
lines: [
"import 'dotenv/config';",
...Object.keys(DOT_ENV_EXAMPLE).map((key) => `export const ${key} = String(process.env.${key});`),
],
});
new SampleFile(project, '.env', {
sourcePath: dotEnvExample.path,
});
// Fixes: https://github.com/projen/projen/issues/1347
const cdkConfig = new CdkConfig(project, {
app: '', // Required for types.
watchIncludes: [
`${project.srcdir}/**/*.ts`,
`${project.testdir}/**/*.integ.ts`,
],
});
cdkConfig.json.addDeletionOverride('app');
cdkConfig.json.addDeletionOverride('context');
cdkConfig.json.addDeletionOverride('output');
/**
* A hack to remove the integratio test from the overall test process.
*
* These tests are executed in CI, and require acccess to AWS.
*
* > Need to perform AWS calls for account 000000000, but no credentials have been configured
*
* Can't figure out another way to disable the integ tests from being injected into the test task.
*/
project.testTask.steps.forEach((step) => {
if (step.spawn?.startsWith('integ:')) {
Object.assign(step, {
spawn: undefined,
});
}
});
project.synth();