-
Notifications
You must be signed in to change notification settings - Fork 3
/
.projenrc.js
134 lines (122 loc) · 3.43 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
132
133
134
const { JsiiProject, Semver, Stability } = require('projen');
const LATEST_CDK_VERSION = Semver.caret('1.61.0');
const Deps = {
'@aws-cdk/aws-apigateway': LATEST_CDK_VERSION,
'@aws-cdk/aws-certificatemanager': LATEST_CDK_VERSION,
'@aws-cdk/aws-dynamodb': LATEST_CDK_VERSION,
'@aws-cdk/aws-iam': LATEST_CDK_VERSION,
'@aws-cdk/aws-lambda-event-sources': LATEST_CDK_VERSION,
'@aws-cdk/aws-lambda': LATEST_CDK_VERSION,
'@aws-cdk/aws-route53': LATEST_CDK_VERSION,
'@aws-cdk/aws-route53-targets': LATEST_CDK_VERSION,
'@aws-cdk/core': LATEST_CDK_VERSION,
};
const devDeps = {
'aws-lambda': Semver.caret('1.0.6'),
'aws-sdk': Semver.caret('2.738.0'),
'@aws-cdk/assert': LATEST_CDK_VERSION,
'@types/aws-lambda': Semver.caret('8.10.61'),
'@types/node': Semver.caret('10.17.0'),
};
const lambdaFunctionDeps = {
nanoid: Semver.caret('3.1.12'),
};
const lambdaBundlerDeps = {
'@rollup/plugin-commonjs': Semver.caret('15.0.0'),
'@rollup/plugin-node-resolve': Semver.caret('9.0.0'),
'rollup-plugin-typescript2': Semver.caret('0.27.2'),
'rollup-plugin-terser': Semver.caret('7.0.0'),
'rollup-plugin-delete': Semver.caret('2.0.0'),
rollup: Semver.caret('2.26.6'),
'builtin-modules': Semver.caret('3.1.0'),
};
const project = new JsiiProject({
name: '@rayou/cdk-url-shortener',
description:
'Deploy a URL shortener with custom domain support in just a few lines of code.',
authorName: 'Ray Ou',
authorEmail: 'yuhung.ou@live.com',
authorUrl: 'https://twitter.com/_rayou',
repository: 'https://github.com/rayou/cdk-url-shortener.git',
stability: Stability.EXPERIMENTAL,
releaseEveryCommit: false,
peerDependencyOptions: {
pinnedDevDependency: false,
},
dependencies: {
...Deps,
},
jsiiVersion: Semver.caret('1.11.0'),
jestOptions: {
ignorePatterns: [
'/node_modules/',
'dist',
'cdk.out',
'coverage',
'lib',
'.github',
],
},
python: {
distName: 'rayou.cdk-url-shortener',
module: 'rayou.cdk_url_shortener',
},
java: {
javaPackage: 'com.github.rayou.urlshortener',
mavenGroupId: 'com.github.rayou',
mavenArtifactId: 'cdk-url-shortener',
},
dotnet: {
dotNetNamespace: 'CDK.URLShortener',
packageId: 'CDK.URLShortener',
},
});
// CDK
project.addFields({
keywords: ['cdk', 'url-shortener', 'aws', 'aws-cdk', 'aws-cdk-construct'],
awscdkio: {
twitter: '_rayou',
},
});
// entries to be included in the package ref: https://docs.npmjs.com/files/package.json#files
project.addFields({
files: ['lib', '.jsii'],
});
// package.json
project.addDevDependencies({
...devDeps,
...lambdaFunctionDeps,
...lambdaBundlerDeps,
});
project.addPeerDependencies({
...Deps,
constructs: Semver.caret('3.0.4'),
});
project.addScriptCommand('compile:lambda', ['rollup -c']);
project.addScriptCommand('postcompile', ['yarn run compile:lambda']);
project.addFields({
publishConfig: {
access: 'public', // to allow publishing scoped package
},
});
// ESLint
project.eslint.addRules({
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'**/build-tools/**',
'**/test/**',
'**/lambda-fns/**/*.ts',
],
optionalDependencies: false,
peerDependencies: true,
},
],
});
['dist', 'cdk.out', 'lib', '.github'].forEach((pattern) =>
project.eslint.addIgnorePattern(pattern),
);
// .gitignore
project.gitignore.exclude('.DS_Store', 'cdk.out', 'cdk.context.json');
project.synth();