@codedrifters/configulator 0.0.435 → 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.mjs CHANGED
@@ -4770,13 +4770,16 @@ var createAppSkill = {
4770
4770
  "2. **Collect metadata** \u2014 ask the user for each of the following,",
4771
4771
  " one question at a time:",
4772
4772
  " - **Description** \u2014 one-line summary of what the app does.",
4773
- " - **CDK version** \u2014 the AWS CDK version to pin (e.g. `2.150.0`).",
4774
- " If the user is unsure, suggest they match the CDK version",
4775
- " already in use by sibling `AwsCdkProject` entries in the",
4776
- " monorepo; otherwise pick the latest stable release.",
4777
4773
  " Skip any question the user has already answered in the initial",
4778
4774
  " prompt.",
4779
4775
  "",
4776
+ " Do **not** ask for a CDK version. `AwsCdkProject` renders",
4777
+ " `aws-cdk-lib` and `constructs` as `catalog:`, so the monorepo's",
4778
+ " pnpm catalog pins both for every app. Passing a `cdkVersion` or",
4779
+ " `constructsVersion` that disagrees with the catalog throws at",
4780
+ " synth time \u2014 a version bump is a catalog edit, not a per-app",
4781
+ " option.",
4782
+ "",
4780
4783
  "3. **Determine the target outdir.** The sub-project lives at:",
4781
4784
  "",
4782
4785
  " ```",
@@ -4808,13 +4811,13 @@ var createAppSkill = {
4808
4811
  " parent: monorepo,",
4809
4812
  " name: '@codedrifters/my-stack',",
4810
4813
  " description: '<one-line description>',",
4811
- " cdkVersion: '<cdk-version>',",
4812
4814
  " });",
4813
4815
  " ```",
4814
4816
  "",
4815
- " Substitute the user's scope, name, description, and CDK",
4816
- " version. Do not hard-code `outdir` \u2014 the default places the",
4817
- " sub-project at `apps/<scope>/<name>`.",
4817
+ " Substitute the user's scope, name, and description. Do not",
4818
+ " hard-code `outdir` \u2014 the default places the sub-project at",
4819
+ " `apps/<scope>/<name>` \u2014 and do not add `cdkVersion`; the",
4820
+ " catalog supplies it.",
4818
4821
  "",
4819
4822
  "6. **Tell the user how to synthesize.** Instruct them to run, from",
4820
4823
  " the repo root, the safe three-step regen sequence:",
@@ -43531,6 +43534,21 @@ var AwsCdkProject = class extends awscdk.AwsCdkTypeScriptApp {
43531
43534
  const parent = userOptions.parent;
43532
43535
  const pnpmVersion = parent.pnpmVersion;
43533
43536
  const pnpmWorkspace = PnpmWorkspace.of(parent);
43537
+ const defaultCatalog = pnpmWorkspace?.defaultCatalog ?? {};
43538
+ const cdkVersion = resolveCatalogVersion(
43539
+ "cdkVersion",
43540
+ "aws-cdk-lib",
43541
+ userOptions.cdkVersion,
43542
+ VERSION.AWS_CDK_LIB_VERSION,
43543
+ defaultCatalog
43544
+ );
43545
+ const constructsVersion = resolveCatalogVersion(
43546
+ "constructsVersion",
43547
+ "constructs",
43548
+ userOptions.constructsVersion,
43549
+ VERSION.AWS_CONSTRUCTS_VERSION,
43550
+ defaultCatalog
43551
+ );
43534
43552
  const resolvedOutdir = userOptions.outdir ?? resolveAwsCdkProjectOutdir(userOptions.packageName ?? userOptions.name);
43535
43553
  const testRunner = userOptions.testRunner ?? TestRunner.JEST;
43536
43554
  const useJest = testRunner === TestRunner.JEST;
@@ -43559,9 +43577,13 @@ var AwsCdkProject = class extends awscdk.AwsCdkTypeScriptApp {
43559
43577
  */
43560
43578
  sampleCode: false,
43561
43579
  /**
43562
- * CDK versions sourced from the configulator-managed catalog.
43580
+ * CDK versions read back out of the catalog above. The framework and
43581
+ * its `constructs` peer render as `catalog:` (see after `super()`);
43582
+ * these keep projen's own view of the versions in step with whatever
43583
+ * that catalog pins, rather than its `^10.5.1`-style fallbacks.
43563
43584
  */
43564
- cdkVersion: VERSION.AWS_CDK_LIB_VERSION,
43585
+ cdkVersion,
43586
+ constructsVersion,
43565
43587
  cdkCliVersion: VERSION.AWS_CDK_CLI_VERSION,
43566
43588
  ...useJest ? {
43567
43589
  /**
@@ -43610,7 +43632,7 @@ var AwsCdkProject = class extends awscdk.AwsCdkTypeScriptApp {
43610
43632
  depsUpgrade: true,
43611
43633
  depsUpgradeOptions: {
43612
43634
  workflow: false,
43613
- exclude: Object.keys(pnpmWorkspace?.defaultCatalog || {}),
43635
+ exclude: Object.keys(defaultCatalog),
43614
43636
  workflowOptions: {
43615
43637
  schedule: UpgradeDependenciesSchedule3.WEEKLY
43616
43638
  },
@@ -43623,9 +43645,21 @@ var AwsCdkProject = class extends awscdk.AwsCdkTypeScriptApp {
43623
43645
  paths: [`${resolvedOutdir}/src/**`, `${resolvedOutdir}/package.json`]
43624
43646
  })
43625
43647
  };
43626
- const options = merge4(defaultOptions, userOptions);
43648
+ const options = {
43649
+ ...merge4(defaultOptions, userOptions),
43650
+ /**
43651
+ * Both versions are the catalog's, resolved above — restate them after
43652
+ * the merge so a supplied option can never reintroduce a value the
43653
+ * catalog disagrees with. Restating `cdkVersion` also keeps the
43654
+ * intersection type honest, since it is optional here but required by
43655
+ * projen.
43656
+ */
43657
+ cdkVersion,
43658
+ constructsVersion
43659
+ };
43627
43660
  super(options);
43628
43661
  this.addDevDeps("@types/node@catalog:");
43662
+ this.addDeps("aws-cdk-lib@catalog:", "constructs@catalog:");
43629
43663
  this.tsconfig?.file.addOverride("compilerOptions.skipLibCheck", true);
43630
43664
  if (testRunner === TestRunner.VITEST) {
43631
43665
  new Vitest(this, {
@@ -43735,6 +43769,24 @@ var AwsCdkProject = class extends awscdk.AwsCdkTypeScriptApp {
43735
43769
  return new AwsDeploymentTarget(this, options);
43736
43770
  }
43737
43771
  };
43772
+ var EXACT_VERSION = /^\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?$/;
43773
+ function resolveCatalogVersion(optionName, packageName, suppliedVersion, fallbackVersion, catalog) {
43774
+ const catalogVersion = catalog[packageName];
43775
+ if (catalogVersion === void 0) {
43776
+ return suppliedVersion ?? fallbackVersion;
43777
+ }
43778
+ if (!EXACT_VERSION.test(catalogVersion)) {
43779
+ throw new Error(
43780
+ `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.`
43781
+ );
43782
+ }
43783
+ if (suppliedVersion !== void 0 && suppliedVersion !== catalogVersion) {
43784
+ throw new Error(
43785
+ `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}.`
43786
+ );
43787
+ }
43788
+ return catalogVersion;
43789
+ }
43738
43790
 
43739
43791
  // src/projects/react-vite-site-project.ts
43740
43792
  import { SampleFile as SampleFile6, TextFile as TextFile8 } from "projen";