Repository navigation
Expand file tree
/
Copy path.projenrc.ts
More file actions
227 lines (213 loc) · 7.66 KB
/
Copy path.projenrc.ts
File metadata and controls
227 lines (213 loc) · 7.66 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
import { awscdk, javascript, JsonPatch } from 'projen';
import { ArrowParens, TrailingComma } from 'projen/lib/javascript';
const project = new awscdk.AwsCdkConstructLibrary({
author: 'DataChefHQ',
authorAddress: 'hi@datachef.co',
cdkVersion: '2.273.0',
defaultReleaseBranch: 'main',
constructsVersion: '10.8.1',
cdkVersionPinning: false,
projenVersion: '^0.104.5',
bumpPackage: 'commit-and-tag-version@^13.2.2',
jsiiVersion: '^6.0.18',
// Keep TypeScript aligned with the compiler supported by jsii and ts-jest.
typescriptVersion: '~6.0.3',
name: 'aws-data-landing-zone',
description: 'AWS CDK Data Landing Zone construct',
packageManager: javascript.NodePackageManager.NPM,
projenrcTs: true,
repositoryUrl: 'https://github.com/DataChefHQ/aws-data-landing-zone.git',
tsconfig: {
compilerOptions: {
inlineSourceMap: true,
},
},
prettierOptions: {
settings: {
printWidth: 120,
useTabs: false,
tabWidth: 2,
semi: true,
singleQuote: true,
bracketSpacing: true,
trailingComma: TrailingComma.ES5,
arrowParens: ArrowParens.ALWAYS,
},
},
pullRequestTemplate: false,
githubOptions: {
pullRequestLintOptions: {
semanticTitleOptions: {
types: ['feat', 'fix', 'docs', 'ci', 'chore'],
},
},
},
workflowNodeVersion: '22',
compat: true,
publishToPypi: {
distName: 'aws-data-landing-zone',
module: 'aws_data_landing_zone',
},
deps: [
'cdk-express-pipeline@2.3.1',
],
peerDeps: [
'cdk-express-pipeline@2.3.1',
],
bundledDeps: [
'@aws-sdk/client-sts@^3.1150.0',
'@aws-sdk/credential-providers@^3.1150.0',
'@aws-sdk/client-bcm-data-exports@^3.1150.0',
'@aws-sdk/client-cost-explorer@^3.1150.0',
'@aws-sdk/client-identitystore@^3.1150.0',
'@aws-sdk/client-sso-admin@^3.1150.0',
'@aws-sdk/client-iam@^3.1150.0',
'@aws-sdk/client-cloudformation@^3.1150.0',
'@aws-sdk/client-guardduty@^3.1150.0',
'@aws-sdk/client-macie2@^3.1150.0',
'@aws-sdk/client-organizations@^3.1150.0',
'@aws-sdk/client-sns@^3.1150.0',
'@aws-sdk/client-cloudtrail@^3.1150.0',
'@aws-sdk/client-config-service@^3.1150.0',
'@aws-sdk/client-resource-groups-tagging-api@^3.1150.0',
'js-yaml@^5.4.3',
'table',
],
devDeps: [
'husky',
'@types/aws-lambda',
'@types/node@^22',
'cdk-express-pipeline@2.3.1',
'jsii-docgen@^10.12.7',
],
jestOptions: {
jestVersion: '^30',
jestConfig: {
moduleFileExtensions: ['ts', 'tsx', 'js', 'mjs', 'cjs', 'jsx', 'json', 'node'], // https://jestjs.io/docs/configuration#modulefileextensions-arraystring
},
},
});
project.addDevDeps('eslint-import-resolver-typescript@^4.4.5');
// Use release tags for generated GitHub Actions instead of projen's commit hashes.
project.github!.actions.set('actions/checkout', 'actions/checkout@v7.0.1');
project.github!.actions.set('actions/upload-artifact', 'actions/upload-artifact@v7.0.1');
project.github!.actions.set('actions/download-artifact', 'actions/download-artifact@v8.0.1');
project.github!.actions.set('amannn/action-semantic-pull-request', 'amannn/action-semantic-pull-request@v6.1.1');
project.bundler.addBundle('./src/constructs/iam-identity-center/identity-store-user-lambda/', {
platform: 'node',
target: 'node22',
sourcemap: true,
externals: ['aws-sdk'],
});
project.bundler.addBundle('./src/constructs/iam/lambda/iam-account-alias/', {
platform: 'node',
target: 'node22',
sourcemap: true,
externals: ['aws-sdk'],
});
project.bundler.addBundle('./src/constructs/dlz-guardduty/lambda/guardduty-delegated-admin/', {
platform: 'node',
target: 'node22',
sourcemap: true,
externals: ['aws-sdk'],
});
project.bundler.addBundle('./src/constructs/dlz-guardduty/lambda/guardduty-member-features/', {
platform: 'node',
target: 'node22',
sourcemap: true,
externals: ['aws-sdk'],
});
project.bundler.addBundle('./src/constructs/dlz-guardduty/lambda/guardduty-org-config/', {
platform: 'node',
target: 'node22',
sourcemap: true,
externals: ['aws-sdk'],
});
project.bundler.addBundle('./src/constructs/dlz-macie/lambda/macie-delegated-admin/', {
platform: 'node',
target: 'node22',
sourcemap: true,
externals: ['aws-sdk'],
});
project.bundler.addBundle('./src/constructs/dlz-macie/lambda/macie-org-config/', {
platform: 'node',
target: 'node22',
sourcemap: true,
externals: ['aws-sdk'],
});
project.bundler.addBundle('./src/constructs/dlz-macie/lambda/macie-members/', {
platform: 'node',
target: 'node22',
sourcemap: true,
externals: ['aws-sdk'],
});
project.bundler.addBundle('./src/constructs/dlz-data-exports/lambda/tag-activation/', {
platform: 'node',
target: 'node22',
sourcemap: true,
externals: ['aws-sdk'],
});
project.bundler.addBundle('./src/constructs/dlz-tag-compliance-alert/lambda/tag-alert-formatter/', {
platform: 'node',
target: 'node22',
sourcemap: true,
externals: ['aws-sdk'],
});
project.bundler.addBundle('./src/constructs/dlz-data-exports/lambda/data-export-manager/', {
platform: 'node',
target: 'node22',
sourcemap: true,
externals: ['aws-sdk'],
});
project.eslint!.addRules({
'no-bitwise': 'off',
});
project.package.addEngine('node', '^22');
project.package.addEngine('npm', '^10');
// Need to clear before compiling and packaging. Have to remove these because they are not cleared for some reason,
// only new files are added and it causes issues especially because when changing the folder structure the whole time.
const clear = project.addTask('clear-lib-and-dist');
clear.exec('rm -rf lib/ dist/');
// Only run husky if not in CI, in the post install script
project.package.setScript('prepare', 'if [ "$CI" = "true" ]; then echo "CI detected, not running husky"; else husky; fi');
project.gitignore.addPatterns('.dlz-reports');
project.gitignore.addPatterns('.idea');
project.gitignore.addPatterns('*.js');
project.gitignore.addPatterns('*.js.map');
project.gitignore.addPatterns('*.d.ts');
project.gitignore.addPatterns('*.DS_Store');
project.gitignore.addPatterns('.vscode/');
project.tasks.tryFind('docgen')?.exec('bash post-docgen.sh');
const ghReleaseWorkflow = project.tryFindObjectFile('.github/workflows/release.yml');
ghReleaseWorkflow?.patch(JsonPatch.add('/on/push/paths-ignore', ['docs/**']));
// Quote shell variables in generated workflows so actionlint's ShellCheck checks pass.
project.tryFindObjectFile('.github/workflows/build.yml')?.patch(JsonPatch.replace('/jobs/build/steps/4/run', [
'git add .',
'git diff --staged --patch --exit-code > repo.patch || echo "self_mutation_happened=true" >> "$GITHUB_OUTPUT"',
].join('\n')));
project.tryFindObjectFile('.github/workflows/upgrade-main.yml')?.patch(JsonPatch.replace('/jobs/upgrade/steps/4/run', [
'git add .',
'git diff --staged --patch --exit-code > repo.patch || echo "patch_created=true" >> "$GITHUB_OUTPUT"',
].join('\n')));
ghReleaseWorkflow?.patch(
JsonPatch.replace('/jobs/release/steps/5/run', [
'TAG=$(cat dist/releasetag.txt)',
'if [ -n "$TAG" ] && git ls-remote -q --exit-code --tags origin "$TAG"; then',
' echo "exists=true" >> "$GITHUB_OUTPUT"',
'else',
' echo "exists=false" >> "$GITHUB_OUTPUT"',
'fi',
'cat "$GITHUB_OUTPUT"',
].join('\n')),
JsonPatch.replace('/jobs/release/steps/6/run', [
'echo "latest_commit=$(git ls-remote origin -h "$GITHUB_REF" | cut -f1)" >> "$GITHUB_OUTPUT"',
'cat "$GITHUB_OUTPUT"',
].join('\n')),
JsonPatch.replace('/jobs/release_github/steps/3/run', [
'tag=$(cat "$RELEASE_TAG_FILE")',
'if ! gh release view "$tag" -R "$GITHUB_REPOSITORY" 2>/dev/null; then',
' gh release create "$tag" -R "$GITHUB_REPOSITORY" -F "$CHANGELOG_FILE" -t "$tag" --target "$GITHUB_SHA"',
'fi',
].join('\n')),
);
project.synth();