@taimos/projen 0.1.96 → 0.1.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +438 -18
- package/API.md +526 -0
- package/lib/components/amplify-deploy.js +1 -1
- package/lib/components/git-hooks.d.ts +98 -0
- package/lib/components/git-hooks.js +134 -0
- package/lib/components/gitleaks.js +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +2 -1
- package/lib/components/production-release.js +1 -1
- package/lib/projects/api-library.js +1 -1
- package/lib/projects/cdk-app.js +1 -1
- package/lib/projects/cdk-construct.js +1 -1
- package/lib/projects/monorepo.d.ts +16 -1
- package/lib/projects/monorepo.js +11 -2
- package/lib/projects/private-cdk-app.js +1 -1
- package/lib/projects/private-ts-lib.js +1 -1
- package/lib/projects/prod-cdk-app.js +1 -1
- package/lib/projects/ts-lib.js +1 -1
- package/package.json +8 -8
package/API.md
CHANGED
|
@@ -2,6 +2,293 @@
|
|
|
2
2
|
|
|
3
3
|
## Constructs <a name="Constructs" id="Constructs"></a>
|
|
4
4
|
|
|
5
|
+
### GitHooks <a name="GitHooks" id="@taimos/projen.GitHooks"></a>
|
|
6
|
+
|
|
7
|
+
Local git hooks managed by Lefthook (ADR-0013): a generated `lefthook.yml`, a root `prepare` script that runs `lefthook install`, and a pinned `lefthook` devDependency.
|
|
8
|
+
|
|
9
|
+
Hooks cover a staged secret scan, projen drift, lint and typecheck per
|
|
10
|
+
package, and a Conventional Commits check on the first commit of a branch.
|
|
11
|
+
CI should set `LEFTHOOK=0`.
|
|
12
|
+
|
|
13
|
+
#### Initializers <a name="Initializers" id="@taimos/projen.GitHooks.Initializer"></a>
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { GitHooks } from '@taimos/projen'
|
|
17
|
+
|
|
18
|
+
new GitHooks(tsProject: TypeScriptProject, options?: GitHooksOptions)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
| **Name** | **Type** | **Description** |
|
|
22
|
+
| --- | --- | --- |
|
|
23
|
+
| <code><a href="#@taimos/projen.GitHooks.Initializer.parameter.tsProject">tsProject</a></code> | <code>projen.typescript.TypeScriptProject</code> | *No description.* |
|
|
24
|
+
| <code><a href="#@taimos/projen.GitHooks.Initializer.parameter.options">options</a></code> | <code><a href="#@taimos/projen.GitHooksOptions">GitHooksOptions</a></code> | *No description.* |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
##### `tsProject`<sup>Required</sup> <a name="tsProject" id="@taimos/projen.GitHooks.Initializer.parameter.tsProject"></a>
|
|
29
|
+
|
|
30
|
+
- *Type:* projen.typescript.TypeScriptProject
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
##### `options`<sup>Optional</sup> <a name="options" id="@taimos/projen.GitHooks.Initializer.parameter.options"></a>
|
|
35
|
+
|
|
36
|
+
- *Type:* <a href="#@taimos/projen.GitHooksOptions">GitHooksOptions</a>
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
#### Methods <a name="Methods" id="Methods"></a>
|
|
41
|
+
|
|
42
|
+
| **Name** | **Description** |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| <code><a href="#@taimos/projen.GitHooks.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
45
|
+
| <code><a href="#@taimos/projen.GitHooks.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
46
|
+
| <code><a href="#@taimos/projen.GitHooks.postProjectCreation">postProjectCreation</a></code> | Called once, right after `postSynthesize()`, only when the project is created for the first time. |
|
|
47
|
+
| <code><a href="#@taimos/projen.GitHooks.postSynthesize">postSynthesize</a></code> | Called after synthesis. |
|
|
48
|
+
| <code><a href="#@taimos/projen.GitHooks.preSynthesize">preSynthesize</a></code> | Called before synthesis. |
|
|
49
|
+
| <code><a href="#@taimos/projen.GitHooks.projectCreation">projectCreation</a></code> | Called once, right after `synthesize()`, only when the project is created for the first time. |
|
|
50
|
+
| <code><a href="#@taimos/projen.GitHooks.synthesize">synthesize</a></code> | Synthesizes files to the project output directory. |
|
|
51
|
+
| <code><a href="#@taimos/projen.GitHooks.addPackage">addPackage</a></code> | Add a package that runs its own lint and typecheck scripts. |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
##### `toString` <a name="toString" id="@taimos/projen.GitHooks.toString"></a>
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
public toString(): string
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Returns a string representation of this construct.
|
|
62
|
+
|
|
63
|
+
##### `with` <a name="with" id="@taimos/projen.GitHooks.with"></a>
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
public with(mixins: ...IMixin[]): IConstruct
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Applies one or more mixins to this construct.
|
|
70
|
+
|
|
71
|
+
Mixins are applied in order. The list of constructs is captured at the
|
|
72
|
+
start of the call, so constructs added by a mixin will not be visited.
|
|
73
|
+
Use multiple `with()` calls if subsequent mixins should apply to added
|
|
74
|
+
constructs.
|
|
75
|
+
|
|
76
|
+
###### `mixins`<sup>Required</sup> <a name="mixins" id="@taimos/projen.GitHooks.with.parameter.mixins"></a>
|
|
77
|
+
|
|
78
|
+
- *Type:* ...constructs.IMixin[]
|
|
79
|
+
|
|
80
|
+
The mixins to apply.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
##### `postProjectCreation` <a name="postProjectCreation" id="@taimos/projen.GitHooks.postProjectCreation"></a>
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
public postProjectCreation(initProject: InitProject): void
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Called once, right after `postSynthesize()`, only when the project is created for the first time.
|
|
91
|
+
|
|
92
|
+
It does not run on later `projen` invocations. It only fires for `projen new` (or `Projects.createProject`).
|
|
93
|
+
It is also skipped when post-synthesis steps are disabled, e.g. `--no-post` or `PROJEN_DISABLE_POST`.
|
|
94
|
+
Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate
|
|
95
|
+
feedback on their new project. Order across components is not guaranteed.
|
|
96
|
+
|
|
97
|
+
###### `initProject`<sup>Required</sup> <a name="initProject" id="@taimos/projen.GitHooks.postProjectCreation.parameter.initProject"></a>
|
|
98
|
+
|
|
99
|
+
- *Type:* projen.InitProject
|
|
100
|
+
|
|
101
|
+
Details about how the project was created, e.g. its type and the original CLI args.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
##### `postSynthesize` <a name="postSynthesize" id="@taimos/projen.GitHooks.postSynthesize"></a>
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
public postSynthesize(): void
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Called after synthesis.
|
|
112
|
+
|
|
113
|
+
Order is *not* guaranteed.
|
|
114
|
+
|
|
115
|
+
##### `preSynthesize` <a name="preSynthesize" id="@taimos/projen.GitHooks.preSynthesize"></a>
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
public preSynthesize(): void
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Called before synthesis.
|
|
122
|
+
|
|
123
|
+
##### `projectCreation` <a name="projectCreation" id="@taimos/projen.GitHooks.projectCreation"></a>
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
public projectCreation(initProject: InitProject): void
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Called once, right after `synthesize()`, only when the project is created for the first time.
|
|
130
|
+
|
|
131
|
+
It does not run on later `projen` invocations. It only fires for `projen new` (or `Projects.createProject`).
|
|
132
|
+
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
|
|
133
|
+
|
|
134
|
+
###### `initProject`<sup>Required</sup> <a name="initProject" id="@taimos/projen.GitHooks.projectCreation.parameter.initProject"></a>
|
|
135
|
+
|
|
136
|
+
- *Type:* projen.InitProject
|
|
137
|
+
|
|
138
|
+
Details about how the project was created, e.g. its type and the original CLI args.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
##### `synthesize` <a name="synthesize" id="@taimos/projen.GitHooks.synthesize"></a>
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
public synthesize(): void
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Synthesizes files to the project output directory.
|
|
149
|
+
|
|
150
|
+
##### `addPackage` <a name="addPackage" id="@taimos/projen.GitHooks.addPackage"></a>
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
public addPackage(pkg: GitHooksPackage): void
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Add a package that runs its own lint and typecheck scripts.
|
|
157
|
+
|
|
158
|
+
###### `pkg`<sup>Required</sup> <a name="pkg" id="@taimos/projen.GitHooks.addPackage.parameter.pkg"></a>
|
|
159
|
+
|
|
160
|
+
- *Type:* <a href="#@taimos/projen.GitHooksPackage">GitHooksPackage</a>
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
165
|
+
|
|
166
|
+
| **Name** | **Description** |
|
|
167
|
+
| --- | --- |
|
|
168
|
+
| <code><a href="#@taimos/projen.GitHooks.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
169
|
+
| <code><a href="#@taimos/projen.GitHooks.isComponent">isComponent</a></code> | Test whether the given construct is a component. |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
##### `isConstruct` <a name="isConstruct" id="@taimos/projen.GitHooks.isConstruct"></a>
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
import { GitHooks } from '@taimos/projen'
|
|
177
|
+
|
|
178
|
+
GitHooks.isConstruct(x: any)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Checks if `x` is a construct.
|
|
182
|
+
|
|
183
|
+
Use this method instead of `instanceof` to properly detect `Construct`
|
|
184
|
+
instances, even when the construct library is symlinked.
|
|
185
|
+
|
|
186
|
+
Explanation: in JavaScript, multiple copies of the `constructs` library on
|
|
187
|
+
disk are seen as independent, completely different libraries. As a
|
|
188
|
+
consequence, the class `Construct` in each copy of the `constructs` library
|
|
189
|
+
is seen as a different class, and an instance of one class will not test as
|
|
190
|
+
`instanceof` the other class. `npm install` will not create installations
|
|
191
|
+
like this, but users may manually symlink construct libraries together or
|
|
192
|
+
use a monorepo tool: in those cases, multiple copies of the `constructs`
|
|
193
|
+
library can be accidentally installed, and `instanceof` will behave
|
|
194
|
+
unpredictably. It is safest to avoid using `instanceof`, and using
|
|
195
|
+
this type-testing method instead.
|
|
196
|
+
|
|
197
|
+
###### `x`<sup>Required</sup> <a name="x" id="@taimos/projen.GitHooks.isConstruct.parameter.x"></a>
|
|
198
|
+
|
|
199
|
+
- *Type:* any
|
|
200
|
+
|
|
201
|
+
Any object.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
##### `isComponent` <a name="isComponent" id="@taimos/projen.GitHooks.isComponent"></a>
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
import { GitHooks } from '@taimos/projen'
|
|
209
|
+
|
|
210
|
+
GitHooks.isComponent(x: any)
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Test whether the given construct is a component.
|
|
214
|
+
|
|
215
|
+
###### `x`<sup>Required</sup> <a name="x" id="@taimos/projen.GitHooks.isComponent.parameter.x"></a>
|
|
216
|
+
|
|
217
|
+
- *Type:* any
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
222
|
+
|
|
223
|
+
| **Name** | **Type** | **Description** |
|
|
224
|
+
| --- | --- | --- |
|
|
225
|
+
| <code><a href="#@taimos/projen.GitHooks.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
226
|
+
| <code><a href="#@taimos/projen.GitHooks.property.project">project</a></code> | <code>projen.Project</code> | *No description.* |
|
|
227
|
+
| <code><a href="#@taimos/projen.GitHooks.property.commitMsgScript">commitMsgScript</a></code> | <code>projen.TextFile</code> | The generated commit-msg check script. |
|
|
228
|
+
| <code><a href="#@taimos/projen.GitHooks.property.configFile">configFile</a></code> | <code>projen.YamlFile</code> | The generated `lefthook.yml`. |
|
|
229
|
+
| <code><a href="#@taimos/projen.GitHooks.property.projenDriftScript">projenDriftScript</a></code> | <code>projen.TextFile</code> | The generated projen drift check script, if enabled. |
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
##### `node`<sup>Required</sup> <a name="node" id="@taimos/projen.GitHooks.property.node"></a>
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
public readonly node: Node;
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
- *Type:* constructs.Node
|
|
240
|
+
|
|
241
|
+
The tree node.
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
##### `project`<sup>Required</sup> <a name="project" id="@taimos/projen.GitHooks.property.project"></a>
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
public readonly project: Project;
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
- *Type:* projen.Project
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
##### `commitMsgScript`<sup>Required</sup> <a name="commitMsgScript" id="@taimos/projen.GitHooks.property.commitMsgScript"></a>
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
public readonly commitMsgScript: TextFile;
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
- *Type:* projen.TextFile
|
|
262
|
+
|
|
263
|
+
The generated commit-msg check script.
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
##### `configFile`<sup>Required</sup> <a name="configFile" id="@taimos/projen.GitHooks.property.configFile"></a>
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
public readonly configFile: YamlFile;
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
- *Type:* projen.YamlFile
|
|
274
|
+
|
|
275
|
+
The generated `lefthook.yml`.
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
##### `projenDriftScript`<sup>Optional</sup> <a name="projenDriftScript" id="@taimos/projen.GitHooks.property.projenDriftScript"></a>
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
public readonly projenDriftScript: TextFile;
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
- *Type:* projen.TextFile
|
|
286
|
+
|
|
287
|
+
The generated projen drift check script, if enabled.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
|
|
5
292
|
### GitHubAmplifyDeploy <a name="GitHubAmplifyDeploy" id="@taimos/projen.GitHubAmplifyDeploy"></a>
|
|
6
293
|
|
|
7
294
|
Adds one path-scoped deploy workflow per Amplify Hosting app.
|
|
@@ -1499,6 +1786,7 @@ When given a project, this it the project itself.
|
|
|
1499
1786
|
| <code><a href="#@taimos/projen.MonorepoProject.property.amplifyDeploy">amplifyDeploy</a></code> | <code><a href="#@taimos/projen.GitHubAmplifyDeploy">GitHubAmplifyDeploy</a></code> | The Amplify deploy workflows, when `amplifyDeployOptions` is set. |
|
|
1500
1787
|
| <code><a href="#@taimos/projen.MonorepoProject.property.amplifyFile">amplifyFile</a></code> | <code>projen.YamlFile</code> | The generated `amplify.yml`, if any Amplify apps were configured. |
|
|
1501
1788
|
| <code><a href="#@taimos/projen.MonorepoProject.property.assignApprover">assignApprover</a></code> | <code>projen-pipelines.GitHubAssignApprover</code> | The PR approver assignment, if enabled. |
|
|
1789
|
+
| <code><a href="#@taimos/projen.MonorepoProject.property.gitHooks">gitHooks</a></code> | <code><a href="#@taimos/projen.GitHooks">GitHooks</a></code> | The Lefthook git hooks component, if enabled. |
|
|
1502
1790
|
| <code><a href="#@taimos/projen.MonorepoProject.property.gitleaks">gitleaks</a></code> | <code><a href="#@taimos/projen.Gitleaks">Gitleaks</a></code> | The gitleaks secret-scanning component, if enabled. |
|
|
1503
1791
|
| <code><a href="#@taimos/projen.MonorepoProject.property.productionRelease">productionRelease</a></code> | <code><a href="#@taimos/projen.GitHubProductionRelease">GitHubProductionRelease</a></code> | The production release workflow, if enabled. |
|
|
1504
1792
|
|
|
@@ -2273,6 +2561,18 @@ The PR approver assignment, if enabled.
|
|
|
2273
2561
|
|
|
2274
2562
|
---
|
|
2275
2563
|
|
|
2564
|
+
##### `gitHooks`<sup>Optional</sup> <a name="gitHooks" id="@taimos/projen.MonorepoProject.property.gitHooks"></a>
|
|
2565
|
+
|
|
2566
|
+
```typescript
|
|
2567
|
+
public readonly gitHooks: GitHooks;
|
|
2568
|
+
```
|
|
2569
|
+
|
|
2570
|
+
- *Type:* <a href="#@taimos/projen.GitHooks">GitHooks</a>
|
|
2571
|
+
|
|
2572
|
+
The Lefthook git hooks component, if enabled.
|
|
2573
|
+
|
|
2574
|
+
---
|
|
2575
|
+
|
|
2276
2576
|
##### `gitleaks`<sup>Optional</sup> <a name="gitleaks" id="@taimos/projen.MonorepoProject.property.gitleaks"></a>
|
|
2277
2577
|
|
|
2278
2578
|
```typescript
|
|
@@ -12602,6 +12902,202 @@ The OpenAPI spec file, relative to the package root.
|
|
|
12602
12902
|
|
|
12603
12903
|
---
|
|
12604
12904
|
|
|
12905
|
+
### GitHooksOptions <a name="GitHooksOptions" id="@taimos/projen.GitHooksOptions"></a>
|
|
12906
|
+
|
|
12907
|
+
#### Initializer <a name="Initializer" id="@taimos/projen.GitHooksOptions.Initializer"></a>
|
|
12908
|
+
|
|
12909
|
+
```typescript
|
|
12910
|
+
import { GitHooksOptions } from '@taimos/projen'
|
|
12911
|
+
|
|
12912
|
+
const gitHooksOptions: GitHooksOptions = { ... }
|
|
12913
|
+
```
|
|
12914
|
+
|
|
12915
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
12916
|
+
|
|
12917
|
+
| **Name** | **Type** | **Description** |
|
|
12918
|
+
| --- | --- | --- |
|
|
12919
|
+
| <code><a href="#@taimos/projen.GitHooksOptions.property.commitTypes">commitTypes</a></code> | <code>string[]</code> | Types accepted by the commit-msg check on the first commit of a branch. |
|
|
12920
|
+
| <code><a href="#@taimos/projen.GitHooksOptions.property.defaultBranch">defaultBranch</a></code> | <code>string</code> | The branch the first-commit detection compares against. |
|
|
12921
|
+
| <code><a href="#@taimos/projen.GitHooksOptions.property.gitleaks">gitleaks</a></code> | <code>boolean</code> | Add a pre-commit gitleaks scan of staged changes. |
|
|
12922
|
+
| <code><a href="#@taimos/projen.GitHooksOptions.property.lefthookVersion">lefthookVersion</a></code> | <code>string</code> | The pinned lefthook version added as a devDependency. |
|
|
12923
|
+
| <code><a href="#@taimos/projen.GitHooksOptions.property.packages">packages</a></code> | <code><a href="#@taimos/projen.GitHooksPackage">GitHooksPackage</a>[]</code> | Additional (non-projen) packages, e.g. frontends, that run their own `lint` and `typecheck` package scripts. |
|
|
12924
|
+
| <code><a href="#@taimos/projen.GitHooksOptions.property.projenDrift">projenDrift</a></code> | <code>boolean</code> | Add a pre-commit check that fails when `projen` synth changes any file. |
|
|
12925
|
+
| <code><a href="#@taimos/projen.GitHooksOptions.property.subprojectChecks">subprojectChecks</a></code> | <code>boolean</code> | Generate eslint and `tsc --noEmit` jobs for every projen TypeScript subproject, scoped to the subproject directory. |
|
|
12926
|
+
|
|
12927
|
+
---
|
|
12928
|
+
|
|
12929
|
+
##### `commitTypes`<sup>Optional</sup> <a name="commitTypes" id="@taimos/projen.GitHooksOptions.property.commitTypes"></a>
|
|
12930
|
+
|
|
12931
|
+
```typescript
|
|
12932
|
+
public readonly commitTypes: string[];
|
|
12933
|
+
```
|
|
12934
|
+
|
|
12935
|
+
- *Type:* string[]
|
|
12936
|
+
- *Default:* ['feat', 'fix', 'chore', 'docs', 'ci', 'spec']
|
|
12937
|
+
|
|
12938
|
+
Types accepted by the commit-msg check on the first commit of a branch.
|
|
12939
|
+
|
|
12940
|
+
Keep this in sync with the PR title check.
|
|
12941
|
+
|
|
12942
|
+
---
|
|
12943
|
+
|
|
12944
|
+
##### `defaultBranch`<sup>Optional</sup> <a name="defaultBranch" id="@taimos/projen.GitHooksOptions.property.defaultBranch"></a>
|
|
12945
|
+
|
|
12946
|
+
```typescript
|
|
12947
|
+
public readonly defaultBranch: string;
|
|
12948
|
+
```
|
|
12949
|
+
|
|
12950
|
+
- *Type:* string
|
|
12951
|
+
- *Default:* the `defaultReleaseBranch` of the project, falling back to 'main'
|
|
12952
|
+
|
|
12953
|
+
The branch the first-commit detection compares against.
|
|
12954
|
+
|
|
12955
|
+
---
|
|
12956
|
+
|
|
12957
|
+
##### `gitleaks`<sup>Optional</sup> <a name="gitleaks" id="@taimos/projen.GitHooksOptions.property.gitleaks"></a>
|
|
12958
|
+
|
|
12959
|
+
```typescript
|
|
12960
|
+
public readonly gitleaks: boolean;
|
|
12961
|
+
```
|
|
12962
|
+
|
|
12963
|
+
- *Type:* boolean
|
|
12964
|
+
- *Default:* true
|
|
12965
|
+
|
|
12966
|
+
Add a pre-commit gitleaks scan of staged changes.
|
|
12967
|
+
|
|
12968
|
+
Requires the `gitleaks`
|
|
12969
|
+
binary on the PATH. It reuses `.gitleaks.toml` when that file exists.
|
|
12970
|
+
|
|
12971
|
+
---
|
|
12972
|
+
|
|
12973
|
+
##### `lefthookVersion`<sup>Optional</sup> <a name="lefthookVersion" id="@taimos/projen.GitHooksOptions.property.lefthookVersion"></a>
|
|
12974
|
+
|
|
12975
|
+
```typescript
|
|
12976
|
+
public readonly lefthookVersion: string;
|
|
12977
|
+
```
|
|
12978
|
+
|
|
12979
|
+
- *Type:* string
|
|
12980
|
+
- *Default:* '1.11.13'
|
|
12981
|
+
|
|
12982
|
+
The pinned lefthook version added as a devDependency.
|
|
12983
|
+
|
|
12984
|
+
---
|
|
12985
|
+
|
|
12986
|
+
##### `packages`<sup>Optional</sup> <a name="packages" id="@taimos/projen.GitHooksOptions.property.packages"></a>
|
|
12987
|
+
|
|
12988
|
+
```typescript
|
|
12989
|
+
public readonly packages: GitHooksPackage[];
|
|
12990
|
+
```
|
|
12991
|
+
|
|
12992
|
+
- *Type:* <a href="#@taimos/projen.GitHooksPackage">GitHooksPackage</a>[]
|
|
12993
|
+
- *Default:* []
|
|
12994
|
+
|
|
12995
|
+
Additional (non-projen) packages, e.g. frontends, that run their own `lint` and `typecheck` package scripts.
|
|
12996
|
+
|
|
12997
|
+
---
|
|
12998
|
+
|
|
12999
|
+
##### `projenDrift`<sup>Optional</sup> <a name="projenDrift" id="@taimos/projen.GitHooksOptions.property.projenDrift"></a>
|
|
13000
|
+
|
|
13001
|
+
```typescript
|
|
13002
|
+
public readonly projenDrift: boolean;
|
|
13003
|
+
```
|
|
13004
|
+
|
|
13005
|
+
- *Type:* boolean
|
|
13006
|
+
- *Default:* true
|
|
13007
|
+
|
|
13008
|
+
Add a pre-commit check that fails when `projen` synth changes any file.
|
|
13009
|
+
|
|
13010
|
+
---
|
|
13011
|
+
|
|
13012
|
+
##### `subprojectChecks`<sup>Optional</sup> <a name="subprojectChecks" id="@taimos/projen.GitHooksOptions.property.subprojectChecks"></a>
|
|
13013
|
+
|
|
13014
|
+
```typescript
|
|
13015
|
+
public readonly subprojectChecks: boolean;
|
|
13016
|
+
```
|
|
13017
|
+
|
|
13018
|
+
- *Type:* boolean
|
|
13019
|
+
- *Default:* true
|
|
13020
|
+
|
|
13021
|
+
Generate eslint and `tsc --noEmit` jobs for every projen TypeScript subproject, scoped to the subproject directory.
|
|
13022
|
+
|
|
13023
|
+
---
|
|
13024
|
+
|
|
13025
|
+
### GitHooksPackage <a name="GitHooksPackage" id="@taimos/projen.GitHooksPackage"></a>
|
|
13026
|
+
|
|
13027
|
+
A package that gets lint and typecheck jobs in `lefthook.yml`.
|
|
13028
|
+
|
|
13029
|
+
#### Initializer <a name="Initializer" id="@taimos/projen.GitHooksPackage.Initializer"></a>
|
|
13030
|
+
|
|
13031
|
+
```typescript
|
|
13032
|
+
import { GitHooksPackage } from '@taimos/projen'
|
|
13033
|
+
|
|
13034
|
+
const gitHooksPackage: GitHooksPackage = { ... }
|
|
13035
|
+
```
|
|
13036
|
+
|
|
13037
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
13038
|
+
|
|
13039
|
+
| **Name** | **Type** | **Description** |
|
|
13040
|
+
| --- | --- | --- |
|
|
13041
|
+
| <code><a href="#@taimos/projen.GitHooksPackage.property.path">path</a></code> | <code>string</code> | Package directory relative to the repo root, e.g. `packages/web`. |
|
|
13042
|
+
| <code><a href="#@taimos/projen.GitHooksPackage.property.glob">glob</a></code> | <code>string</code> | File glob that selects the staged files that trigger the jobs. |
|
|
13043
|
+
| <code><a href="#@taimos/projen.GitHooksPackage.property.lint">lint</a></code> | <code>string</code> | Command that lints the package. |
|
|
13044
|
+
| <code><a href="#@taimos/projen.GitHooksPackage.property.typecheck">typecheck</a></code> | <code>string</code> | Command that typechecks the package. |
|
|
13045
|
+
|
|
13046
|
+
---
|
|
13047
|
+
|
|
13048
|
+
##### `path`<sup>Required</sup> <a name="path" id="@taimos/projen.GitHooksPackage.property.path"></a>
|
|
13049
|
+
|
|
13050
|
+
```typescript
|
|
13051
|
+
public readonly path: string;
|
|
13052
|
+
```
|
|
13053
|
+
|
|
13054
|
+
- *Type:* string
|
|
13055
|
+
|
|
13056
|
+
Package directory relative to the repo root, e.g. `packages/web`.
|
|
13057
|
+
|
|
13058
|
+
---
|
|
13059
|
+
|
|
13060
|
+
##### `glob`<sup>Optional</sup> <a name="glob" id="@taimos/projen.GitHooksPackage.property.glob"></a>
|
|
13061
|
+
|
|
13062
|
+
```typescript
|
|
13063
|
+
public readonly glob: string;
|
|
13064
|
+
```
|
|
13065
|
+
|
|
13066
|
+
- *Type:* string
|
|
13067
|
+
- *Default:* '*.{ts,tsx}'
|
|
13068
|
+
|
|
13069
|
+
File glob that selects the staged files that trigger the jobs.
|
|
13070
|
+
|
|
13071
|
+
---
|
|
13072
|
+
|
|
13073
|
+
##### `lint`<sup>Optional</sup> <a name="lint" id="@taimos/projen.GitHooksPackage.property.lint"></a>
|
|
13074
|
+
|
|
13075
|
+
```typescript
|
|
13076
|
+
public readonly lint: string;
|
|
13077
|
+
```
|
|
13078
|
+
|
|
13079
|
+
- *Type:* string
|
|
13080
|
+
- *Default:* 'pnpm run lint'
|
|
13081
|
+
|
|
13082
|
+
Command that lints the package.
|
|
13083
|
+
|
|
13084
|
+
`{staged_files}` is replaced by lefthook.
|
|
13085
|
+
|
|
13086
|
+
---
|
|
13087
|
+
|
|
13088
|
+
##### `typecheck`<sup>Optional</sup> <a name="typecheck" id="@taimos/projen.GitHooksPackage.property.typecheck"></a>
|
|
13089
|
+
|
|
13090
|
+
```typescript
|
|
13091
|
+
public readonly typecheck: string;
|
|
13092
|
+
```
|
|
13093
|
+
|
|
13094
|
+
- *Type:* string
|
|
13095
|
+
- *Default:* 'pnpm run typecheck'
|
|
13096
|
+
|
|
13097
|
+
Command that typechecks the package.
|
|
13098
|
+
|
|
13099
|
+
---
|
|
13100
|
+
|
|
12605
13101
|
### GitHubAmplifyDeployOptions <a name="GitHubAmplifyDeployOptions" id="@taimos/projen.GitHubAmplifyDeployOptions"></a>
|
|
12606
13102
|
|
|
12607
13103
|
#### Initializer <a name="Initializer" id="@taimos/projen.GitHubAmplifyDeployOptions.Initializer"></a>
|
|
@@ -13343,6 +13839,8 @@ const monorepoProjectOptions: MonorepoProjectOptions = { ... }
|
|
|
13343
13839
|
| <code><a href="#@taimos/projen.MonorepoProjectOptions.property.assignApprover">assignApprover</a></code> | <code>boolean</code> | Whether to assign PR approvers via `GitHubAssignApprover`. |
|
|
13344
13840
|
| <code><a href="#@taimos/projen.MonorepoProjectOptions.property.cdkServerless">cdkServerless</a></code> | <code>boolean</code> | Whether to add `cdk-serverless` as a workspace dev dependency. |
|
|
13345
13841
|
| <code><a href="#@taimos/projen.MonorepoProjectOptions.property.defaultApprovers">defaultApprovers</a></code> | <code>string[]</code> | Approvers assigned when no author-specific mapping matches. |
|
|
13842
|
+
| <code><a href="#@taimos/projen.MonorepoProjectOptions.property.gitHooks">gitHooks</a></code> | <code>boolean</code> | Whether to add local git hooks managed by Lefthook: a `lefthook.yml`, a root `prepare` script and a pinned `lefthook` devDependency (see `GitHooks`). |
|
|
13843
|
+
| <code><a href="#@taimos/projen.MonorepoProjectOptions.property.gitHooksOptions">gitHooksOptions</a></code> | <code><a href="#@taimos/projen.GitHooksOptions">GitHooksOptions</a></code> | Options for the git hooks component. |
|
|
13346
13844
|
| <code><a href="#@taimos/projen.MonorepoProjectOptions.property.gitleaks">gitleaks</a></code> | <code>boolean</code> | Whether to add gitleaks secret-scanning: a `.gitleaks.toml` config plus a pull-request workflow that scans the full git history (see `Gitleaks`). |
|
|
13347
13845
|
| <code><a href="#@taimos/projen.MonorepoProjectOptions.property.gitleaksOptions">gitleaksOptions</a></code> | <code><a href="#@taimos/projen.GitleaksOptions">GitleaksOptions</a></code> | Options for the gitleaks component. |
|
|
13348
13846
|
| <code><a href="#@taimos/projen.MonorepoProjectOptions.property.nodeVersion">nodeVersion</a></code> | <code>string</code> | The Node.js version used in the generated build workflow. |
|
|
@@ -15796,6 +16294,34 @@ Only used when `assignApprover` is enabled.
|
|
|
15796
16294
|
|
|
15797
16295
|
---
|
|
15798
16296
|
|
|
16297
|
+
##### `gitHooks`<sup>Optional</sup> <a name="gitHooks" id="@taimos/projen.MonorepoProjectOptions.property.gitHooks"></a>
|
|
16298
|
+
|
|
16299
|
+
```typescript
|
|
16300
|
+
public readonly gitHooks: boolean;
|
|
16301
|
+
```
|
|
16302
|
+
|
|
16303
|
+
- *Type:* boolean
|
|
16304
|
+
- *Default:* false
|
|
16305
|
+
|
|
16306
|
+
Whether to add local git hooks managed by Lefthook: a `lefthook.yml`, a root `prepare` script and a pinned `lefthook` devDependency (see `GitHooks`).
|
|
16307
|
+
|
|
16308
|
+
---
|
|
16309
|
+
|
|
16310
|
+
##### `gitHooksOptions`<sup>Optional</sup> <a name="gitHooksOptions" id="@taimos/projen.MonorepoProjectOptions.property.gitHooksOptions"></a>
|
|
16311
|
+
|
|
16312
|
+
```typescript
|
|
16313
|
+
public readonly gitHooksOptions: GitHooksOptions;
|
|
16314
|
+
```
|
|
16315
|
+
|
|
16316
|
+
- *Type:* <a href="#@taimos/projen.GitHooksOptions">GitHooksOptions</a>
|
|
16317
|
+
- *Default:* all checks enabled, first-commit types feat, fix, chore, docs, ci, spec
|
|
16318
|
+
|
|
16319
|
+
Options for the git hooks component.
|
|
16320
|
+
|
|
16321
|
+
Only used when `gitHooks` is enabled.
|
|
16322
|
+
|
|
16323
|
+
---
|
|
16324
|
+
|
|
15799
16325
|
##### `gitleaks`<sup>Optional</sup> <a name="gitleaks" id="@taimos/projen.MonorepoProjectOptions.property.gitleaks"></a>
|
|
15800
16326
|
|
|
15801
16327
|
```typescript
|
|
@@ -43,7 +43,7 @@ const DEFAULT_SHARED_BUILD_PATHS = [
|
|
|
43
43
|
* assume-role or parameter-read step rather than skipping a deploy.
|
|
44
44
|
*/
|
|
45
45
|
class GitHubAmplifyDeploy extends projen_1.Component {
|
|
46
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "@taimos/projen.GitHubAmplifyDeploy", version: "0.1.
|
|
46
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@taimos/projen.GitHubAmplifyDeploy", version: "0.1.98" };
|
|
47
47
|
/** The generated deploy workflows, one per app. */
|
|
48
48
|
workflows = [];
|
|
49
49
|
/** Name of the IAM role CI chains into, in every stage account. */
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Component, TextFile, YamlFile, typescript } from 'projen';
|
|
2
|
+
/**
|
|
3
|
+
* A package that gets lint and typecheck jobs in `lefthook.yml`.
|
|
4
|
+
*/
|
|
5
|
+
export interface GitHooksPackage {
|
|
6
|
+
/** Package directory relative to the repo root, e.g. `packages/web`. */
|
|
7
|
+
readonly path: string;
|
|
8
|
+
/**
|
|
9
|
+
* File glob that selects the staged files that trigger the jobs.
|
|
10
|
+
*
|
|
11
|
+
* @default '*.{ts,tsx}'
|
|
12
|
+
*/
|
|
13
|
+
readonly glob?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Command that lints the package. `{staged_files}` is replaced by lefthook.
|
|
16
|
+
*
|
|
17
|
+
* @default 'pnpm run lint'
|
|
18
|
+
*/
|
|
19
|
+
readonly lint?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Command that typechecks the package.
|
|
22
|
+
*
|
|
23
|
+
* @default 'pnpm run typecheck'
|
|
24
|
+
*/
|
|
25
|
+
readonly typecheck?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface GitHooksOptions {
|
|
28
|
+
/**
|
|
29
|
+
* The pinned lefthook version added as a devDependency.
|
|
30
|
+
*
|
|
31
|
+
* @default '1.11.13'
|
|
32
|
+
*/
|
|
33
|
+
readonly lefthookVersion?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Add a pre-commit gitleaks scan of staged changes. Requires the `gitleaks`
|
|
36
|
+
* binary on the PATH. It reuses `.gitleaks.toml` when that file exists.
|
|
37
|
+
*
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
readonly gitleaks?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Add a pre-commit check that fails when `projen` synth changes any file.
|
|
43
|
+
*
|
|
44
|
+
* @default true
|
|
45
|
+
*/
|
|
46
|
+
readonly projenDrift?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Generate eslint and `tsc --noEmit` jobs for every projen TypeScript
|
|
49
|
+
* subproject, scoped to the subproject directory.
|
|
50
|
+
*
|
|
51
|
+
* @default true
|
|
52
|
+
*/
|
|
53
|
+
readonly subprojectChecks?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Additional (non-projen) packages, e.g. frontends, that run their own
|
|
56
|
+
* `lint` and `typecheck` package scripts.
|
|
57
|
+
*
|
|
58
|
+
* @default []
|
|
59
|
+
*/
|
|
60
|
+
readonly packages?: GitHooksPackage[];
|
|
61
|
+
/**
|
|
62
|
+
* Types accepted by the commit-msg check on the first commit of a branch.
|
|
63
|
+
* Keep this in sync with the PR title check.
|
|
64
|
+
*
|
|
65
|
+
* @default ['feat', 'fix', 'chore', 'docs', 'ci', 'spec']
|
|
66
|
+
*/
|
|
67
|
+
readonly commitTypes?: string[];
|
|
68
|
+
/**
|
|
69
|
+
* The branch the first-commit detection compares against.
|
|
70
|
+
*
|
|
71
|
+
* @default - the `defaultReleaseBranch` of the project, falling back to 'main'
|
|
72
|
+
*/
|
|
73
|
+
readonly defaultBranch?: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Local git hooks managed by Lefthook (ADR-0013): a generated `lefthook.yml`,
|
|
77
|
+
* a root `prepare` script that runs `lefthook install`, and a pinned
|
|
78
|
+
* `lefthook` devDependency.
|
|
79
|
+
*
|
|
80
|
+
* Hooks cover a staged secret scan, projen drift, lint and typecheck per
|
|
81
|
+
* package, and a Conventional Commits check on the first commit of a branch.
|
|
82
|
+
* CI should set `LEFTHOOK=0`.
|
|
83
|
+
*/
|
|
84
|
+
export declare class GitHooks extends Component {
|
|
85
|
+
private readonly tsProject;
|
|
86
|
+
/** The generated `lefthook.yml`. */
|
|
87
|
+
readonly configFile: YamlFile;
|
|
88
|
+
/** The generated commit-msg check script. */
|
|
89
|
+
readonly commitMsgScript: TextFile;
|
|
90
|
+
/** The generated projen drift check script, if enabled. */
|
|
91
|
+
readonly projenDriftScript?: TextFile;
|
|
92
|
+
private readonly pkgs;
|
|
93
|
+
private readonly options;
|
|
94
|
+
constructor(tsProject: typescript.TypeScriptProject, options?: GitHooksOptions);
|
|
95
|
+
/** Add a package that runs its own lint and typecheck scripts. */
|
|
96
|
+
addPackage(pkg: GitHooksPackage): void;
|
|
97
|
+
preSynthesize(): void;
|
|
98
|
+
}
|