forked from projen/projen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.projenrc.ts
More file actions
301 lines (256 loc) · 7.77 KB
/
Copy path.projenrc.ts
File metadata and controls
301 lines (256 loc) · 7.77 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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
import * as path from "path";
import {
setupProjenBootstrap,
setupBundleTaskRunner,
setupCheckLicenses,
setupDevcontainer,
setupJsiiDocgen,
setupGitignore,
setupGitpod,
setupMarkdown,
setupNpmignore,
setupUpgradeDependencies,
setupVscode,
WindowsBuild,
JsiiFromJsonSchema,
JsonConst,
IntegrationTests,
} from "./projenrc";
import {
AiInstructions,
javascript,
JsonPatch,
ReleasableCommits,
} from "./src";
import { JsiiProject } from "./src/cdk";
import { tryResolveDependencyVersion } from "./src/javascript/util";
const AUTOMATION_USER = "projen-automation";
const BOOTSTRAP_SCRIPT = "projen.js";
const project = new JsiiProject({
name: "projen",
description: "CDK for software projects",
repositoryUrl: "https://github.com/projen/projen.git",
author: "Amazon Web Services",
authorAddress: "https://aws.amazon.com",
authorOrganization: true,
stability: "experimental",
keywords: [
"scaffolding",
"cicd",
"project",
"management",
"generator",
"cdk",
],
githubOptions: {
mergify: false,
mergeQueue: true,
pullRequestLintOptions: {
contributorStatement:
"By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.",
contributorStatementOptions: {
exemptUsers: [AUTOMATION_USER, "dependabot[bot]"],
},
},
dependencyReview: true,
dependencyReviewOptions: {
warnOnly: true,
},
},
jsiiVersion: "5.9.x",
typescriptVersion: "5.9.x",
packageManager: javascript.NodePackageManager.NPM,
deps: ["constructs@^10.0.0"],
bundledDeps: [
"conventional-changelog-config-spec",
"yaml@^2.2.2",
"yargs",
"case",
"fast-glob",
"semver",
"chalk",
"@iarna/toml",
"xmlbuilder2",
"ini",
"shx",
"fast-json-patch",
"comment-json@4.2.2",
"parse-conflict-json",
],
devDeps: [
"@types/conventional-changelog-config-spec",
"@types/yargs",
"@types/semver",
"@types/ini",
"@types/parse-conflict-json",
"markmac",
"esbuild",
"json2jsii",
// Needed to generate biome config
"@biomejs/biome@^2",
// used to get current node versions in tests
"@jsii/check-node",
// used to get CDK V2 feature flags
"aws-cdk-lib",
],
peerDeps: ["constructs@^10.0.0"],
depsUpgrade: false, // configured below
auditDeps: true,
auditDepsOptions: {
prodOnly: true,
},
projenDevDependency: false, // because I am projen
releaseToNpm: true,
minNodeVersion: "16.0.0", // Do not change this before a version has been EOL for a while
workflowNodeVersion: "lts/-1", // use the previous lts for builds
codeCov: true,
prettier: true,
defaultReleaseBranch: "main",
gitpod: true,
devContainer: true,
// since this is projen, we need to always compile before we run
projenCommand: `node ./${BOOTSTRAP_SCRIPT}`,
projenrcTs: true,
projectTree: true,
// Disable interop since it's disabled available in jsii
tsconfigDev: {
compilerOptions: {
esModuleInterop: false,
},
exclude: ["docusaurus/**/*"],
},
jestOptions: {
// makes it very hard to iterate with jest --watch
coverageText: false,
jestConfig: {
// Adding text-summary as a replacement for text
coverageReporters: [
"json",
"lcov",
"clover",
"cobertura",
"text-summary",
],
// By default jest will try to use all CPU cores on the running machine.
// But some of our integration tests spawn child processes - so by
// creating one jest worker per test, some of the child processes will get
// starved of CPU time and sometimes hang or timeout. This should
// help mitigate that.
maxWorkers: "50%",
},
},
// To reduce the release frequency we only release features and fixes
// This is important because PyPI has limits on the total storage amount used, and extensions need to be manually requested
releasableCommits: ReleasableCommits.featuresAndFixes(),
releaseEnvironment: "release",
publishToMaven: {
javaPackage: "io.github.cdklabs.projen",
mavenGroupId: "io.github.cdklabs",
mavenArtifactId: "projen",
},
publishToPypi: {
distName: "projen",
module: "projen",
trustedPublishing: true,
},
publishToGo: {
moduleName: "github.com/projen/projen-go",
},
npmTrustedPublishing: true,
npmProvenance: true,
releaseFailureIssue: true,
autoApproveUpgrades: true,
autoApproveOptions: { allowedUsernames: [AUTOMATION_USER] },
checkLicenses: {
allow: [
"MIT",
"ISC",
"BSD-2-Clause",
"BSD-3-Clause",
"Apache-2.0",
"Python-2.0",
],
},
});
javascript.Eslint.of(project)?.addRules({
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-exports": "error",
});
// Trusted Publishing requires npm 11 which is available by default in node 24
project.github
?.tryFindWorkflow("release")
?.file?.patch(
JsonPatch.replace("/jobs/release_npm/steps/0/with/node-version", "24.x"),
);
setupCheckLicenses(project);
setupUpgradeDependencies(project);
setupJsiiDocgen(project);
setupProjenBootstrap(project, BOOTSTRAP_SCRIPT);
// because snapshots include the projen marker...
project.addExcludeFromCleanup("test/**");
setupGitignore(project);
setupMarkdown(project);
setupVscode(project);
setupGitpod(project);
setupDevcontainer(project);
setupNpmignore(project);
new IntegrationTests(project);
setupBundleTaskRunner(project);
new JsiiFromJsonSchema(project, {
structName: "BiomeConfiguration",
schemaPath: require.resolve("@biomejs/biome/configuration_schema.json"),
filePath: path.join("src", "javascript", "biome", "biome-config.ts"),
});
new JsiiFromJsonSchema(project, {
structName: "PyprojectToml",
schemaPath: "schemas/pyproject.json",
filePath: path.join("src", "python", "pyproject-toml.ts"),
transform: (schema) => (
(schema.properties.tool.properties = Object.fromEntries(
Object.entries(schema.properties.tool.properties).map(
([tool, def]) => (delete (def as any).$ref, [tool, def]),
),
)),
schema
),
});
new JsiiFromJsonSchema(project, {
structName: "UvConfiguration",
schemaPath: "schemas/uv.json",
filePath: path.join("src", "python", "uv-config.ts"),
transform: (schema) => (
(schema.properties["cache-dir"].description = schema.properties[
"cache-dir"
].description
.split("\n")
.at(0)),
schema
),
});
new JsonConst(project, {
jsonPath: require.resolve("aws-cdk-lib/recommended-feature-flags.json"),
filePath: path.join("src", "awscdk", "private", "feature-flags-v2.const.ts"),
comment: `Feature flags as of v${
tryResolveDependencyVersion("aws-cdk-lib") || "2"
}`,
});
new WindowsBuild(project);
// we are projen, so re-synth after compiling.
// fixes feedback loop where projen contributors run "build"
// but not all files are updated
if (project.defaultTask) {
project.postCompileTask.spawn(project.defaultTask);
}
// This is the projen repo itself.
// We cannot report a version here as it would change during the release version bump and cause the tampering check to fail.
// Instead we report the repo as fake version. Has no effect on the published package.
project.node.addMetadata("projen.version", "https://github.com/projen/projen");
new AiInstructions(project, {
instructions: [
`# Developing projen itself
- **Avoid running a full build**: It takes a long time. Instead run individual tasks directly.
- **Run specific tests**: Use \`${project.projenCommand} test test/path-to-test.test.ts\` to run specific test files. Prefer this over running all tests.
- **Always run the linter**: Use \`${project.projenCommand} eslint\` to ensure any code is formatted correctly and follows best practices. Use often.`,
],
});
project.synth();