-
Notifications
You must be signed in to change notification settings - Fork 34
/
.projenrc.ts
147 lines (132 loc) · 4.46 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
145
146
147
import { typescript } from 'projen';
const project = new typescript.TypeScriptProject({
name: 'aws-delivlib',
projenrcTs: true,
description: 'A fabulous library for defining continuous pipelines for building, testing and releasing code libraries.',
repository: 'https://github.com/cdklabs/aws-delivlib.git',
defaultReleaseBranch: 'main',
authorName: 'Amazon Web Services',
authorUrl: 'https://aws.amazon.com',
minNodeVersion: '18.12.0',
workflowNodeVersion: '18.x',
keywords: [
'aws-cdk',
'continuous-delivery',
'continuous-integration',
'ci-cd',
],
deps: ['changelog-parser'],
depsUpgradeOptions: {
exclude: ['aws-cdk-lib', 'constructs'],
},
devDeps: [
'@types/aws-lambda',
'@types/fs-extra',
'@types/tar',
'@types/adm-zip',
'@types/follow-redirects',
'aws-cdk',
'constructs',
'aws-cdk-lib',
'standard-version',
'ts-jest',
'typescript',
'@aws-sdk/client-s3',
'@aws-sdk/client-ssm',
'@aws-sdk/client-secrets-manager',
'@aws-sdk/client-codepipeline',
'@aws-sdk/client-cloudwatch',
'[email protected]', // need to pin due to https://github.com/axios/axios/issues/5101
'rrule',
'esbuild',
'fs-extra',
'tar',
'adm-zip',
'JSONStream',
'follow-redirects',
'[email protected]', // temporary (hopefully) workaround for https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/60901
],
peerDeps: [
'constructs',
'aws-cdk-lib',
],
srcdir: 'lib',
testdir: 'lib/__tests__',
pullRequestTemplate: false,
autoApproveOptions: {
allowedUsernames: ['cdklabs-automation'],
secret: 'GITHUB_TOKEN',
},
autoApproveUpgrades: true,
releaseToNpm: true,
githubOptions: {
mergify: false,
mergeQueue: true,
},
});
// trick projen so that it doesn't override the version in package.json
project.tasks.addEnvironment('RELEASE', '1');
project.gitignore.exclude('cdk.out');
project.gitignore.exclude('pipeline/*.js');
project.gitignore.exclude('pipeline/*.d.ts');
project.setScript('cdk', 'npx cdk');
const integDiff = project.addTask('integ:diff');
integDiff.exec('/bin/bash ./lib/__tests__/run-test.sh');
const integUpdate = project.addTask('integ:update');
integUpdate.exec('/bin/bash ./lib/__tests__/run-test.sh update');
// Need to run with UTC TZ, or else node-ical does very wrong things with timestamps and fails tests...
project.testTask.env('TZ', 'UTC');
project.testTask.spawn(integDiff);
// Run yarn install in the github publisher directory
const buildGithubPublisher = project.addTask('build:publishing/github');
buildGithubPublisher.exec('yarn install --frozen-lockfile', { cwd: 'lib/publishing/github' });
buildGithubPublisher.exec('yarn tsc --build', { cwd: 'lib/publishing/github' });
project.compileTask.prependSpawn(buildGithubPublisher);
// Exclude the publisher from the root tsconfig, but add a reference to it
project.tsconfig?.addExclude('lib/publishing/github');
project.tsconfig?.file.addOverride('references', [{ path: 'lib/publishing/github' }]);
const compileCustomResourceHandlers = project.addTask('compile:custom-resource-handlers');
compileCustomResourceHandlers.exec('/bin/bash ./build-custom-resource-handlers.sh');
project.compileTask.prependSpawn(compileCustomResourceHandlers);
project.gitignore.include('lib/package-integrity/handler/JSONStream.d.ts');
const bundlePackageIntegrity = project.addTask('bundle:package-integrity', {
description: 'Bundle the package integrity script',
exec: [
'esbuild',
'--bundle',
'lib/package-integrity/handler/validate.js',
'--target="node14"',
'--platform="node"',
'--outfile="lib/package-integrity/handler/validate.bundle.js"',
'--sourcemap=inline',
].join(' '),
});
project.compileTask.spawn(bundlePackageIntegrity);
// Make sure that all "update-ssm" scripts are the same, so that they don't drift.
project.preCompileTask.exec(`for a in lib/publishing/*/update-ssm.sh; do
for b in lib/publishing/*/update-ssm.sh; do
if ! diff $a $b; then
echo "Files should be the same but are not:\n- $a\n- $b"
exit 1
fi
done
done`);
// The npmignore file includes original source files, which is undesirable.
project.npmignore?.exclude(
'/lib/**/*.ts',
);
project.npmignore?.include(
'/lib/**/*.d.ts',
'/lib/**/node_modules/**',
);
// Also includes other undesirable assets.
project.npmignore?.exclude(
'/lib/__tests__/',
'tsconfig.json',
'tsconfig.dev.json',
'tsconfig.tsbuildinfo',
'/build-*.sh',
'cdk.out/',
'cdk.json',
);
project.synth();