@xpertss/projen-types 0.0.3 → 0.0.4

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.
Files changed (37) hide show
  1. package/.jsii +113 -98
  2. package/API.md +100 -60
  3. package/README.md +56 -34
  4. package/lib/actions/action-build-workflow.js +1 -1
  5. package/lib/actions/action-dogfood-workflow.d.ts +5 -1
  6. package/lib/actions/action-dogfood-workflow.js +49 -19
  7. package/lib/actions/action-sonar-workflow.js +1 -1
  8. package/lib/actions/github-action-project.d.ts +12 -3
  9. package/lib/actions/github-action-project.js +10 -20
  10. package/lib/cdk/app-runtime-scaffold.js +1 -1
  11. package/lib/cdk/cdk-app-project.js +1 -1
  12. package/lib/cdk/cdk-infra-project.js +1 -1
  13. package/lib/cdk/cdk-typescript-base.js +38 -2
  14. package/lib/cdk/components/ecr-ecs-constructs.js +1 -1
  15. package/lib/cdk/components/edge-networking-constructs.js +1 -1
  16. package/lib/cdk/database-component.js +1 -1
  17. package/lib/cdk/options.d.ts +14 -2
  18. package/lib/cdk/options.js +1 -1
  19. package/lib/common/actions-allowlist-guard.js +1 -1
  20. package/lib/common/projen-drift-check-workflow.js +1 -1
  21. package/lib/common/projenrc-ts.d.ts +22 -0
  22. package/lib/common/projenrc-ts.js +43 -0
  23. package/lib/common/workflow-change-notice-workflow.js +1 -1
  24. package/lib/java/components/cdk-deploy-hook.d.ts +7 -0
  25. package/lib/java/components/cdk-deploy-hook.js +26 -5
  26. package/lib/java/components/code-index-workflow.js +1 -1
  27. package/lib/java/components/docker-publish.js +1 -1
  28. package/lib/java/components/flyway-migration.js +1 -1
  29. package/lib/java/components/github-packages-publish.js +1 -1
  30. package/lib/java/components/maven-central-publish.js +1 -1
  31. package/lib/java/java-app-project.js +1 -1
  32. package/lib/java/java-library-project.js +1 -1
  33. package/lib/java/java-maven-base.js +16 -5
  34. package/lib/java/java-service-project.js +6 -5
  35. package/lib/java/options.d.ts +27 -5
  36. package/lib/java/options.js +1 -1
  37. package/package.json +1 -1
package/API.md CHANGED
@@ -258,12 +258,16 @@ public readonly workflow: TaskWorkflow;
258
258
 
259
259
  Per AD-001's dogfood test: the composite action is run **against this repo**, end-to-end, via a local `uses: .` reference - no external harness. Builds `test-dogfood.yml` from an ordered `scenario` of invocation steps (see `ActionDogfoodStep`) followed by a shared cleanup step.
260
260
 
261
+ Omitting `options` generates the workflow with a single failing step (see
262
+ `UNCONFIGURED_STEPS`). A *partially* declared dogfood is still a synth
263
+ error: if you wrote a scenario by hand, you can write its cleanup too.
264
+
261
265
  #### Initializers <a name="Initializers" id="@xpertss/projen-types.ActionDogfoodWorkflow.Initializer"></a>
262
266
 
263
267
  ```typescript
264
268
  import { ActionDogfoodWorkflow } from '@xpertss/projen-types'
265
269
 
266
- new ActionDogfoodWorkflow(scope: GitHubProject, options: ActionDogfoodOptions)
270
+ new ActionDogfoodWorkflow(scope: GitHubProject, options?: ActionDogfoodOptions)
267
271
  ```
268
272
 
269
273
  | **Name** | **Type** | **Description** |
@@ -279,7 +283,7 @@ new ActionDogfoodWorkflow(scope: GitHubProject, options: ActionDogfoodOptions)
279
283
 
280
284
  ---
281
285
 
282
- ##### `options`<sup>Required</sup> <a name="options" id="@xpertss/projen-types.ActionDogfoodWorkflow.Initializer.parameter.options"></a>
286
+ ##### `options`<sup>Optional</sup> <a name="options" id="@xpertss/projen-types.ActionDogfoodWorkflow.Initializer.parameter.options"></a>
283
287
 
284
288
  - *Type:* <a href="#@xpertss/projen-types.ActionDogfoodOptions">ActionDogfoodOptions</a>
285
289
 
@@ -2664,6 +2668,13 @@ public readonly DEFAULT_TS_JEST_TRANFORM_PATTERN: string;
2664
2668
 
2665
2669
  Manual-dispatch workflow that invokes a downstream CDK deploy in a companion `CdkInfraProject`/`CdkAppProject` repo, using the same `ManualDeployWorkflow` contract those project types use for their own deploys - see the CDK spec's open question about sharing this contract.
2666
2670
 
2671
+ With no `targetRepo` the workflow is still generated, but every job's
2672
+ only step fails with instructions. Synthesizing is not the place to
2673
+ enforce this: it would make the project type unscaffoldable by
2674
+ `projen new` (which cannot supply the value), and it is a dispatch-only
2675
+ workflow - nobody hits the failure until they actually try to deploy,
2676
+ which is exactly when "this repo has no deploy target" needs saying.
2677
+
2667
2678
  #### Initializers <a name="Initializers" id="@xpertss/projen-types.CdkDeployHook.Initializer"></a>
2668
2679
 
2669
2680
  ```typescript
@@ -13099,9 +13110,9 @@ const cdkAppProjectOptions: CdkAppProjectOptions = { ... }
13099
13110
  | <code><a href="#@xpertss/projen-types.CdkAppProjectOptions.property.name">name</a></code> | <code>string</code> | *No description.* |
13100
13111
  | <code><a href="#@xpertss/projen-types.CdkAppProjectOptions.property.cdkVersion">cdkVersion</a></code> | <code>string</code> | *No description.* |
13101
13112
  | <code><a href="#@xpertss/projen-types.CdkAppProjectOptions.property.gheTokenSecret">gheTokenSecret</a></code> | <code>string</code> | *No description.* |
13102
- | <code><a href="#@xpertss/projen-types.CdkAppProjectOptions.property.environments">environments</a></code> | <code>string \| <a href="#@xpertss/projen-types.EnvironmentOptions">EnvironmentOptions</a>[]</code> | Deploy targets for the manual-dispatch deploy workflow, e.g. ["dev", "stage", "prod"]. |
13103
13113
  | <code><a href="#@xpertss/projen-types.CdkAppProjectOptions.property.ecrEcs">ecrEcs</a></code> | <code><a href="#@xpertss/projen-types.EcrEcsOptions">EcrEcsOptions</a></code> | *No description.* |
13104
13114
  | <code><a href="#@xpertss/projen-types.CdkAppProjectOptions.property.edgeResources">edgeResources</a></code> | <code>string[]</code> | *No description.* |
13115
+ | <code><a href="#@xpertss/projen-types.CdkAppProjectOptions.property.environments">environments</a></code> | <code>string \| <a href="#@xpertss/projen-types.EnvironmentOptions">EnvironmentOptions</a>[]</code> | Deploy targets for the manual-dispatch deploy workflow, e.g. ["dev", "stage", "prod"]. No `deploy` workflow is generated when this is empty or omitted. |
13105
13116
  | <code><a href="#@xpertss/projen-types.CdkAppProjectOptions.property.appEntryPoint">appEntryPoint</a></code> | <code>string</code> | *No description.* |
13106
13117
  | <code><a href="#@xpertss/projen-types.CdkAppProjectOptions.property.database">database</a></code> | <code><a href="#@xpertss/projen-types.DatabaseOptions">DatabaseOptions</a></code> | *No description.* |
13107
13118
 
@@ -13139,35 +13150,42 @@ public readonly gheTokenSecret: string;
13139
13150
 
13140
13151
  ---
13141
13152
 
13142
- ##### `environments`<sup>Required</sup> <a name="environments" id="@xpertss/projen-types.CdkAppProjectOptions.property.environments"></a>
13153
+ ##### `ecrEcs`<sup>Optional</sup> <a name="ecrEcs" id="@xpertss/projen-types.CdkAppProjectOptions.property.ecrEcs"></a>
13143
13154
 
13144
13155
  ```typescript
13145
- public readonly environments: (string | EnvironmentOptions)[];
13156
+ public readonly ecrEcs: EcrEcsOptions;
13146
13157
  ```
13147
13158
 
13148
- - *Type:* string | <a href="#@xpertss/projen-types.EnvironmentOptions">EnvironmentOptions</a>[]
13149
-
13150
- Deploy targets for the manual-dispatch deploy workflow, e.g. ["dev", "stage", "prod"].
13159
+ - *Type:* <a href="#@xpertss/projen-types.EcrEcsOptions">EcrEcsOptions</a>
13151
13160
 
13152
13161
  ---
13153
13162
 
13154
- ##### `ecrEcs`<sup>Optional</sup> <a name="ecrEcs" id="@xpertss/projen-types.CdkAppProjectOptions.property.ecrEcs"></a>
13163
+ ##### `edgeResources`<sup>Optional</sup> <a name="edgeResources" id="@xpertss/projen-types.CdkAppProjectOptions.property.edgeResources"></a>
13155
13164
 
13156
13165
  ```typescript
13157
- public readonly ecrEcs: EcrEcsOptions;
13166
+ public readonly edgeResources: string[];
13158
13167
  ```
13159
13168
 
13160
- - *Type:* <a href="#@xpertss/projen-types.EcrEcsOptions">EcrEcsOptions</a>
13169
+ - *Type:* string[]
13161
13170
 
13162
13171
  ---
13163
13172
 
13164
- ##### `edgeResources`<sup>Optional</sup> <a name="edgeResources" id="@xpertss/projen-types.CdkAppProjectOptions.property.edgeResources"></a>
13173
+ ##### `environments`<sup>Optional</sup> <a name="environments" id="@xpertss/projen-types.CdkAppProjectOptions.property.environments"></a>
13165
13174
 
13166
13175
  ```typescript
13167
- public readonly edgeResources: string[];
13176
+ public readonly environments: (string | EnvironmentOptions)[];
13168
13177
  ```
13169
13178
 
13170
- - *Type:* string[]
13179
+ - *Type:* string | <a href="#@xpertss/projen-types.EnvironmentOptions">EnvironmentOptions</a>[]
13180
+ - *Default:* no deploy workflow
13181
+
13182
+ Deploy targets for the manual-dispatch deploy workflow, e.g. ["dev", "stage", "prod"]. No `deploy` workflow is generated when this is empty or omitted.
13183
+
13184
+ Optional rather than required so that `projen new --from` can scaffold
13185
+ the repo: its union type (`string | EnvironmentOptions`) is not
13186
+ "JSON-like", so projen's CLI cannot render a value for it into the
13187
+ initial `.projenrc.ts` - and a *required* option it cannot render leaves
13188
+ behind a projenrc that does not type-check.
13171
13189
 
13172
13190
  ---
13173
13191
 
@@ -13206,22 +13224,10 @@ const cdkDeployHookOptions: CdkDeployHookOptions = { ... }
13206
13224
 
13207
13225
  | **Name** | **Type** | **Description** |
13208
13226
  | --- | --- | --- |
13209
- | <code><a href="#@xpertss/projen-types.CdkDeployHookOptions.property.enabled">enabled</a></code> | <code>boolean</code> | *No description.* |
13210
13227
  | <code><a href="#@xpertss/projen-types.CdkDeployHookOptions.property.targetRepo">targetRepo</a></code> | <code>string</code> | The companion CDK infra/app repo (owner/repo) that owns the actual infrastructure. |
13211
13228
 
13212
13229
  ---
13213
13230
 
13214
- ##### `enabled`<sup>Optional</sup> <a name="enabled" id="@xpertss/projen-types.CdkDeployHookOptions.property.enabled"></a>
13215
-
13216
- ```typescript
13217
- public readonly enabled: boolean;
13218
- ```
13219
-
13220
- - *Type:* boolean
13221
- - *Default:* true
13222
-
13223
- ---
13224
-
13225
13231
  ##### `targetRepo`<sup>Optional</sup> <a name="targetRepo" id="@xpertss/projen-types.CdkDeployHookOptions.property.targetRepo"></a>
13226
13232
 
13227
13233
  ```typescript
@@ -13229,6 +13235,7 @@ public readonly targetRepo: string;
13229
13235
  ```
13230
13236
 
13231
13237
  - *Type:* string
13238
+ - *Default:* the workflow is still generated, but its only step fails with instructions (see `CdkDeployHook`)
13232
13239
 
13233
13240
  The companion CDK infra/app repo (owner/repo) that owns the actual infrastructure.
13234
13241
 
@@ -13251,9 +13258,9 @@ const cdkInfraProjectOptions: CdkInfraProjectOptions = { ... }
13251
13258
  | <code><a href="#@xpertss/projen-types.CdkInfraProjectOptions.property.name">name</a></code> | <code>string</code> | *No description.* |
13252
13259
  | <code><a href="#@xpertss/projen-types.CdkInfraProjectOptions.property.cdkVersion">cdkVersion</a></code> | <code>string</code> | *No description.* |
13253
13260
  | <code><a href="#@xpertss/projen-types.CdkInfraProjectOptions.property.gheTokenSecret">gheTokenSecret</a></code> | <code>string</code> | *No description.* |
13254
- | <code><a href="#@xpertss/projen-types.CdkInfraProjectOptions.property.environments">environments</a></code> | <code>string \| <a href="#@xpertss/projen-types.EnvironmentOptions">EnvironmentOptions</a>[]</code> | Deploy targets for the manual-dispatch deploy workflow, e.g. ["dev", "stage", "prod"]. |
13255
13261
  | <code><a href="#@xpertss/projen-types.CdkInfraProjectOptions.property.ecrEcs">ecrEcs</a></code> | <code><a href="#@xpertss/projen-types.EcrEcsOptions">EcrEcsOptions</a></code> | *No description.* |
13256
13262
  | <code><a href="#@xpertss/projen-types.CdkInfraProjectOptions.property.edgeResources">edgeResources</a></code> | <code>string[]</code> | *No description.* |
13263
+ | <code><a href="#@xpertss/projen-types.CdkInfraProjectOptions.property.environments">environments</a></code> | <code>string \| <a href="#@xpertss/projen-types.EnvironmentOptions">EnvironmentOptions</a>[]</code> | Deploy targets for the manual-dispatch deploy workflow, e.g. ["dev", "stage", "prod"]. No `deploy` workflow is generated when this is empty or omitted. |
13257
13264
 
13258
13265
  ---
13259
13266
 
@@ -13289,35 +13296,42 @@ public readonly gheTokenSecret: string;
13289
13296
 
13290
13297
  ---
13291
13298
 
13292
- ##### `environments`<sup>Required</sup> <a name="environments" id="@xpertss/projen-types.CdkInfraProjectOptions.property.environments"></a>
13299
+ ##### `ecrEcs`<sup>Optional</sup> <a name="ecrEcs" id="@xpertss/projen-types.CdkInfraProjectOptions.property.ecrEcs"></a>
13293
13300
 
13294
13301
  ```typescript
13295
- public readonly environments: (string | EnvironmentOptions)[];
13302
+ public readonly ecrEcs: EcrEcsOptions;
13296
13303
  ```
13297
13304
 
13298
- - *Type:* string | <a href="#@xpertss/projen-types.EnvironmentOptions">EnvironmentOptions</a>[]
13299
-
13300
- Deploy targets for the manual-dispatch deploy workflow, e.g. ["dev", "stage", "prod"].
13305
+ - *Type:* <a href="#@xpertss/projen-types.EcrEcsOptions">EcrEcsOptions</a>
13301
13306
 
13302
13307
  ---
13303
13308
 
13304
- ##### `ecrEcs`<sup>Optional</sup> <a name="ecrEcs" id="@xpertss/projen-types.CdkInfraProjectOptions.property.ecrEcs"></a>
13309
+ ##### `edgeResources`<sup>Optional</sup> <a name="edgeResources" id="@xpertss/projen-types.CdkInfraProjectOptions.property.edgeResources"></a>
13305
13310
 
13306
13311
  ```typescript
13307
- public readonly ecrEcs: EcrEcsOptions;
13312
+ public readonly edgeResources: string[];
13308
13313
  ```
13309
13314
 
13310
- - *Type:* <a href="#@xpertss/projen-types.EcrEcsOptions">EcrEcsOptions</a>
13315
+ - *Type:* string[]
13311
13316
 
13312
13317
  ---
13313
13318
 
13314
- ##### `edgeResources`<sup>Optional</sup> <a name="edgeResources" id="@xpertss/projen-types.CdkInfraProjectOptions.property.edgeResources"></a>
13319
+ ##### `environments`<sup>Optional</sup> <a name="environments" id="@xpertss/projen-types.CdkInfraProjectOptions.property.environments"></a>
13315
13320
 
13316
13321
  ```typescript
13317
- public readonly edgeResources: string[];
13322
+ public readonly environments: (string | EnvironmentOptions)[];
13318
13323
  ```
13319
13324
 
13320
- - *Type:* string[]
13325
+ - *Type:* string | <a href="#@xpertss/projen-types.EnvironmentOptions">EnvironmentOptions</a>[]
13326
+ - *Default:* no deploy workflow
13327
+
13328
+ Deploy targets for the manual-dispatch deploy workflow, e.g. ["dev", "stage", "prod"]. No `deploy` workflow is generated when this is empty or omitted.
13329
+
13330
+ Optional rather than required so that `projen new --from` can scaffold
13331
+ the repo: its union type (`string | EnvironmentOptions`) is not
13332
+ "JSON-like", so projen's CLI cannot render a value for it into the
13333
+ initial `.projenrc.ts` - and a *required* option it cannot render leaves
13334
+ behind a projenrc that does not type-check.
13321
13335
 
13322
13336
  ---
13323
13337
 
@@ -13751,9 +13765,9 @@ const gitHubActionProjectOptions: GitHubActionProjectOptions = { ... }
13751
13765
  | <code><a href="#@xpertss/projen-types.GitHubActionProjectOptions.property.stale">stale</a></code> | <code>boolean</code> | Auto-close of stale issues and pull request. |
13752
13766
  | <code><a href="#@xpertss/projen-types.GitHubActionProjectOptions.property.staleOptions">staleOptions</a></code> | <code>projen.github.StaleOptions</code> | Auto-close stale issues and pull requests. |
13753
13767
  | <code><a href="#@xpertss/projen-types.GitHubActionProjectOptions.property.vscode">vscode</a></code> | <code>boolean</code> | Enable VSCode integration. |
13754
- | <code><a href="#@xpertss/projen-types.GitHubActionProjectOptions.property.dogfood">dogfood</a></code> | <code><a href="#@xpertss/projen-types.ActionDogfoodOptions">ActionDogfoodOptions</a></code> | The dogfood scenario (AD-001). |
13755
13768
  | <code><a href="#@xpertss/projen-types.GitHubActionProjectOptions.property.sonarHostUrl">sonarHostUrl</a></code> | <code>string</code> | URL of the org's self-hosted SonarQube instance. |
13756
13769
  | <code><a href="#@xpertss/projen-types.GitHubActionProjectOptions.property.description">description</a></code> | <code>string</code> | One-line description of the action. |
13770
+ | <code><a href="#@xpertss/projen-types.GitHubActionProjectOptions.property.dogfood">dogfood</a></code> | <code><a href="#@xpertss/projen-types.ActionDogfoodOptions">ActionDogfoodOptions</a></code> | The dogfood scenario (AD-001). |
13757
13771
  | <code><a href="#@xpertss/projen-types.GitHubActionProjectOptions.property.gheTokenSecret">gheTokenSecret</a></code> | <code>string</code> | Name of the GitHub Actions secret holding the PAT used for projen-automation PR comments (F003/F009) and, when the action has a `token` input, the dogfood's invocation of it. |
13758
13772
  | <code><a href="#@xpertss/projen-types.GitHubActionProjectOptions.property.license">license</a></code> | <code>string</code> | SPDX identifier for the generated `LICENSE`. |
13759
13773
  | <code><a href="#@xpertss/projen-types.GitHubActionProjectOptions.property.sonarPullRequestGate">sonarPullRequestGate</a></code> | <code>boolean</code> | Whether `sonar.yml` also runs on `pull_request` as a pass/fail gate. |
@@ -14129,23 +14143,6 @@ Enabled by default for root projects. Disabled for non-root projects.
14129
14143
 
14130
14144
  ---
14131
14145
 
14132
- ##### `dogfood`<sup>Required</sup> <a name="dogfood" id="@xpertss/projen-types.GitHubActionProjectOptions.property.dogfood"></a>
14133
-
14134
- ```typescript
14135
- public readonly dogfood: ActionDogfoodOptions;
14136
- ```
14137
-
14138
- - *Type:* <a href="#@xpertss/projen-types.ActionDogfoodOptions">ActionDogfoodOptions</a>
14139
-
14140
- The dogfood scenario (AD-001).
14141
-
14142
- What fixture state, what to assert, and
14143
- how to clean up are specified by the action's own F### spec - the
14144
- highest-risk behavior of that action. Required: a default no-op
14145
- dogfood would silently hollow out a load-bearing AD-001 workflow.
14146
-
14147
- ---
14148
-
14149
14146
  ##### `sonarHostUrl`<sup>Required</sup> <a name="sonarHostUrl" id="@xpertss/projen-types.GitHubActionProjectOptions.property.sonarHostUrl"></a>
14150
14147
 
14151
14148
  ```typescript
@@ -14177,6 +14174,30 @@ template and recorded in the private `package.json`.
14177
14174
 
14178
14175
  ---
14179
14176
 
14177
+ ##### `dogfood`<sup>Optional</sup> <a name="dogfood" id="@xpertss/projen-types.GitHubActionProjectOptions.property.dogfood"></a>
14178
+
14179
+ ```typescript
14180
+ public readonly dogfood: ActionDogfoodOptions;
14181
+ ```
14182
+
14183
+ - *Type:* <a href="#@xpertss/projen-types.ActionDogfoodOptions">ActionDogfoodOptions</a>
14184
+ - *Default:* `test-dogfood.yml` runs one failing step that tells you to declare a scenario
14185
+
14186
+ The dogfood scenario (AD-001).
14187
+
14188
+ What fixture state, what to assert, and
14189
+ how to clean up are specified by the action's own F### spec - the
14190
+ highest-risk behavior of that action.
14191
+
14192
+ Its type is a struct, which projen's CLI cannot render into a projenrc,
14193
+ so it can only be written by hand - it is therefore optional, because a
14194
+ *required* option `projen new` cannot supply would make this project
14195
+ type impossible to scaffold. AD-001's "never a silent no-op dogfood"
14196
+ rule is enforced instead by the workflow it generates in that case: a
14197
+ single step that fails on every PR until a scenario is declared.
14198
+
14199
+ ---
14200
+
14180
14201
  ##### `gheTokenSecret`<sup>Optional</sup> <a name="gheTokenSecret" id="@xpertss/projen-types.GitHubActionProjectOptions.property.gheTokenSecret"></a>
14181
14202
 
14182
14203
  ```typescript
@@ -14580,7 +14601,8 @@ const javaServiceProjectOptions: JavaServiceProjectOptions = { ... }
14580
14601
  | <code><a href="#@xpertss/projen-types.JavaServiceProjectOptions.property.gheTokenSecret">gheTokenSecret</a></code> | <code>string</code> | *No description.* |
14581
14602
  | <code><a href="#@xpertss/projen-types.JavaServiceProjectOptions.property.sonarProjectKey">sonarProjectKey</a></code> | <code>string</code> | SonarQube project key. |
14582
14603
  | <code><a href="#@xpertss/projen-types.JavaServiceProjectOptions.property.version">version</a></code> | <code>string</code> | *No description.* |
14583
- | <code><a href="#@xpertss/projen-types.JavaServiceProjectOptions.property.cdkDeployHook">cdkDeployHook</a></code> | <code><a href="#@xpertss/projen-types.CdkDeployHookOptions">CdkDeployHookOptions</a></code> | *No description.* |
14604
+ | <code><a href="#@xpertss/projen-types.JavaServiceProjectOptions.property.cdkDeployHook">cdkDeployHook</a></code> | <code>boolean</code> | Whether to generate the `deploy-cdk` workflow at all. |
14605
+ | <code><a href="#@xpertss/projen-types.JavaServiceProjectOptions.property.cdkDeployTargetRepo">cdkDeployTargetRepo</a></code> | <code>string</code> | The companion CDK infra/app repo (`owner/repo`) whose `deploy.yml` the `deploy-cdk` workflow dispatches. |
14584
14606
  | <code><a href="#@xpertss/projen-types.JavaServiceProjectOptions.property.dockerRegistry">dockerRegistry</a></code> | <code>string</code> | *No description.* |
14585
14607
  | <code><a href="#@xpertss/projen-types.JavaServiceProjectOptions.property.environments">environments</a></code> | <code>string \| <a href="#@xpertss/projen-types.EnvironmentOptions">EnvironmentOptions</a>[]</code> | Deploy targets to offer on the `CdkDeployHook`'s manual-dispatch workflow, when the hook is enabled. |
14586
14608
  | <code><a href="#@xpertss/projen-types.JavaServiceProjectOptions.property.useFlyway">useFlyway</a></code> | <code>boolean</code> | *No description.* |
@@ -14656,11 +14678,29 @@ public readonly version: string;
14656
14678
  ##### `cdkDeployHook`<sup>Optional</sup> <a name="cdkDeployHook" id="@xpertss/projen-types.JavaServiceProjectOptions.property.cdkDeployHook"></a>
14657
14679
 
14658
14680
  ```typescript
14659
- public readonly cdkDeployHook: CdkDeployHookOptions;
14681
+ public readonly cdkDeployHook: boolean;
14660
14682
  ```
14661
14683
 
14662
- - *Type:* <a href="#@xpertss/projen-types.CdkDeployHookOptions">CdkDeployHookOptions</a>
14663
- - *Default:* { enabled: true }
14684
+ - *Type:* boolean
14685
+ - *Default:* true
14686
+
14687
+ Whether to generate the `deploy-cdk` workflow at all.
14688
+
14689
+ ---
14690
+
14691
+ ##### `cdkDeployTargetRepo`<sup>Optional</sup> <a name="cdkDeployTargetRepo" id="@xpertss/projen-types.JavaServiceProjectOptions.property.cdkDeployTargetRepo"></a>
14692
+
14693
+ ```typescript
14694
+ public readonly cdkDeployTargetRepo: string;
14695
+ ```
14696
+
14697
+ - *Type:* string
14698
+ - *Default:* `deploy-cdk.yml` is generated with a single failing step that tells you to set this
14699
+
14700
+ The companion CDK infra/app repo (`owner/repo`) whose `deploy.yml` the `deploy-cdk` workflow dispatches.
14701
+
14702
+ A plain string rather than a nested struct so that
14703
+ `projen new --from
14664
14704
 
14665
14705
  ---
14666
14706
 
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Projen project types for CDK/TypeScript and Java/Maven projects.
4
4
 
5
- Instead of hand-maintaining `pom.xml`, `cdk.json`, and GitHub workflows, you declare a project type in a plain-JavaScript `.projenrc.js` file and let [projen](https://github.com/projen/projen) generate (and keep up to date) the whole scaffold: build files, source skeletons, CI workflows, and deploy pipelines.
5
+ Instead of hand-maintaining `pom.xml`, `cdk.json`, and GitHub workflows, you declare a project type in a `.projenrc.ts` file and let [projen](https://github.com/projen/projen) generate (and keep up to date) the whole scaffold: build files, source skeletons, CI workflows, and deploy pipelines.
6
6
 
7
7
  ## Project types at a glance
8
8
 
@@ -19,27 +19,45 @@ Two foundation classes are also exported for advanced use: `CdkTypescriptProject
19
19
 
20
20
  All project types:
21
21
 
22
- - run a **drift check** in PR builds - a job that re-runs projen and fails if generated files were hand-edited. Edit `.projenrc.js`, then run `npx projen`; never edit generated files directly.
22
+ - run a **drift check** in PR builds - a job that re-runs projen and fails if generated files were hand-edited. Edit `.projenrc.ts`, then run `npx projen`; never edit generated files directly.
23
23
  - use the GitHub secret `PROJEN_GITHUB_TOKEN` (a fine-grained PAT) for projen's automation. Override with `gheTokenSecret`.
24
24
  - make all publishing/deploying **manual** (workflow_dispatch) rather than on every merge.
25
25
 
26
26
  ## Getting started
27
27
 
28
- Create a new git repository and install the dependencies:
28
+ Scaffold the repo with projen's own bootstrap, pointed at this package:
29
29
 
30
30
  ```bash
31
31
  mkdir my-project && cd my-project
32
32
  git init
33
- npm install -D projen constructs @xpertss/projen-types
33
+ npx projen new --from @xpertss/projen-types cdk_infra --name my-project
34
34
  ```
35
35
 
36
- Write a `.projenrc.js` (see examples below), then bootstrap the project by running it directly - `npx projen` alone can't do this on a brand-new repo, since it only re-runs a `default` task that doesn't exist yet:
36
+ That writes a starter `.projenrc.ts`, synthesizes the whole scaffold and
37
+ installs dependencies. The type names `projen new` accepts are `cdk_infra`,
38
+ `cdk_app`, `java_library`, `java_service`, `java_app` and
39
+ `git_hub_action`; pass a bogus one to have it list them. Required options
40
+ become flags: `--name` for every type, plus `--group-id`/`--artifact-id`
41
+ (Java) and `--sonar-host-url` (`git_hub_action`). Any other plainly-typed
42
+ option can be passed the same way - `--cdk-deploy-target-repo owner/repo`,
43
+ `--docker-registry ghcr.io`, `--no-use-flyway`, and so on.
44
+
45
+ Commit the result. From then on, every change to the scaffold goes through
46
+ `.projenrc.ts` followed by `npx projen`:
37
47
 
38
48
  ```bash
39
- node .projenrc.js
49
+ npx projen
40
50
  ```
41
51
 
42
- Commit the result. From then on, every change to the scaffold goes through `.projenrc.js` followed by plain `npx projen`.
52
+ Every type scaffolds from that one command; no option is *required* that
53
+ `projen new` cannot pass. The structured options - `environments` and
54
+ `GitHubActionProject`'s `dogfood` - are ones projen's CLI cannot render
55
+ into a projenrc, so they are added afterwards by editing `.projenrc.ts` and
56
+ re-running `npx projen`. Leaving `environments` out simply generates no
57
+ deploy workflow; leaving `dogfood` out (or a service's
58
+ `cdkDeployTargetRepo`) still generates the workflow, with one step that
59
+ fails and tells you what to add - a gate this package considers load-bearing
60
+ is allowed to be missing loudly, never silently.
43
61
 
44
62
  The `name` option must match the `name` field in the project's `package.json` (for the CDK types) or the project name used by projen's `java.JavaProject` (for the Java types).
45
63
 
@@ -49,9 +67,9 @@ The `name` option must match the `name` field in the project's `package.json` (f
49
67
 
50
68
  Pure infrastructure stacks with optional ECR/ECS and edge-networking constructs.
51
69
 
52
- ```javascript
53
- // .projenrc.js
54
- const { CdkInfraProject } = require('@xpertss/projen-types');
70
+ ```typescript
71
+ // .projenrc.ts
72
+ import { CdkInfraProject } from '@xpertss/projen-types';
55
73
 
56
74
  const project = new CdkInfraProject({
57
75
  name: 'media-edge-infra',
@@ -80,9 +98,9 @@ You get:
80
98
 
81
99
  `CdkInfraProject` plus application source, a database construct, and an app-level build workflow.
82
100
 
83
- ```javascript
84
- // .projenrc.js
85
- const { CdkAppProject } = require('@xpertss/projen-types');
101
+ ```typescript
102
+ // .projenrc.ts
103
+ import { CdkAppProject } from '@xpertss/projen-types';
86
104
 
87
105
  const project = new CdkAppProject({
88
106
  name: 'video-api',
@@ -106,9 +124,9 @@ Everything from `CdkInfraProject`, plus:
106
124
 
107
125
  A reusable Java library published to Maven Central.
108
126
 
109
- ```javascript
110
- // .projenrc.js
111
- const { JavaLibraryProject } = require('@xpertss/projen-types');
127
+ ```typescript
128
+ // .projenrc.ts
129
+ import { JavaLibraryProject } from '@xpertss/projen-types';
112
130
 
113
131
  const project = new JavaLibraryProject({
114
132
  name: 'common-utils',
@@ -134,16 +152,16 @@ You get:
134
152
 
135
153
  A Spring Boot service that publishes a Docker image and can trigger deploys in a companion CDK repo.
136
154
 
137
- ```javascript
138
- // .projenrc.js
139
- const { JavaServiceProject } = require('@xpertss/projen-types');
155
+ ```typescript
156
+ // .projenrc.ts
157
+ import { JavaServiceProject } from '@xpertss/projen-types';
140
158
 
141
159
  const project = new JavaServiceProject({
142
160
  name: 'stream-processor',
143
161
  groupId: 'org.xpertss',
144
162
  artifactId: 'stream-processor',
145
163
  dockerRegistry: 'docker.io/xpertss',
146
- cdkDeployHook: { targetRepo: 'xpertss/stream-infra' },
164
+ cdkDeployTargetRepo: 'xpertss/stream-infra',
147
165
  environments: ['dev', { name: 'prod', requiresApproval: true }],
148
166
  });
149
167
 
@@ -155,15 +173,15 @@ You get (everything from `JavaMavenProject` - `pom.xml`, `build` + drift check,
155
173
  - `spring-boot-starter-web` added to the pom.
156
174
  - `.github/workflows/publish-docker.yml` - manual dispatch: `mvn -B package && docker build -t <registry>/<name>:<sha>`, logged in with the `DOCKER_USERNAME` / `DOCKER_PASSWORD` secrets. `dockerRegistry` defaults to `docker.io`.
157
175
  - Flyway wiring when `useFlyway` (default `true`): `flyway-maven-plugin` ^10 + `flyway-core` ^10 in the pom, and `src/main/resources/db/migration/V1__init.sql`.
158
- - `.github/workflows/deploy-cdk.yml` (the `CdkDeployHook`, enabled by default) - manual dispatch with an environment selector; each job sends a `workflow_dispatch` to `deploy.yml` in the companion `targetRepo` (a `CdkInfraProject`/`CdkAppProject` repo). `targetRepo` is required when the hook is enabled; disable it with `cdkDeployHook: { enabled: false }`. `environments` defaults to `['prod']`.
176
+ - `.github/workflows/deploy-cdk.yml` (the `CdkDeployHook`, generated by default) - manual dispatch with an environment selector; each job sends a `workflow_dispatch` to `deploy.yml` in the companion `cdkDeployTargetRepo` (a `CdkInfraProject`/`CdkAppProject` repo). With no `cdkDeployTargetRepo` set, the workflow is still generated but each job's only step fails with instructions - it is dispatch-only, so that lands on whoever tries to deploy rather than on every PR. Turn the workflow off entirely with `cdkDeployHook: false`. `environments` defaults to `['prod']`.
159
177
 
160
178
  ### JavaAppProject
161
179
 
162
180
  A GUI/TUI/CLI Java application published to GitHub Packages only - no Maven Central, no Docker, no CDK deploy hook.
163
181
 
164
- ```javascript
165
- // .projenrc.js
166
- const { JavaAppProject } = require('@xpertss/projen-types');
182
+ ```typescript
183
+ // .projenrc.ts
184
+ import { JavaAppProject } from '@xpertss/projen-types';
167
185
 
168
186
  const project = new JavaAppProject({
169
187
  name: 'studio-cli',
@@ -181,9 +199,9 @@ You get everything from `JavaMavenProject`, plus `.github/workflows/publish-ghpa
181
199
 
182
200
  A reusable GitHub Action or Workflow. This example scaffolds an action that stages a folder and, only if it changed, commits and pushes it.
183
201
 
184
- ```javascript
185
- // .projenrc.js
186
- const { GitHubActionProject } = require('@xpertss/projen-types');
202
+ ```typescript
203
+ // .projenrc.ts
204
+ import { GitHubActionProject } from '@xpertss/projen-types';
187
205
 
188
206
  const project = new GitHubActionProject({
189
207
  name: 'auto-commit',
@@ -235,13 +253,13 @@ You get:
235
253
 
236
254
  - `action.yml` and `auto-commit.sh` are hand-written - this type only lints their content via `build.yml`'s shellcheck/yamllint/actionlint checks.
237
255
  - `.github/workflows/build.yml` - lint gate: `apt`-installed shellcheck/yamllint plus a pinned, SHA-256-verified `actionlint` release binary. Gates `main` alongside `sonar.yml`.
238
- - `.github/workflows/test-dogfood.yml` - runs the `dogfood.scenario` steps above against this repo's own `action.yml` (via `uses: .`), then the shared `cleanup`, on `workflow_dispatch`, every `pull_request`, and nightly.
256
+ - `.github/workflows/test-dogfood.yml` - runs the `dogfood.scenario` steps above against this repo's own `action.yml` (via `uses: .`), then the shared `cleanup`, on `workflow_dispatch`, every `pull_request`, and nightly. Omit `dogfood` and the workflow still exists, with one step that fails on every PR until you declare a scenario - AD-001 allows a dogfood to be missing loudly, never silently. A *partial* `dogfood` (a scenario with no cleanup) is a synth error.
239
257
  - `.github/workflows/sonar.yml` - self-hosted SonarQube via the Scanner CLI, scanning `action.yml`/`.github/workflows/**`/`**/*.sh` explicitly.
240
258
  - `.github/workflows/release.yml` - `feat:`/`fix:` commits on `main` bump the version, tag `vX.Y.Z`, and create a GitHub Release.
241
259
  - `.github/workflows/projen-drift-check.yml`, `workflow-change-notice.yml`, `actions-allowlist-guard.yml` - drift detection, a change notice, and an action allow-list guard, always included.
242
260
  - `package.json` (**private**, version source only), `.yamllint`, `LICENSE` (MIT by default), and a `README.md` template - all regenerated by `npx projen`.
243
261
 
244
- Needs the same two secrets as everything else in this package: `PROJEN_GITHUB_TOKEN` (used for automated PR comments) and `SONAR_TOKEN` (the Sonar scan). Onboard a brand-new action repo following [Getting started](#getting-started), write the `.projenrc.js` above, then hand-write `action.yml`/`auto-commit.sh`/`test/fixtures/`.
262
+ Needs the same two secrets as everything else in this package: `PROJEN_GITHUB_TOKEN` (used for automated PR comments) and `SONAR_TOKEN` (the Sonar scan). Onboard a brand-new action repo following [Getting started](#getting-started), write the `.projenrc.ts` above, then hand-write `action.yml`/`auto-commit.sh`/`test/fixtures/`.
245
263
 
246
264
  ## Common options
247
265
 
@@ -253,7 +271,7 @@ CDK project types (`CdkInfraProjectOptions` / `CdkAppProjectOptions`):
253
271
  | `cdkVersion` | `2.189.1` | AWS CDK version |
254
272
  | `gheTokenSecret` | `PROJEN_GITHUB_TOKEN` | GitHub secret holding projen's PAT |
255
273
  | `slackWebhookSecret` | - | GitHub secret with a Slack webhook URL for deploy notifications |
256
- | `environments` | - (required) | Deploy targets for the `deploy` workflow; strings or `EnvironmentOptions` |
274
+ | `environments` | - (no `deploy` workflow) | Deploy targets for the `deploy` workflow; strings or `EnvironmentOptions` |
257
275
  | `ecrEcs` | - | `EcrEcsOptions` - `enabled`, `externalImageSource` (default `true`) |
258
276
  | `edgeResources` | - | Subset of `cloudfront`, `route53`, `apigateway`, `cognito`, `sqs` |
259
277
  | `database` | - (app only) | `DatabaseOptions` - `engine` (`postgres`/`mysql`/`dynamodb`, default `postgres`), `migrationTool` |
@@ -269,6 +287,10 @@ Java project types (`JavaLibraryProjectOptions` / `JavaServiceProjectOptions` /
269
287
  | `version` | `0.1.0` | Maven version |
270
288
  | `sonarProjectKey` | - | SonarQube project key; the sonar step is skipped when unset |
271
289
  | `gheTokenSecret` | `PROJEN_GITHUB_TOKEN` | GitHub secret holding projen's PAT |
290
+ | `cdkDeployTargetRepo` | - (service only; `deploy-cdk.yml` fails until set) | Companion CDK repo (`owner/repo`) whose `deploy.yml` the deploy hook dispatches |
291
+ | `cdkDeployHook` | `true` (service only) | Whether to generate `deploy-cdk.yml` at all |
292
+ | `dockerRegistry` | `docker.io` (service only) | Registry the Docker image is pushed to |
293
+ | `useFlyway` | `true` (service only) | Flyway plugin/dependency + `V1__init.sql` |
272
294
 
273
295
  `EnvironmentOptions` for deploy targets:
274
296
 
@@ -292,7 +314,7 @@ Plain strings (`'dev'`) are shorthand for `{ name: 'dev' }`.
292
314
  | `sonarHostUrl` | - (required) | URL of your self-hosted SonarQube instance; must be reachable from github.com-hosted runners |
293
315
  | `sonarTokenSecret` | `SONAR_TOKEN` | GitHub secret holding the Sonar token |
294
316
  | `sonarPullRequestGate` | `true` | Whether `sonar.yml` also runs on `pull_request` as a pass/fail gate |
295
- | `dogfood` | - (required) | `ActionDogfoodOptions` - the scenario that exercises the action end-to-end via `uses: .` |
317
+ | `dogfood` | - (a `test-dogfood.yml` that fails until you declare one) | `ActionDogfoodOptions` - the scenario that exercises the action end-to-end via `uses: .` |
296
318
  | `license` | `MIT` | SPDX identifier for the generated `LICENSE` |
297
319
  | `gheTokenSecret` | `PROJEN_GITHUB_TOKEN` | GitHub secret holding projen's PAT |
298
320
 
@@ -347,9 +369,9 @@ The project types are composed from smaller components you can also attach to yo
347
369
 
348
370
  Example - adding a Docker publish to a plain projen `JavaProject`:
349
371
 
350
- ```javascript
351
- const { java } = require('projen');
352
- const { DockerPublish } = require('@xpertss/projen-types');
372
+ ```typescript
373
+ import { java } from 'projen';
374
+ import { DockerPublish } from '@xpertss/projen-types';
353
375
 
354
376
  const project = new java.JavaProject({
355
377
  name: 'my-service',
@@ -19,7 +19,7 @@ const ACTIONLINT_SHA256 = '8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc
19
19
  * the release build job, so the lint commands exist in exactly one place.
20
20
  */
21
21
  class ActionBuildWorkflow extends projen_1.Component {
22
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@xpertss/projen-types.ActionBuildWorkflow", version: "0.0.3" };
22
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@xpertss/projen-types.ActionBuildWorkflow", version: "0.0.4" };
23
23
  task;
24
24
  workflow;
25
25
  constructor(scope) {
@@ -40,8 +40,12 @@ export interface ActionDogfoodOptions {
40
40
  * repo**, end-to-end, via a local `uses: .` reference - no external harness.
41
41
  * Builds `test-dogfood.yml` from an ordered `scenario` of invocation steps
42
42
  * (see `ActionDogfoodStep`) followed by a shared cleanup step.
43
+ *
44
+ * Omitting `options` generates the workflow with a single failing step (see
45
+ * `UNCONFIGURED_STEPS`). A *partially* declared dogfood is still a synth
46
+ * error: if you wrote a scenario by hand, you can write its cleanup too.
43
47
  */
44
48
  export declare class ActionDogfoodWorkflow extends Component {
45
49
  readonly workflow: github.GithubWorkflow;
46
- constructor(scope: github.GitHubProject, options: ActionDogfoodOptions);
50
+ constructor(scope: github.GitHubProject, options?: ActionDogfoodOptions);
47
51
  }