@codedrifters/configulator 0.0.456 → 0.0.458

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.d.mts CHANGED
@@ -8838,6 +8838,11 @@ interface CdkDiffOptions extends CdkGlobalOptions {
8838
8838
  }
8839
8839
  /**
8840
8840
  * Options for the `cdk bootstrap` command.
8841
+ *
8842
+ * Bootstrap's trailing positional arguments are **environment specifiers**
8843
+ * (`aws://<account>/<region>`), not stack patterns. They are carried by the
8844
+ * inherited {@link CdkGlobalOptions.stackPatterns} field, which is the shared
8845
+ * vehicle for every command's trailing positionals.
8841
8846
  */
8842
8847
  interface CdkBootstrapOptions extends CdkGlobalOptions {
8843
8848
  /*****************************************************************************
@@ -9900,6 +9905,23 @@ declare class AwsDeploymentTarget extends Component {
9900
9905
  *
9901
9906
  ****************************************************************************/
9902
9907
  private configureDestroyTask;
9908
+ /*****************************************************************************
9909
+ *
9910
+ * Bootstrap Tasks
9911
+ *
9912
+ * Unlike deploy / watch / destroy, this family is generated for **every**
9913
+ * target rather than only those with `localDeployment` enabled. Bootstrapping
9914
+ * provisions the CDK toolkit stack for one account/region pair, and a
9915
+ * CI-only target needs that done before its first deployment just as much as
9916
+ * a local one — gating on `localDeployment` would also make the built-in
9917
+ * `prod` default (`--termination-protection`) unreachable, since prod targets
9918
+ * default to `localDeployment: false`.
9919
+ *
9920
+ * The tasks are never invoked automatically; running one is always a
9921
+ * deliberate, elevated-credentials operation.
9922
+ *
9923
+ ****************************************************************************/
9924
+ private configureBootstrapTask;
9903
9925
  }
9904
9926
 
9905
9927
  /*******************************************************************************
@@ -10204,6 +10226,31 @@ declare class AwsDeploymentConfig extends Component {
10204
10226
  * - Change the output location for easier workflows.
10205
10227
  *
10206
10228
  ****************************************************************************/
10229
+ /**
10230
+ * Resolve the synth options for the project-wide `synth` / `synth:silent`
10231
+ * tasks.
10232
+ *
10233
+ * `cdk synth` produces one cloud assembly that every target deploys from, so
10234
+ * there is no single target to resolve against. Each registered target's
10235
+ * resolved options are folded together lowest-stage-first, so a higher stage
10236
+ * wins scalar collisions and arrays/records union across targets. Sorting
10237
+ * makes the result independent of the order targets were declared in. With a
10238
+ * single target this is exactly `synthOptionsFor(target)`; with none it is
10239
+ * empty.
10240
+ */
10241
+ private resolveSynthOptions;
10242
+ /**
10243
+ * (Re)build the project-wide synth tasks.
10244
+ *
10245
+ * Idempotent — it resets both tasks before rebuilding them, so it is safe to
10246
+ * run once from the constructor (keeping the tasks well-formed for a project
10247
+ * with no targets) and again from `preSynthesize`, once every target has
10248
+ * registered itself and the override chain can actually be resolved.
10249
+ *
10250
+ * `--output` is pinned at the call site because it is a property of the
10251
+ * project layout, and `--quiet` is pinned on `synth:silent` because it is
10252
+ * what makes that task silent. Every other flag flows through the chain.
10253
+ */
10207
10254
  private configureSynthTask;
10208
10255
  preSynthesize(): void;
10209
10256
  }
@@ -10299,8 +10346,12 @@ declare const CDK_DEPLOY_DEFAULTS_BY_STAGE: Record<AwsStageType, Partial<CdkDepl
10299
10346
  /**
10300
10347
  * Per-stage defaults for `cdk synth`.
10301
10348
  *
10302
- * Every stage runs synth with `--quiet` so the synthesised template stays out
10303
- * of normal task logs.
10349
+ * Deliberately empty. `--quiet` is what distinguishes the generated `synth`
10350
+ * task from `synth:silent`, so it is pinned at the `synth:silent` call site
10351
+ * rather than seeded here — a per-stage default would silence both tasks and
10352
+ * collapse them into the same command. Consumers that genuinely want a quiet
10353
+ * `synth` can still set `synthDefaults[stage].quiet`, which reaches the
10354
+ * rendered command; `synth:silent` stays silent regardless.
10304
10355
  */
10305
10356
  declare const CDK_SYNTH_DEFAULTS_BY_STAGE: Record<AwsStageType, Partial<CdkSynthOptions>>;
10306
10357
  /**
@@ -12475,7 +12526,7 @@ interface PnpmWorkspaceOptions {
12475
12526
  * specifiers — git, tarball URL, local path — are rejected. Direct
12476
12527
  * dependencies are unaffected.
12477
12528
  *
12478
- * @default undefined (key omitted; pnpm 11 defaults to true)
12529
+ * @default undefined (key omitted; pnpm 11 defaults to false)
12479
12530
  *
12480
12531
  * @see https://pnpm.io/settings#blockexoticsubdeps
12481
12532
  */
package/lib/index.d.ts CHANGED
@@ -8887,6 +8887,11 @@ interface CdkDiffOptions extends CdkGlobalOptions {
8887
8887
  }
8888
8888
  /**
8889
8889
  * Options for the `cdk bootstrap` command.
8890
+ *
8891
+ * Bootstrap's trailing positional arguments are **environment specifiers**
8892
+ * (`aws://<account>/<region>`), not stack patterns. They are carried by the
8893
+ * inherited {@link CdkGlobalOptions.stackPatterns} field, which is the shared
8894
+ * vehicle for every command's trailing positionals.
8890
8895
  */
8891
8896
  interface CdkBootstrapOptions extends CdkGlobalOptions {
8892
8897
  /*****************************************************************************
@@ -9949,6 +9954,23 @@ declare class AwsDeploymentTarget extends Component {
9949
9954
  *
9950
9955
  ****************************************************************************/
9951
9956
  private configureDestroyTask;
9957
+ /*****************************************************************************
9958
+ *
9959
+ * Bootstrap Tasks
9960
+ *
9961
+ * Unlike deploy / watch / destroy, this family is generated for **every**
9962
+ * target rather than only those with `localDeployment` enabled. Bootstrapping
9963
+ * provisions the CDK toolkit stack for one account/region pair, and a
9964
+ * CI-only target needs that done before its first deployment just as much as
9965
+ * a local one — gating on `localDeployment` would also make the built-in
9966
+ * `prod` default (`--termination-protection`) unreachable, since prod targets
9967
+ * default to `localDeployment: false`.
9968
+ *
9969
+ * The tasks are never invoked automatically; running one is always a
9970
+ * deliberate, elevated-credentials operation.
9971
+ *
9972
+ ****************************************************************************/
9973
+ private configureBootstrapTask;
9952
9974
  }
9953
9975
 
9954
9976
  /*******************************************************************************
@@ -10253,6 +10275,31 @@ declare class AwsDeploymentConfig extends Component {
10253
10275
  * - Change the output location for easier workflows.
10254
10276
  *
10255
10277
  ****************************************************************************/
10278
+ /**
10279
+ * Resolve the synth options for the project-wide `synth` / `synth:silent`
10280
+ * tasks.
10281
+ *
10282
+ * `cdk synth` produces one cloud assembly that every target deploys from, so
10283
+ * there is no single target to resolve against. Each registered target's
10284
+ * resolved options are folded together lowest-stage-first, so a higher stage
10285
+ * wins scalar collisions and arrays/records union across targets. Sorting
10286
+ * makes the result independent of the order targets were declared in. With a
10287
+ * single target this is exactly `synthOptionsFor(target)`; with none it is
10288
+ * empty.
10289
+ */
10290
+ private resolveSynthOptions;
10291
+ /**
10292
+ * (Re)build the project-wide synth tasks.
10293
+ *
10294
+ * Idempotent — it resets both tasks before rebuilding them, so it is safe to
10295
+ * run once from the constructor (keeping the tasks well-formed for a project
10296
+ * with no targets) and again from `preSynthesize`, once every target has
10297
+ * registered itself and the override chain can actually be resolved.
10298
+ *
10299
+ * `--output` is pinned at the call site because it is a property of the
10300
+ * project layout, and `--quiet` is pinned on `synth:silent` because it is
10301
+ * what makes that task silent. Every other flag flows through the chain.
10302
+ */
10256
10303
  private configureSynthTask;
10257
10304
  preSynthesize(): void;
10258
10305
  }
@@ -10348,8 +10395,12 @@ declare const CDK_DEPLOY_DEFAULTS_BY_STAGE: Record<AwsStageType, Partial<CdkDepl
10348
10395
  /**
10349
10396
  * Per-stage defaults for `cdk synth`.
10350
10397
  *
10351
- * Every stage runs synth with `--quiet` so the synthesised template stays out
10352
- * of normal task logs.
10398
+ * Deliberately empty. `--quiet` is what distinguishes the generated `synth`
10399
+ * task from `synth:silent`, so it is pinned at the `synth:silent` call site
10400
+ * rather than seeded here — a per-stage default would silence both tasks and
10401
+ * collapse them into the same command. Consumers that genuinely want a quiet
10402
+ * `synth` can still set `synthDefaults[stage].quiet`, which reaches the
10403
+ * rendered command; `synth:silent` stays silent regardless.
10353
10404
  */
10354
10405
  declare const CDK_SYNTH_DEFAULTS_BY_STAGE: Record<AwsStageType, Partial<CdkSynthOptions>>;
10355
10406
  /**
@@ -12524,7 +12575,7 @@ interface PnpmWorkspaceOptions {
12524
12575
  * specifiers — git, tarball URL, local path — are rejected. Direct
12525
12576
  * dependencies are unaffected.
12526
12577
  *
12527
- * @default undefined (key omitted; pnpm 11 defaults to true)
12578
+ * @default undefined (key omitted; pnpm 11 defaults to false)
12528
12579
  *
12529
12580
  * @see https://pnpm.io/settings#blockexoticsubdeps
12530
12581
  */
package/lib/index.js CHANGED
@@ -38071,9 +38071,9 @@ var CDK_DEPLOY_DEFAULTS_BY_STAGE = {
38071
38071
  }
38072
38072
  };
38073
38073
  var CDK_SYNTH_DEFAULTS_BY_STAGE = {
38074
- dev: { quiet: true },
38075
- stage: { quiet: true },
38076
- prod: { quiet: true }
38074
+ dev: {},
38075
+ stage: {},
38076
+ prod: {}
38077
38077
  };
38078
38078
  var CDK_WATCH_DEFAULTS_BY_STAGE = {
38079
38079
  dev: { progress: "events" },
@@ -38799,6 +38799,11 @@ var TURBO_RUN_DRY_RUN = {
38799
38799
  };
38800
38800
 
38801
38801
  // src/aws/aws-deployment-config.ts
38802
+ var SYNTH_STAGE_RANK = {
38803
+ [import_utils9.AWS_STAGE_TYPE.DEV]: 0,
38804
+ [import_utils9.AWS_STAGE_TYPE.STAGE]: 1,
38805
+ [import_utils9.AWS_STAGE_TYPE.PROD]: 2
38806
+ };
38802
38807
  var AwsDeploymentConfig = class _AwsDeploymentConfig extends import_projen12.Component {
38803
38808
  constructor(project) {
38804
38809
  super(project);
@@ -38814,15 +38819,55 @@ var AwsDeploymentConfig = class _AwsDeploymentConfig extends import_projen12.Com
38814
38819
  * - Change the output location for easier workflows.
38815
38820
  *
38816
38821
  ****************************************************************************/
38822
+ /**
38823
+ * Resolve the synth options for the project-wide `synth` / `synth:silent`
38824
+ * tasks.
38825
+ *
38826
+ * `cdk synth` produces one cloud assembly that every target deploys from, so
38827
+ * there is no single target to resolve against. Each registered target's
38828
+ * resolved options are folded together lowest-stage-first, so a higher stage
38829
+ * wins scalar collisions and arrays/records union across targets. Sorting
38830
+ * makes the result independent of the order targets were declared in. With a
38831
+ * single target this is exactly `synthOptionsFor(target)`; with none it is
38832
+ * empty.
38833
+ */
38834
+ this.resolveSynthOptions = () => {
38835
+ const ordered = [...this.awsDeploymentTargets].sort(
38836
+ (a, b) => SYNTH_STAGE_RANK[a.awsStageType] - SYNTH_STAGE_RANK[b.awsStageType] || a.account.localeCompare(b.account) || a.region.localeCompare(b.region)
38837
+ );
38838
+ return mergeCdkOptions(
38839
+ ...ordered.map((target) => this.cdkCli.synthOptionsFor(target))
38840
+ );
38841
+ };
38842
+ /**
38843
+ * (Re)build the project-wide synth tasks.
38844
+ *
38845
+ * Idempotent — it resets both tasks before rebuilding them, so it is safe to
38846
+ * run once from the constructor (keeping the tasks well-formed for a project
38847
+ * with no targets) and again from `preSynthesize`, once every target has
38848
+ * registered itself and the override chain can actually be resolved.
38849
+ *
38850
+ * `--output` is pinned at the call site because it is a property of the
38851
+ * project layout, and `--quiet` is pinned on `synth:silent` because it is
38852
+ * what makes that task silent. Every other flag flows through the chain.
38853
+ */
38817
38854
  this.configureSynthTask = () => {
38855
+ const synthOpts = this.resolveSynthOptions();
38818
38856
  this.project.tasks.tryFind("synth")?.reset(`rm -rf ${this.cdkOut}`);
38819
- this.project.tasks.tryFind("synth")?.exec(`cdk ${renderCdkSynth({ output: this.cdkOut })}`, {
38857
+ this.project.tasks.tryFind("synth")?.exec(`cdk ${renderCdkSynth({ ...synthOpts, output: this.cdkOut })}`, {
38820
38858
  env: this.env
38821
38859
  });
38822
38860
  this.project.tasks.tryFind("synth:silent")?.reset(`rm -rf ${this.cdkOut}`);
38823
- this.project.tasks.tryFind("synth:silent")?.exec(`cdk ${renderCdkSynth({ output: this.cdkOut, quiet: true })}`, {
38824
- env: this.env
38825
- });
38861
+ this.project.tasks.tryFind("synth:silent")?.exec(
38862
+ `cdk ${renderCdkSynth({
38863
+ ...synthOpts,
38864
+ output: this.cdkOut,
38865
+ quiet: true
38866
+ })}`,
38867
+ {
38868
+ env: this.env
38869
+ }
38870
+ );
38826
38871
  };
38827
38872
  this.cdkCli = CdkCli.of(project) || new CdkCli(project);
38828
38873
  this.env = {
@@ -38912,6 +38957,7 @@ var AwsDeploymentConfig = class _AwsDeploymentConfig extends import_projen12.Com
38912
38957
  }
38913
38958
  preSynthesize() {
38914
38959
  super.preSynthesize();
38960
+ this.configureSynthTask();
38915
38961
  if (TurboRepo.of(this.project)) {
38916
38962
  const turbo = TurboRepo.of(this.project);
38917
38963
  turbo.postCompileTask?.outputs.push((0, import_node_path2.join)(this.cdkOut, "**"));
@@ -39042,6 +39088,41 @@ var AwsDeploymentTarget = class _AwsDeploymentTarget extends import_projen13.Com
39042
39088
  );
39043
39089
  }
39044
39090
  };
39091
+ /*****************************************************************************
39092
+ *
39093
+ * Bootstrap Tasks
39094
+ *
39095
+ * Unlike deploy / watch / destroy, this family is generated for **every**
39096
+ * target rather than only those with `localDeployment` enabled. Bootstrapping
39097
+ * provisions the CDK toolkit stack for one account/region pair, and a
39098
+ * CI-only target needs that done before its first deployment just as much as
39099
+ * a local one — gating on `localDeployment` would also make the built-in
39100
+ * `prod` default (`--termination-protection`) unreachable, since prod targets
39101
+ * default to `localDeployment: false`.
39102
+ *
39103
+ * The tasks are never invoked automatically; running one is always a
39104
+ * deliberate, elevated-credentials operation.
39105
+ *
39106
+ ****************************************************************************/
39107
+ this.configureBootstrapTask = () => {
39108
+ const taskName = [
39109
+ "bootstrap",
39110
+ this.awsStageType,
39111
+ this.account,
39112
+ this.region
39113
+ ].join(":");
39114
+ const bootstrapTask = this.project.tasks.addTask(taskName, {
39115
+ env: this.awsDeploymentConfig.env
39116
+ });
39117
+ const bootstrapOpts = this.awsDeploymentConfig.cdkCli.bootstrapOptionsFor(this);
39118
+ bootstrapTask.exec(
39119
+ `cdk ${renderCdkBootstrap({
39120
+ ...bootstrapOpts,
39121
+ profile: this.localDeploymentConfig?.profile,
39122
+ stackPatterns: [`aws://${this.account}/${this.region}`]
39123
+ })}`
39124
+ );
39125
+ };
39045
39126
  this.account = options.account;
39046
39127
  this.region = options.region;
39047
39128
  this.cdkOptions = options.cdkOptions;
@@ -39085,6 +39166,7 @@ var AwsDeploymentTarget = class _AwsDeploymentTarget extends import_projen13.Com
39085
39166
  this.configureDeployTask();
39086
39167
  this.configureWatchTask();
39087
39168
  this.configureDestroyTask();
39169
+ this.configureBootstrapTask();
39088
39170
  }
39089
39171
  /**
39090
39172
  * Static method to discovert targets in a project.