@codedrifters/configulator 0.0.434 → 0.0.436

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
@@ -14104,7 +14104,28 @@ declare class AwsTeardownWorkflow extends Component {
14104
14104
  * throws otherwise. Configulator assumes a single-package repo is still a
14105
14105
  * monorepo (with one workspace) so all conventions hold uniformly.
14106
14106
  */
14107
- interface AwsCdkProjectOptions extends Omit<awscdk.AwsCdkTypeScriptAppOptions, "defaultReleaseBranch"> {
14107
+ interface AwsCdkProjectOptions extends Omit<awscdk.AwsCdkTypeScriptAppOptions, "defaultReleaseBranch" | "cdkVersion"> {
14108
+ /**
14109
+ * Minimum version of `aws-cdk-lib` to depend on.
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.
14116
+ *
14117
+ * @default - the parent monorepo's catalog pin for `aws-cdk-lib`
14118
+ */
14119
+ readonly cdkVersion?: string;
14120
+ /**
14121
+ * Minimum version of the `constructs` library to depend on.
14122
+ *
14123
+ * Catalog-pinned on the same terms as `cdkVersion` — omit it, or keep it
14124
+ * in step with the parent monorepo's catalog entry for `constructs`.
14125
+ *
14126
+ * @default - the parent monorepo's catalog pin for `constructs`
14127
+ */
14128
+ readonly constructsVersion?: string;
14108
14129
  /**
14109
14130
  * AWS deployment targets (dev / stage / prod accounts and regions). Each
14110
14131
  * entry creates an `AwsDeploymentTarget` component on the project.
package/lib/index.d.ts CHANGED
@@ -14153,7 +14153,28 @@ declare class AwsTeardownWorkflow extends Component {
14153
14153
  * throws otherwise. Configulator assumes a single-package repo is still a
14154
14154
  * monorepo (with one workspace) so all conventions hold uniformly.
14155
14155
  */
14156
- interface AwsCdkProjectOptions extends Omit<awscdk.AwsCdkTypeScriptAppOptions, "defaultReleaseBranch"> {
14156
+ interface AwsCdkProjectOptions extends Omit<awscdk.AwsCdkTypeScriptAppOptions, "defaultReleaseBranch" | "cdkVersion"> {
14157
+ /**
14158
+ * Minimum version of `aws-cdk-lib` to depend on.
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.
14165
+ *
14166
+ * @default - the parent monorepo's catalog pin for `aws-cdk-lib`
14167
+ */
14168
+ readonly cdkVersion?: string;
14169
+ /**
14170
+ * Minimum version of the `constructs` library to depend on.
14171
+ *
14172
+ * Catalog-pinned on the same terms as `cdkVersion` — omit it, or keep it
14173
+ * in step with the parent monorepo's catalog entry for `constructs`.
14174
+ *
14175
+ * @default - the parent monorepo's catalog pin for `constructs`
14176
+ */
14177
+ readonly constructsVersion?: string;
14157
14178
  /**
14158
14179
  * AWS deployment targets (dev / stage / prod accounts and regions). Each
14159
14180
  * entry creates an `AwsDeploymentTarget` component on the project.
package/lib/index.js CHANGED
@@ -5170,13 +5170,16 @@ var createAppSkill = {
5170
5170
  "2. **Collect metadata** \u2014 ask the user for each of the following,",
5171
5171
  " one question at a time:",
5172
5172
  " - **Description** \u2014 one-line summary of what the app does.",
5173
- " - **CDK version** \u2014 the AWS CDK version to pin (e.g. `2.150.0`).",
5174
- " If the user is unsure, suggest they match the CDK version",
5175
- " already in use by sibling `AwsCdkProject` entries in the",
5176
- " monorepo; otherwise pick the latest stable release.",
5177
5173
  " Skip any question the user has already answered in the initial",
5178
5174
  " prompt.",
5179
5175
  "",
5176
+ " Do **not** ask for a CDK version. `AwsCdkProject` renders",
5177
+ " `aws-cdk-lib` and `constructs` as `catalog:`, so the monorepo's",
5178
+ " pnpm catalog pins both for every app. Passing a `cdkVersion` or",
5179
+ " `constructsVersion` that disagrees with the catalog throws at",
5180
+ " synth time \u2014 a version bump is a catalog edit, not a per-app",
5181
+ " option.",
5182
+ "",
5180
5183
  "3. **Determine the target outdir.** The sub-project lives at:",
5181
5184
  "",
5182
5185
  " ```",
@@ -5208,13 +5211,13 @@ var createAppSkill = {
5208
5211
  " parent: monorepo,",
5209
5212
  " name: '@codedrifters/my-stack',",
5210
5213
  " description: '<one-line description>',",
5211
- " cdkVersion: '<cdk-version>',",
5212
5214
  " });",
5213
5215
  " ```",
5214
5216
  "",
5215
- " Substitute the user's scope, name, description, and CDK",
5216
- " version. Do not hard-code `outdir` \u2014 the default places the",
5217
- " sub-project at `apps/<scope>/<name>`.",
5217
+ " Substitute the user's scope, name, and description. Do not",
5218
+ " hard-code `outdir` \u2014 the default places the sub-project at",
5219
+ " `apps/<scope>/<name>` \u2014 and do not add `cdkVersion`; the",
5220
+ " catalog supplies it.",
5218
5221
  "",
5219
5222
  "6. **Tell the user how to synthesize.** Instruct them to run, from",
5220
5223
  " the repo root, the safe three-step regen sequence:",
@@ -43912,6 +43915,21 @@ var AwsCdkProject = class extends import_projen31.awscdk.AwsCdkTypeScriptApp {
43912
43915
  const parent = userOptions.parent;
43913
43916
  const pnpmVersion = parent.pnpmVersion;
43914
43917
  const pnpmWorkspace = PnpmWorkspace.of(parent);
43918
+ const defaultCatalog = pnpmWorkspace?.defaultCatalog ?? {};
43919
+ const cdkVersion = resolveCatalogVersion(
43920
+ "cdkVersion",
43921
+ "aws-cdk-lib",
43922
+ userOptions.cdkVersion,
43923
+ VERSION.AWS_CDK_LIB_VERSION,
43924
+ defaultCatalog
43925
+ );
43926
+ const constructsVersion = resolveCatalogVersion(
43927
+ "constructsVersion",
43928
+ "constructs",
43929
+ userOptions.constructsVersion,
43930
+ VERSION.AWS_CONSTRUCTS_VERSION,
43931
+ defaultCatalog
43932
+ );
43915
43933
  const resolvedOutdir = userOptions.outdir ?? resolveAwsCdkProjectOutdir(userOptions.packageName ?? userOptions.name);
43916
43934
  const testRunner = userOptions.testRunner ?? TestRunner.JEST;
43917
43935
  const useJest = testRunner === TestRunner.JEST;
@@ -43940,9 +43958,13 @@ var AwsCdkProject = class extends import_projen31.awscdk.AwsCdkTypeScriptApp {
43940
43958
  */
43941
43959
  sampleCode: false,
43942
43960
  /**
43943
- * CDK versions sourced from the configulator-managed catalog.
43961
+ * CDK versions read back out of the catalog above. The framework and
43962
+ * its `constructs` peer render as `catalog:` (see after `super()`);
43963
+ * these keep projen's own view of the versions in step with whatever
43964
+ * that catalog pins, rather than its `^10.5.1`-style fallbacks.
43944
43965
  */
43945
- cdkVersion: VERSION.AWS_CDK_LIB_VERSION,
43966
+ cdkVersion,
43967
+ constructsVersion,
43946
43968
  cdkCliVersion: VERSION.AWS_CDK_CLI_VERSION,
43947
43969
  ...useJest ? {
43948
43970
  /**
@@ -43991,7 +44013,7 @@ var AwsCdkProject = class extends import_projen31.awscdk.AwsCdkTypeScriptApp {
43991
44013
  depsUpgrade: true,
43992
44014
  depsUpgradeOptions: {
43993
44015
  workflow: false,
43994
- exclude: Object.keys(pnpmWorkspace?.defaultCatalog || {}),
44016
+ exclude: Object.keys(defaultCatalog),
43995
44017
  workflowOptions: {
43996
44018
  schedule: import_javascript5.UpgradeDependenciesSchedule.WEEKLY
43997
44019
  },
@@ -44004,9 +44026,21 @@ var AwsCdkProject = class extends import_projen31.awscdk.AwsCdkTypeScriptApp {
44004
44026
  paths: [`${resolvedOutdir}/src/**`, `${resolvedOutdir}/package.json`]
44005
44027
  })
44006
44028
  };
44007
- const options = (0, import_ts_deepmerge4.merge)(defaultOptions, userOptions);
44029
+ const options = {
44030
+ ...(0, import_ts_deepmerge4.merge)(defaultOptions, userOptions),
44031
+ /**
44032
+ * Both versions are the catalog's, resolved above — restate them after
44033
+ * the merge so a supplied option can never reintroduce a value the
44034
+ * catalog disagrees with. Restating `cdkVersion` also keeps the
44035
+ * intersection type honest, since it is optional here but required by
44036
+ * projen.
44037
+ */
44038
+ cdkVersion,
44039
+ constructsVersion
44040
+ };
44008
44041
  super(options);
44009
44042
  this.addDevDeps("@types/node@catalog:");
44043
+ this.addDeps("aws-cdk-lib@catalog:", "constructs@catalog:");
44010
44044
  this.tsconfig?.file.addOverride("compilerOptions.skipLibCheck", true);
44011
44045
  if (testRunner === TestRunner.VITEST) {
44012
44046
  new Vitest(this, {
@@ -44116,6 +44150,24 @@ var AwsCdkProject = class extends import_projen31.awscdk.AwsCdkTypeScriptApp {
44116
44150
  return new AwsDeploymentTarget(this, options);
44117
44151
  }
44118
44152
  };
44153
+ var EXACT_VERSION = /^\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?$/;
44154
+ function resolveCatalogVersion(optionName, packageName, suppliedVersion, fallbackVersion, catalog) {
44155
+ const catalogVersion = catalog[packageName];
44156
+ if (catalogVersion === void 0) {
44157
+ return suppliedVersion ?? fallbackVersion;
44158
+ }
44159
+ if (!EXACT_VERSION.test(catalogVersion)) {
44160
+ throw new Error(
44161
+ `AwsCdkProject renders "${packageName}" as "catalog:", which pins only as tightly as the catalog entry behind it. The parent MonorepoProject's catalog holds "${catalogVersion}" \u2014 a range, so every CDK app would keep floating within it. Set the catalog entry for "${packageName}" to an exact version.`
44162
+ );
44163
+ }
44164
+ if (suppliedVersion !== void 0 && suppliedVersion !== catalogVersion) {
44165
+ throw new Error(
44166
+ `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}.`
44167
+ );
44168
+ }
44169
+ return catalogVersion;
44170
+ }
44119
44171
 
44120
44172
  // src/projects/react-vite-site-project.ts
44121
44173
  var import_projen32 = require("projen");