-
Notifications
You must be signed in to change notification settings - Fork 0
/
.projenrc.js
91 lines (73 loc) · 2.54 KB
/
.projenrc.js
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
const fs = require('fs');
const { JsiiProject } = require('projen');
const project = new JsiiProject({
// we invoke jsii-docgen explicitly to create a api reference
// per submodule. see scripts/docgen.ts
docgen: false,
releaseToNpm: false,
defaultReleaseBranch: 'main',
authorName: 'Eli Polonsky',
repository: 'https://github.com/iliapolo/aws-cdk-sdk',
name: 'aws-cdk-sdk',
peerDeps: [
'@aws-cdk/core',
'@aws-cdk/custom-resources',
'constructs',
],
devDeps: [
'aws-cdk',
'@aws-cdk/aws-ssm',
'@aws-cdk/aws-elasticsearch',
'@aws-cdk/aws-s3',
'@aws-cdk/aws-sqs',
'aws-sdk',
'codemaker',
'json-schema',
'jsii-docgen',
'json2jsii',
'typescript-parser',
'ts-node',
],
stability: 'experimental',
testdir: 'src/__tests__',
projenUpgradeSecret: 'CDK_AUTOMATION_GITHUB_TOKEN',
autoApproveOptions: {
allowedUsernames: ['aws-cdk-automation'],
secret: 'GITHUB_TOKEN',
},
autoApproveUpgrades: true,
});
const codegen = project.addTask('codegen');
codegen.exec('ts-node --skip-project codegen/main.ts');
const docgen = project.addTask('docgen');
docgen.exec('ts-node --skip-project scripts/docgen.ts');
discoverIntegrationTests();
project.compileTask.prependExec('rm -rf lib');
project.compileTask.prependSpawn(codegen);
project.compileTask.spawn(docgen);
project.gitignore.exclude('cdk.out');
project.gitignore.exclude('.sdk');
project.gitignore.exclude('.vscode/');
// lots of code - need some more memory...
project.testTask.env('NODE_OPTIONS', '--max_old_space_size=5000');
project.compileTask.env('NODE_OPTIONS', '--max_old_space_size=5000');
project.tasks.tryFind('eslint').env('NODE_OPTIONS', '--max_old_space_size=5000');
project.eslint.addIgnorePattern('codegen/**');
project.eslint.addIgnorePattern('scripts/**');
project.eslint.addRules({ 'max-len': ['error', { code: 2000 }] });
project.synth();
function discoverIntegrationTests() {
const clients = 'src/__tests__/clients';
for (const client of fs.readdirSync(clients)) {
const integ = `${clients}/${client}/${client}.integ.ts`;
if (fs.existsSync(integ)) {
const cdk = `cdk -a 'node ${integ.replace('src', 'lib').replace('.ts', '.js')}'`;
for (const command of ['synth', 'deploy', 'destroy']) {
const task = project.tasks.tryFind(`integ:${command}`) ? project.tasks.tryFind(`integ:${command}`) : project.addTask(`integ:${command}`);
const subtask = project.addTask(`integ:${client}:${command}`);
subtask.exec(`${cdk} ${command}`);
task.spawn(subtask);
}
}
}
}