@codedrifters/configulator 0.0.437 → 0.0.439

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
@@ -14108,11 +14108,15 @@ interface AwsCdkProjectOptions extends Omit<awscdk.AwsCdkTypeScriptAppOptions, "
14108
14108
  /**
14109
14109
  * Minimum version of `aws-cdk-lib` to depend on.
14110
14110
  *
14111
- * Optional, and normally omitted: the rendered specifier is always
14112
- * `catalog:`, so the parent `MonorepoProject`'s pnpm catalog decides the
14113
- * resolved version. Supplying a value that disagrees with that catalog
14114
- * entry throws rather than being silently discarded — bump the catalog
14115
- * instead.
14111
+ * Optional, and normally omitted: the rendered specifier is `catalog:`
14112
+ * whenever the parent `MonorepoProject`'s pnpm catalog carries an entry, so
14113
+ * that catalog decides the resolved version. Supplying a value that
14114
+ * disagrees with the entry throws rather than being silently discarded —
14115
+ * bump the catalog instead. Only where the catalog has no entry at all does
14116
+ * this value render, and then it must be an exact version.
14117
+ *
14118
+ * Listing `aws-cdk-lib` in `deps`, `devDeps`, or `peerDeps` is never the way
14119
+ * to move it — the first is overridden by the pin and the other two throw.
14116
14120
  *
14117
14121
  * @default - the parent monorepo's catalog pin for `aws-cdk-lib`
14118
14122
  */
@@ -14126,6 +14130,28 @@ interface AwsCdkProjectOptions extends Omit<awscdk.AwsCdkTypeScriptAppOptions, "
14126
14130
  * @default - the parent monorepo's catalog pin for `constructs`
14127
14131
  */
14128
14132
  readonly constructsVersion?: string;
14133
+ /**
14134
+ * Options for the `CdkCli` component that every `cdk` invocation this
14135
+ * project renders flows through — per-stage command defaults, per-account
14136
+ * overrides, and the pinned CLI version.
14137
+ *
14138
+ * The component has to be seeded here rather than constructed afterwards.
14139
+ * This constructor creates an `AwsDeploymentConfig`, which auto-creates a
14140
+ * default `CdkCli` when the project has none, and `CdkCli.of()` resolves to
14141
+ * the *first* matching component — so a `new CdkCli(project, options)` built
14142
+ * once the constructor has returned is silently unreachable: no error, no
14143
+ * warning, and the generated workflows render as if nothing was passed.
14144
+ *
14145
+ * Use it to declare a setting once per project instead of repeating it on
14146
+ * every target via `AwsDeploymentTargetOptions.cdkOptions` — for example
14147
+ * pinning `cdk diff --method=change-set` across stages so a diff never
14148
+ * degrades to a template-only comparison and reports it as authoritative.
14149
+ *
14150
+ * @see `docs/src/content/docs/packages/@codedrifters/configulator/cdk-cli.md`
14151
+ * @default - a `CdkCli` carrying no consumer overrides, identical to the one
14152
+ * `AwsDeploymentConfig` would have auto-created
14153
+ */
14154
+ readonly cdkCliOptions?: CdkCliOptions;
14129
14155
  /**
14130
14156
  * AWS deployment targets (dev / stage / prod accounts and regions). Each
14131
14157
  * entry creates an `AwsDeploymentTarget` component on the project.
package/lib/index.d.ts CHANGED
@@ -14157,11 +14157,15 @@ interface AwsCdkProjectOptions extends Omit<awscdk.AwsCdkTypeScriptAppOptions, "
14157
14157
  /**
14158
14158
  * Minimum version of `aws-cdk-lib` to depend on.
14159
14159
  *
14160
- * Optional, and normally omitted: the rendered specifier is always
14161
- * `catalog:`, so the parent `MonorepoProject`'s pnpm catalog decides the
14162
- * resolved version. Supplying a value that disagrees with that catalog
14163
- * entry throws rather than being silently discarded — bump the catalog
14164
- * instead.
14160
+ * Optional, and normally omitted: the rendered specifier is `catalog:`
14161
+ * whenever the parent `MonorepoProject`'s pnpm catalog carries an entry, so
14162
+ * that catalog decides the resolved version. Supplying a value that
14163
+ * disagrees with the entry throws rather than being silently discarded —
14164
+ * bump the catalog instead. Only where the catalog has no entry at all does
14165
+ * this value render, and then it must be an exact version.
14166
+ *
14167
+ * Listing `aws-cdk-lib` in `deps`, `devDeps`, or `peerDeps` is never the way
14168
+ * to move it — the first is overridden by the pin and the other two throw.
14165
14169
  *
14166
14170
  * @default - the parent monorepo's catalog pin for `aws-cdk-lib`
14167
14171
  */
@@ -14175,6 +14179,28 @@ interface AwsCdkProjectOptions extends Omit<awscdk.AwsCdkTypeScriptAppOptions, "
14175
14179
  * @default - the parent monorepo's catalog pin for `constructs`
14176
14180
  */
14177
14181
  readonly constructsVersion?: string;
14182
+ /**
14183
+ * Options for the `CdkCli` component that every `cdk` invocation this
14184
+ * project renders flows through — per-stage command defaults, per-account
14185
+ * overrides, and the pinned CLI version.
14186
+ *
14187
+ * The component has to be seeded here rather than constructed afterwards.
14188
+ * This constructor creates an `AwsDeploymentConfig`, which auto-creates a
14189
+ * default `CdkCli` when the project has none, and `CdkCli.of()` resolves to
14190
+ * the *first* matching component — so a `new CdkCli(project, options)` built
14191
+ * once the constructor has returned is silently unreachable: no error, no
14192
+ * warning, and the generated workflows render as if nothing was passed.
14193
+ *
14194
+ * Use it to declare a setting once per project instead of repeating it on
14195
+ * every target via `AwsDeploymentTargetOptions.cdkOptions` — for example
14196
+ * pinning `cdk diff --method=change-set` across stages so a diff never
14197
+ * degrades to a template-only comparison and reports it as authoritative.
14198
+ *
14199
+ * @see `docs/src/content/docs/packages/@codedrifters/configulator/cdk-cli.md`
14200
+ * @default - a `CdkCli` carrying no consumer overrides, identical to the one
14201
+ * `AwsDeploymentConfig` would have auto-created
14202
+ */
14203
+ readonly cdkCliOptions?: CdkCliOptions;
14178
14204
  /**
14179
14205
  * AWS deployment targets (dev / stage / prod accounts and regions). Each
14180
14206
  * entry creates an `AwsDeploymentTarget` component on the project.
package/lib/index.js CHANGED
@@ -43916,20 +43916,24 @@ var AwsCdkProject = class extends import_projen31.awscdk.AwsCdkTypeScriptApp {
43916
43916
  const pnpmVersion = parent.pnpmVersion;
43917
43917
  const pnpmWorkspace = PnpmWorkspace.of(parent);
43918
43918
  const defaultCatalog = pnpmWorkspace?.defaultCatalog ?? {};
43919
- const cdkVersion = resolveCatalogVersion(
43919
+ rejectCatalogManagedDeps("devDeps", userOptions.devDeps);
43920
+ rejectCatalogManagedDeps("peerDeps", userOptions.peerDeps);
43921
+ const cdkPin = resolveCatalogPin(
43920
43922
  "cdkVersion",
43921
43923
  "aws-cdk-lib",
43922
43924
  userOptions.cdkVersion,
43923
43925
  VERSION.AWS_CDK_LIB_VERSION,
43924
43926
  defaultCatalog
43925
43927
  );
43926
- const constructsVersion = resolveCatalogVersion(
43928
+ const constructsPin = resolveCatalogPin(
43927
43929
  "constructsVersion",
43928
43930
  "constructs",
43929
43931
  userOptions.constructsVersion,
43930
43932
  VERSION.AWS_CONSTRUCTS_VERSION,
43931
43933
  defaultCatalog
43932
43934
  );
43935
+ const cdkVersion = cdkPin.version;
43936
+ const constructsVersion = constructsPin.version;
43933
43937
  const resolvedOutdir = userOptions.outdir ?? resolveAwsCdkProjectOutdir(userOptions.packageName ?? userOptions.name);
43934
43938
  const testRunner = userOptions.testRunner ?? TestRunner.JEST;
43935
43939
  const useJest = testRunner === TestRunner.JEST;
@@ -44040,7 +44044,10 @@ var AwsCdkProject = class extends import_projen31.awscdk.AwsCdkTypeScriptApp {
44040
44044
  };
44041
44045
  super(options);
44042
44046
  this.addDevDeps("@types/node@catalog:");
44043
- this.addDeps("aws-cdk-lib@catalog:", "constructs@catalog:");
44047
+ this.addDeps(
44048
+ `aws-cdk-lib@${cdkPin.specifier}`,
44049
+ `constructs@${constructsPin.specifier}`
44050
+ );
44044
44051
  this.tsconfig?.file.addOverride("compilerOptions.skipLibCheck", true);
44045
44052
  if (testRunner === TestRunner.VITEST) {
44046
44053
  new Vitest(this, {
@@ -44065,6 +44072,7 @@ var AwsCdkProject = class extends import_projen31.awscdk.AwsCdkTypeScriptApp {
44065
44072
  });
44066
44073
  this.gitignore?.addPatterns(".DS_Store", "test-reports", "cdk.out");
44067
44074
  this.npmignore?.addPatterns("*.spec.*", "*.test.*", "__fixtures__");
44075
+ new CdkCli(this, options.cdkCliOptions ?? {});
44068
44076
  new AwsDeploymentConfig(this);
44069
44077
  (options.deploymentTargets ?? []).forEach(
44070
44078
  (targetOptions) => this.addDeploymentTarget(targetOptions)
@@ -44150,10 +44158,28 @@ var AwsCdkProject = class extends import_projen31.awscdk.AwsCdkTypeScriptApp {
44150
44158
  }
44151
44159
  };
44152
44160
  var EXACT_VERSION = /^\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?$/;
44153
- function resolveCatalogVersion(optionName, packageName, suppliedVersion, fallbackVersion, catalog) {
44161
+ var CATALOG_MANAGED_PACKAGES = ["aws-cdk-lib", "constructs"];
44162
+ function rejectCatalogManagedDeps(optionName, specs) {
44163
+ for (const spec2 of specs ?? []) {
44164
+ const { name } = import_projen31.Dependencies.parseDependency(spec2);
44165
+ if (!CATALOG_MANAGED_PACKAGES.includes(name)) {
44166
+ continue;
44167
+ }
44168
+ throw new Error(
44169
+ `AwsCdkProject pins "${name}" itself, as a runtime dependency on the parent MonorepoProject's catalog, so \`${optionName}: ["${spec2}"]\` never reaches that pin \u2014 it renders a second, unpinned specifier beside it or is dropped outright. Remove "${spec2}" from \`${optionName}\`, and change the version through the catalog entry for "${name}" instead.`
44170
+ );
44171
+ }
44172
+ }
44173
+ function resolveCatalogPin(optionName, packageName, suppliedVersion, fallbackVersion, catalog) {
44154
44174
  const catalogVersion = catalog[packageName];
44155
44175
  if (catalogVersion === void 0) {
44156
- return suppliedVersion ?? fallbackVersion;
44176
+ const version = suppliedVersion ?? fallbackVersion;
44177
+ if (!EXACT_VERSION.test(version)) {
44178
+ throw new Error(
44179
+ `AwsCdkProject pins "${packageName}" exactly, but the parent MonorepoProject's catalog carries no entry for it, so the rendered specifier falls back to \`${optionName}: "${version}"\` \u2014 a range, which would leave every CDK app floating within it. Add an exact "${packageName}" entry to the catalog, or set \`${optionName}\` to an exact version.`
44180
+ );
44181
+ }
44182
+ return { version, specifier: version };
44157
44183
  }
44158
44184
  if (!EXACT_VERSION.test(catalogVersion)) {
44159
44185
  throw new Error(
@@ -44165,7 +44191,7 @@ function resolveCatalogVersion(optionName, packageName, suppliedVersion, fallbac
44165
44191
  `AwsCdkProject renders "${packageName}" as "catalog:", so the parent MonorepoProject's catalog pin (${catalogVersion}) decides the resolved version. \`${optionName}: "${suppliedVersion}"\` would be silently ignored. Drop the option, or bump the catalog entry for "${packageName}" to ${suppliedVersion}.`
44166
44192
  );
44167
44193
  }
44168
- return catalogVersion;
44194
+ return { version: catalogVersion, specifier: "catalog:" };
44169
44195
  }
44170
44196
 
44171
44197
  // src/projects/react-vite-site-project.ts