@codedrifters/configulator 0.0.423 → 0.0.424

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/lib/index.mjs CHANGED
@@ -37596,6 +37596,7 @@ var CdkCli = class _CdkCli extends Component11 {
37596
37596
  this.diffDefaults = options.diffDefaults ?? {};
37597
37597
  this.bootstrapDefaults = options.bootstrapDefaults ?? {};
37598
37598
  this.accountOverrides = options.accountOverrides ?? {};
37599
+ this.cliVersion = options.cliVersion ?? project.cdkDeps.cdkCliVersion;
37599
37600
  }
37600
37601
  /**
37601
37602
  * Resolve the `cdk deploy` options to use against a given target.
@@ -41930,6 +41931,22 @@ import { Component as Component22 } from "projen";
41930
41931
  import { BuildWorkflow } from "projen/lib/build";
41931
41932
  import { GitHub as GitHub5, WorkflowSteps as WorkflowSteps2 } from "projen/lib/github";
41932
41933
  import { JobPermission as JobPermission5 } from "projen/lib/github/workflows-model";
41934
+
41935
+ // src/workflows/home-repository.ts
41936
+ var HOME_REPOSITORY_PATTERN = /^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/;
41937
+ var renderHomeRepositoryCondition = (homeRepository, componentName) => {
41938
+ if (homeRepository === void 0) {
41939
+ return void 0;
41940
+ }
41941
+ if (!HOME_REPOSITORY_PATTERN.test(homeRepository)) {
41942
+ throw new Error(
41943
+ `${componentName} requires \`homeRepository\` to be an \`owner/repo\` slug, got "${homeRepository}"`
41944
+ );
41945
+ }
41946
+ return `github.repository == '${homeRepository}'`;
41947
+ };
41948
+
41949
+ // src/workflows/aws-deploy-workflow.ts
41933
41950
  var PROD_DEPLOY_NAME = "prod-deploy";
41934
41951
  var DIFF_OUTPUT_FILE = "cdk-diff.txt";
41935
41952
  var DIFF_SUMMARY_BYTE_LIMIT = 9e5;
@@ -42056,17 +42073,18 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
42056
42073
  awsDeploymentConfig
42057
42074
  } = target;
42058
42075
  const { roleArn, stackPattern } = ciDeploymentConfig ?? {};
42059
- const { rootCdkOut } = awsDeploymentConfig;
42076
+ const { rootCdkOut, cdkCli } = awsDeploymentConfig;
42060
42077
  const deployJobName = this.buildJobName(target);
42061
42078
  return [
42062
42079
  ...this.setupPnpm(),
42063
42080
  ...this.setupNode(),
42064
42081
  /**
42065
- * Install CDK
42082
+ * Install CDK, pinned to the same version that synthesized the cloud
42083
+ * assembly being deployed. See {@link CdkCli.cliVersion}.
42066
42084
  */
42067
42085
  {
42068
42086
  name: "Install CDK",
42069
- run: "pnpm add aws-cdk"
42087
+ run: `pnpm add "aws-cdk@${cdkCli.cliVersion}"`
42070
42088
  },
42071
42089
  /**
42072
42090
  * Configure AWS creds.
@@ -42086,8 +42104,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
42086
42104
  */
42087
42105
  {
42088
42106
  name: `Deploy ${awsStageType}/${deploymentTargetRole}/${account}/${region}`,
42089
- run: `pnpm dlx aws-cdk ${renderCdkDeploy({
42090
- ...awsDeploymentConfig.cdkCli.deployOptionsFor(target),
42107
+ run: `pnpm dlx "aws-cdk@${cdkCli.cliVersion}" ${renderCdkDeploy({
42108
+ ...cdkCli.deployOptionsFor(target),
42091
42109
  app: rootCdkOut,
42092
42110
  stackPatterns: stackPattern ? [stackPattern] : void 0
42093
42111
  })} --outputs-file cdk-outputs.json`
@@ -42139,8 +42157,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
42139
42157
  * Steps for a target's optional `cdk diff` job.
42140
42158
  *
42141
42159
  * Mirrors {@link deploySteps}' toolchain and credential setup — same pnpm /
42142
- * Node setup, same floating `aws-cdk` install, same OIDC role — so both jobs
42143
- * move together when the CLI version is pinned.
42160
+ * Node setup, same version-pinned `aws-cdk` install, same OIDC role — so a
42161
+ * diff is computed by the same CLI that will run the deploy.
42144
42162
  *
42145
42163
  * The `cdk diff` flags come from the {@link CdkCli} precedence chain via
42146
42164
  * `diffOptionsFor(target)`, so `method`, `securityOnly`, `fail`, and the rest
@@ -42160,7 +42178,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
42160
42178
  awsDeploymentConfig
42161
42179
  } = target;
42162
42180
  const { roleArn, stackPattern } = ciDeploymentConfig ?? {};
42163
- const { rootCdkOut } = awsDeploymentConfig;
42181
+ const { rootCdkOut, cdkCli } = awsDeploymentConfig;
42164
42182
  const label = `${awsStageType}/${deploymentTargetRole}/${account}/${region}`;
42165
42183
  const artifactName = this.buildDiffArtifactName(target);
42166
42184
  const capturedFileGuard = `always() && hashFiles('${DIFF_OUTPUT_FILE}') != ''`;
@@ -42169,11 +42187,12 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
42169
42187
  ...this.setupPnpm(),
42170
42188
  ...this.setupNode(),
42171
42189
  /**
42172
- * Install CDK
42190
+ * Install CDK, pinned to the same version that synthesized the cloud
42191
+ * assembly being diffed. See {@link CdkCli.cliVersion}.
42173
42192
  */
42174
42193
  {
42175
42194
  name: "Install CDK",
42176
- run: "pnpm add aws-cdk"
42195
+ run: `pnpm add "aws-cdk@${cdkCli.cliVersion}"`
42177
42196
  },
42178
42197
  /**
42179
42198
  * Configure AWS creds.
@@ -42197,8 +42216,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
42197
42216
  shell: "bash",
42198
42217
  run: [
42199
42218
  "set -o pipefail",
42200
- `pnpm dlx aws-cdk ${renderCdkDiff({
42201
- ...awsDeploymentConfig.cdkCli.diffOptionsFor(target),
42219
+ `pnpm dlx "aws-cdk@${cdkCli.cliVersion}" ${renderCdkDiff({
42220
+ ...cdkCli.diffOptionsFor(target),
42202
42221
  app: rootCdkOut,
42203
42222
  ci: true,
42204
42223
  noColor: true,
@@ -42280,6 +42299,11 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
42280
42299
  artifact: options.diff?.artifact ?? true,
42281
42300
  summary: options.diff?.summary ?? true
42282
42301
  };
42302
+ this.homeRepository = options.homeRepository;
42303
+ const homeRepositoryCondition = renderHomeRepositoryCondition(
42304
+ this.homeRepository,
42305
+ "AwsDeployWorkflow"
42306
+ );
42283
42307
  if (options.buildWorkflow && options.buildWorkflowOptions) {
42284
42308
  throw new Error(
42285
42309
  "Cannot provide both buildWorkflow and buildWorkflowOptions"
@@ -42357,10 +42381,11 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
42357
42381
  const branchFilterCondition = this.buildBranchFilterCondition(
42358
42382
  target.branches
42359
42383
  );
42360
- const jobCondition = branchFilterCondition ? "${{ " + [
42384
+ const jobCondition = "${{ " + [
42361
42385
  "!needs.build.outputs.self_mutation_happened",
42362
- `(${branchFilterCondition})`
42363
- ].join(" && ") + " }}" : "${{ !needs.build.outputs.self_mutation_happened }}";
42386
+ ...homeRepositoryCondition ? [homeRepositoryCondition] : [],
42387
+ ...branchFilterCondition ? [`(${branchFilterCondition})`] : []
42388
+ ].join(" && ") + " }}";
42364
42389
  this.buildWorkflow.addPostBuildJob(deployJobName, {
42365
42390
  name: `Deploy ${this.project.name} ${target.awsStageType}/${target.deploymentTargetRole}/${target.account}/${target.region}`,
42366
42391
  needs: [
@@ -42455,7 +42480,8 @@ var AwsTeardownWorkflow = class extends Component23 {
42455
42480
  stageTypeTagName,
42456
42481
  environmentTypeTagName,
42457
42482
  branchNameTagName,
42458
- deleteBranchPatterns
42483
+ deleteBranchPatterns,
42484
+ homeRepository
42459
42485
  } = options;
42460
42486
  if (!repoTagName) {
42461
42487
  throw new Error("AwsTeardownWorkflow requires `repoTagName`");
@@ -42484,6 +42510,10 @@ var AwsTeardownWorkflow = class extends Component23 {
42484
42510
  deleteBranchPatterns,
42485
42511
  awsDestructionTargets
42486
42512
  );
42513
+ const homeRepositoryCondition = renderHomeRepositoryCondition(
42514
+ homeRepository,
42515
+ "AwsTeardownWorkflow"
42516
+ );
42487
42517
  const workflow = new GithubWorkflow(github, "teardown-dev");
42488
42518
  workflow.on({
42489
42519
  workflowDispatch: {},
@@ -42510,6 +42540,7 @@ var AwsTeardownWorkflow = class extends Component23 {
42510
42540
  {
42511
42541
  name: `Teardown Stacks in ${awsStageType}/${deploymentTargetRole}/${account}/${region}`,
42512
42542
  runsOn: ["ubuntu-latest"],
42543
+ ...homeRepositoryCondition ? { if: `\${{ ${homeRepositoryCondition} }}` } : {},
42513
42544
  permissions: {
42514
42545
  contents: JobPermission6.READ,
42515
42546
  idToken: JobPermission6.WRITE
@@ -43543,6 +43574,7 @@ export {
43543
43574
  renderFocusSection,
43544
43575
  renderGithubIssueTypeSection,
43545
43576
  renderGithubIssueTypeSectionLines,
43577
+ renderHomeRepositoryCondition,
43546
43578
  renderIssueTemplateLabelsCheckerScript,
43547
43579
  renderIssueTemplatesBundleHook,
43548
43580
  renderIssueTemplatesCheckerScript,