-
Notifications
You must be signed in to change notification settings - Fork 6
/
.projenrc.ts
144 lines (134 loc) · 4.22 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import * as path from 'path';
import { CdklabsJsiiProject } from 'cdklabs-projen-project-types';
import { JsonPatch, TextFile } from 'projen';
import { NpmAccess } from 'projen/lib/javascript';
import { BundleGuard } from './projenrc';
const project = new CdklabsJsiiProject({
private: false,
author: 'AWS',
authorAddress: 'aws-cdk-dev@amazon.com',
defaultReleaseBranch: 'main',
minNodeVersion: '16.14.0',
cdklabsPublishingDefaults: false,
devDeps: [
'cdklabs-projen-project-types',
'@octokit/types',
'@octokit/rest',
'mock-fs',
'@types/mock-fs',
'constructs',
'aws-cdk-lib@^2.76.0',
'jsii@^5.0.0',
'jsii-rosetta@^5.0.0',
'fs-extra@^11.1.1',
'@types/fs-extra@11.0.1',
'klaw@^4.1.0',
'@types/klaw@3.0.3',
],
name: '@cdklabs/cdk-validator-cfnguard',
jsiiVersion: '~5.0.0',
keywords: [
'cdk',
'validator',
'policy as code',
],
githubOptions: {
mergify: false,
},
npmAccess: NpmAccess.PUBLIC,
enablePRAutoMerge: true,
projenrcTs: true,
release: true,
repositoryUrl: 'https://github.com/cdklabs/cdk-validator-cfnguard.git',
peerDeps: [
'aws-cdk-lib@^2.76.0',
],
publishToPypi: {
distName: 'cdklabs.cdk-validator-cfnguard',
module: 'cdklabs.cdk_validator_cfnguard',
},
publishToMaven: {
javaPackage: 'io.github.cdklabs.cdkvalidatorcfnguard',
mavenGroupId: 'io.github.cdklabs',
mavenArtifactId: 'cdk-validator-cfnguard',
mavenEndpoint: 'https://s01.oss.sonatype.org',
},
publishToNuget: {
dotNetNamespace: 'Cdklabs.CdkValidatorCfnGuard',
packageId: 'Cdklabs.CdkValidatorCfnGuard',
},
jestOptions: {
jestConfig: {
globals: {
'ts-jest': {
isolatedModules: true,
},
},
},
},
// deps: [], /* Runtime dependencies of this module. */
// description: undefined, /* The description is just a string that helps people understand the purpose of the package. */
// packageName: undefined, /* The "name" in package.json. */
});
project.addTask('integ', {
description: 'Run integration snapshot tests',
exec: 'npx cdk synth --app "ts-node test/integ.plugin.ts"',
});
const rosettaTask = project.addTask('rosetta:extract', {
description: 'Test rosetta extract',
exec: 'yarn --silent jsii-rosetta extract --strict',
});
project.postCompileTask.spawn(rosettaTask);
project.addGitIgnore('.jsii.tabl.json');
new TextFile(project, 'rosetta/default.ts-fixture', {
lines: [
'// Fixture with packages imported, but nothing else',
"import { Construct } from 'constructs';",
"import { CfnGuardValidator } from '@cdklabs/cdk-validator-cfnguard';",
'import {',
' Stack,',
' App,',
"} from 'aws-cdk-lib';",
'',
'class Fixture extends Stack {',
' constructor(scope: Construct, id: string) {',
' super(scope, id);',
'',
' /// here',
' }',
'}',
],
marker: false,
});
new TextFile(project, '.github/CODEOWNERS', {
lines: [
'# global owners',
'# These owners will be the default owners for everything in',
'# the repo. Unless a later match takes precedence',
'# @cdklabs/aws-cdk-team will be requested for',
'# review when someone opens a pull request.',
'* @cdklabs/aws-cdk-team',
'',
'# CT team owns the policies',
'/rules/ @cdklabs/cdk-validator-cfnguard',
'',
'# allow bot to approve dependency updates',
'package.json @cdklabs/aws-cdk-team @cdklabs-automation',
'yarn.lock @cdklabs/aws-cdk-team @cdklabs-automation',
],
marker: false,
});
project.postCompileTask.spawn(rosettaTask);
project.addGitIgnore('.jsii.tabl.json');
for (const workflow of ['build', 'release']) {
const file = project.tryFindObjectFile(path.join(__dirname, `./.github/workflows/${workflow}.yml`));
file?.patch(JsonPatch.add(`/jobs/${workflow}/env/GITHUB_TOKEN`, '${{ secrets.GITHUB_TOKEN }}' ));
file?.patch(JsonPatch.add(`/jobs/${workflow}/env/NODE_OPTIONS`, '--max-old-space-size=8196 --experimental-worker ${NODE_OPTIONS:-}'));
}
project.tsconfig?.addInclude('projenrc/**/*.ts');
project.gitignore.exclude('bin');
project.gitignore.exclude('cdk.out');
project.gitignore.exclude('test/*.snapshot');
project.gitignore.exclude('test/cdk-integ.out*');
new BundleGuard(project);
project.synth();