generated from kimisme9386/projen-template-awscdk-construct
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.projenrc.js
131 lines (112 loc) · 3.29 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
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
const {
awscdk,
Gitpod,
DevEnvironmentDockerImage,
JsonFile,
} = require('projen');
const project = new awscdk.AwsCdkConstructLibrary({
author: 'Chris Yang',
authorUrl: 'https://9incloud.com/',
cdkVersion: '2.1.0',
majorVersion: 2,
defaultReleaseBranch: 'main',
releaseBranches: {
cdkv1: { npmDistTag: 'cdkv1', majorVersion: 1 },
},
workflowNodeVersion: '14.17.0',
keywords: ['aws', 'cdk', 'codepipeline', 'badge', 'notification'],
jsiiFqn: 'projen.AwsCdkConstructLibrary',
name: 'cdk-codepipeline-badge-notification',
describe:
'Create AWS CodePipeline badge, GitHub commit status, slack notification for AWS CDK',
repositoryUrl: 'https://github.com/kimisme9386/cdk-codepipeline-badge-notification',
python: {
distName: 'cdk-codepipeline-badge-notification',
module: 'cdk_codepipeline_badge_notification',
},
catalog: {
announce: true,
},
stability: 'experimental',
autoApproveOptions: {
secret: 'GITHUB_TOKEN',
allowedUsernames: ['kimisme9386-bot'],
},
depsUpgradeOptions: {
workflowOptions: {
labels: ['auto-approve'],
},
ignoreProjen: false,
},
});
new JsonFile(project, 'cdk.json', {
obj: {
app: 'npx ts-node --prefer-ts-exts src/integ.default.ts',
},
});
project.eslint.addRules({
'comma-dangle': [
'error',
{
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'never',
},
],
});
const common_exclude = [
'cdk.out',
'cdk.context.json',
'images',
'yarn-error.log',
'dependabot.yml',
'lambda/codepipeline-event/dist',
];
project.npmignore.exclude(...common_exclude);
project.gitignore.exclude(...common_exclude);
const common_include = ['/lambda/codepipeline-event/tsconfig.json'];
project.npmignore.include(...common_include);
project.gitignore.include(...common_include);
// integration test
const cdkDiffInteg = project.addTask('cdk:diff-integ', {
description: 'cdk diff for integration test',
});
cdkDiffInteg.exec('cdk diff --app "npx ts-node --prefer-ts-exts src/integ.default.ts" -R --require-approval never');
const cdkDeployInteg = project.addTask('cdk:deploy-integ', {
description: 'cdk diff for integration test',
});
cdkDeployInteg.exec('cdk deploy --app "npx ts-node --prefer-ts-exts src/integ.default.ts" -R --require-approval never');
// gitpod
const gitpodPrebuild = project.addTask('gitpod:prebuild', {
description: 'Prebuild setup for Gitpod',
});
gitpodPrebuild.exec('npm -g i aws-cdk');
gitpodPrebuild.exec('npx projen upgrade');
gitpodPrebuild.exec('yarn install --frozen-lockfile --check-files');
let gitpod = new Gitpod(project, {
dockerImage: DevEnvironmentDockerImage.fromFile('.gitpod.Dockerfile'),
prebuilds: {
addCheck: true,
addBadge: true,
addLabel: true,
branches: true,
pullRequests: true,
pullRequestsFromForks: true,
},
});
gitpod.addCustomTask({
name: 'install package and check zsh and zsh plugin',
init: `yarn gitpod:prebuild
sudo chmod +x ./.gitpod/oh-my-zsh.sh && ./.gitpod/oh-my-zsh.sh`,
});
gitpod.addCustomTask({
name: 'change default shell to zsh and start zsh shell',
command: 'sudo chsh -s $(which zsh) && zsh',
});
/* spellchecker: disable */
gitpod.addVscodeExtensions(
'dbaeumer.vscode-eslint'
);
project.synth();