-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.projenrc.ts
127 lines (115 loc) · 4.12 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
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { ConstructLibraryCdktf } from "projen/lib/cdktf";
import { UpgradeDependenciesSchedule } from "projen/lib/javascript";
import { AutoApprove } from "./projenrc/auto-approve";
import { Automerge } from "./projenrc/automerge";
import { CustomizedLicense } from "./projenrc/customized-license";
import { UpgradeCDKTF } from "./projenrc/upgrade-cdktf";
import { UpgradeJSIIAndTypeScript } from "./projenrc/upgrade-jsii-typescript";
const cdktfVersion = ">=0.20.0";
const constructVersion = "^10.3.0";
/** JSII and TS should always use the same major/minor version range */
const typescriptVersion = "~5.5.0";
const name = "cdktf-multi-stack-tfe";
const githubActionPinnedVersions = {
"actions/checkout": "11bd71901bbe5b1630ceea73d27597364c9af683", // v4.2.2
"actions/download-artifact": "fa0a91b85d4f404e444e00e005971372dc801d16", // v4.1.8
"actions/github-script": "60a0d83039c74a4aee543508d2ffcb1c3799cdea", // v7.0.1
"actions/setup-node": "39370e3970a6d050c480ffad4ff0ed4d3fdee5af", // v4.1.0
"actions/setup-python": "0b93645e9fea7318ecaed2b359559ac225c90a2b", // v5.3.0
"actions/upload-artifact": "6f51ac03b9356f520e9adb1b1b7802705f340c2b", // v4.5.0
"amannn/action-semantic-pull-request":
"0723387faaf9b38adef4775cd42cfd5155ed6017", // v5.5.3
"hashicorp/setup-copywrite": "32638da2d4e81d56a0764aa1547882fc4d209636", // v1.1.3
"peter-evans/create-pull-request": "67ccf781d68cd99b580ae25a5c18a1cc84ffff1f", // v7.0.6
};
const project = new ConstructLibraryCdktf({
author: "HashiCorp",
authorAddress: "https://hashicorp.com",
authorOrganization: true,
defaultReleaseBranch: "main",
name,
cdktfVersion,
repositoryUrl: "https://github.com/cdktf/cdktf-multi-stack-tfe.git",
description: `Sets up TFE / TFC workspaces for all stacks based on a seed stack.`,
typescriptVersion,
jsiiVersion: typescriptVersion,
licensed: false,
prettier: true,
projenrcTs: true,
mergify: false,
depsUpgradeOptions: {
workflowOptions: {
labels: ["auto-approve", "automerge", "dependencies"],
schedule: UpgradeDependenciesSchedule.WEEKLY,
},
},
publishToPypi: {
distName: name,
module: name.replace(/-/g, "_"),
},
workflowGitIdentity: {
name: "team-tf-cdk",
email: "[email protected]",
},
pullRequestTemplate: false,
});
new CustomizedLicense(project);
new AutoApprove(project);
new Automerge(project);
new UpgradeCDKTF(project);
new UpgradeJSIIAndTypeScript(project, typescriptVersion);
project.addPeerDeps(
`cdktf@${cdktfVersion}`,
"@cdktf/provider-tfe@>=11.0.0",
`constructs@${constructVersion}`
);
project.addDevDeps(
"semver",
"@types/semver",
"ts-node@^10.9.1",
`cdktf-cli@${cdktfVersion}`
);
project.testTask.exec(`npx cdktf synth`, {
name: "synth TS example",
cwd: "./examples/typescript",
});
project.gitignore.include("examples/typescript/tsconfig.json");
project.jest?.addIgnorePattern("dist");
project.addPackageIgnore("scripts");
project.addPackageIgnore("examples");
project.addPackageIgnore("projenrc");
project.addPackageIgnore("/.projenrc.ts");
project.addPackageIgnore(".copywrite.hcl");
// Run copywrite tool to add copyright headers to all files
project.buildWorkflow?.addPostBuildSteps(
{
name: "Setup Copywrite tool",
uses: "hashicorp/setup-copywrite",
},
{ name: "Add headers using Copywrite tool", run: "copywrite headers" }
);
// Use pinned versions of github actions
Object.entries(githubActionPinnedVersions).forEach(([action, sha]) => {
project.github?.actions.set(action, `${action}@${sha}`);
});
const releaseWorkflow = project.tryFindObjectFile(
".github/workflows/release.yml"
);
releaseWorkflow?.addOverride("on.push", {
branches: ["main"],
"paths-ignore": [
// don't do a release if the change was only to these files/directories
"examples/**",
".github/ISSUE_TEMPLATE/**",
".github/CODEOWNERS",
".github/dependabot.yml",
".github/**/*.md",
],
});
// always publish a new GitHub release, even when publishing to a particular package manager fails
releaseWorkflow?.addOverride("jobs.release_github.needs", "release");
project.synth();