@codedrifters/configulator 0.0.454 → 0.0.456

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.js CHANGED
@@ -21429,6 +21429,86 @@ var MINIMUM_RELEASE_AGE = {
21429
21429
  SIX_DAYS: 8640,
21430
21430
  ONE_WEEK: 10080
21431
21431
  };
21432
+ var CURATED_SETTING_KEYS = [
21433
+ // Dependency graph
21434
+ "overrides",
21435
+ "packageExtensions",
21436
+ "patchedDependencies",
21437
+ "patchesDir",
21438
+ "allowUnusedPatches",
21439
+ "allowedDeprecatedVersions",
21440
+ "ignoredOptionalDependencies",
21441
+ "supportedArchitectures",
21442
+ "configDependencies",
21443
+ "resolutionMode",
21444
+ "savePrefix",
21445
+ "saveExact",
21446
+ // Supply-chain posture
21447
+ "trustPolicy",
21448
+ "trustPolicyExclude",
21449
+ "trustPolicyIgnoreAfter",
21450
+ "blockExoticSubdeps",
21451
+ "minimumReleaseAgeExcludePrune",
21452
+ // Peer dependencies
21453
+ "autoInstallPeers",
21454
+ "strictPeerDependencies",
21455
+ "dedupePeerDependents",
21456
+ "resolvePeersFromWorkspaceRoot",
21457
+ "peerDependencyRules",
21458
+ // Workspace semantics
21459
+ "linkWorkspacePackages",
21460
+ "preferWorkspacePackages",
21461
+ "injectWorkspacePackages",
21462
+ "dedupeInjectedDeps",
21463
+ "syncInjectedDepsAfterScripts",
21464
+ "saveWorkspaceProtocol",
21465
+ "includeWorkspaceRoot",
21466
+ "sharedWorkspaceLockfile",
21467
+ "disallowWorkspaceCycles",
21468
+ "hoistWorkspacePackages",
21469
+ "requiredScripts",
21470
+ // Layout and lockfile
21471
+ "nodeLinker",
21472
+ "hoistPattern",
21473
+ "publicHoistPattern",
21474
+ "shamefullyHoist",
21475
+ "preferFrozenLockfile",
21476
+ "peersSuffixMaxLength",
21477
+ // Scripts, engines, publish
21478
+ "enablePrePostScripts",
21479
+ "nodeOptions",
21480
+ "engineStrict",
21481
+ "gitChecks",
21482
+ "publishBranch",
21483
+ "provenance",
21484
+ "embedReadme"
21485
+ ];
21486
+ var RESERVED_YAML_KEYS = {
21487
+ // Structural keys whose option name differs from the emitted YAML key.
21488
+ packages: "subprojects",
21489
+ catalog: "defaultCatalog",
21490
+ catalogs: "namedCatalogs",
21491
+ // Settings emitted by the pre-existing typed surface.
21492
+ minimumReleaseAge: "minimumReleaseAge",
21493
+ minimumReleaseAgeExclude: "minimumReleaseAgeExclude",
21494
+ onlyBuiltDependencies: "onlyBuiltDependencies",
21495
+ ignoredBuiltDependencies: "ignoredBuiltDependencies",
21496
+ allowBuilds: "allowBuilds",
21497
+ confirmModulesPurge: "confirmModulesPurge",
21498
+ strictDepBuilds: "strictDepBuilds",
21499
+ verifyDepsBeforeRun: "verifyDepsBeforeRun",
21500
+ catalogMode: "catalogMode",
21501
+ cleanupUnusedCatalogs: "cleanupUnusedCatalogs",
21502
+ minimumReleaseAgeStrict: "minimumReleaseAgeStrict",
21503
+ minimumReleaseAgeIgnoreMissingTime: "minimumReleaseAgeIgnoreMissingTime",
21504
+ // Settings with bespoke emission.
21505
+ neverBuiltDependencies: "neverBuiltDependencies",
21506
+ catalogPrune: "catalogPrune",
21507
+ update: "update",
21508
+ updateConfig: "updateConfig",
21509
+ // Every curated passthrough setting is an identity mapping.
21510
+ ...Object.fromEntries(CURATED_SETTING_KEYS.map((key) => [key, key]))
21511
+ };
21432
21512
  var PnpmWorkspace = class _PnpmWorkspace extends import_projen.Component {
21433
21513
  /**
21434
21514
  * Get the pnpm workspace component of a project. If it does not exist,
@@ -21460,6 +21540,28 @@ var PnpmWorkspace = class _PnpmWorkspace extends import_projen.Component {
21460
21540
  this.cleanupUnusedCatalogs = options.cleanupUnusedCatalogs;
21461
21541
  this.minimumReleaseAgeStrict = options.minimumReleaseAgeStrict ?? false;
21462
21542
  this.minimumReleaseAgeIgnoreMissingTime = options.minimumReleaseAgeIgnoreMissingTime;
21543
+ this.curatedSettings = {};
21544
+ for (const key of [
21545
+ ...CURATED_SETTING_KEYS,
21546
+ "neverBuiltDependencies",
21547
+ "catalogPrune",
21548
+ "update",
21549
+ "updateConfig"
21550
+ ]) {
21551
+ const value = options[key];
21552
+ if (value !== void 0) {
21553
+ this.curatedSettings[key] = value;
21554
+ }
21555
+ }
21556
+ this.additionalSettings = { ...options.additionalSettings };
21557
+ for (const settingName of Object.keys(this.additionalSettings)) {
21558
+ const typedOption = RESERVED_YAML_KEYS[settingName];
21559
+ if (typedOption !== void 0) {
21560
+ throw new Error(
21561
+ `additionalSettings["${settingName}"] collides with a key that ${this.constructor.name} already emits. Use the \`${typedOption}\` option instead of passing "${settingName}" through additionalSettings.`
21562
+ );
21563
+ }
21564
+ }
21463
21565
  project.addPackageIgnore(this.fileName);
21464
21566
  project.tryRemoveFile(this.fileName);
21465
21567
  new import_projen.YamlFile(this.project, this.fileName, {
@@ -21481,6 +21583,7 @@ var PnpmWorkspace = class _PnpmWorkspace extends import_projen.Component {
21481
21583
  if (this.minimumReleaseAgeExclude.length > 0) {
21482
21584
  pnpmConfig.minimumReleaseAgeExclude = this.minimumReleaseAgeExclude;
21483
21585
  }
21586
+ const neverBuiltDependencies = this.curatedSettings.neverBuiltDependencies ?? [];
21484
21587
  const mergedAllowBuilds = {};
21485
21588
  for (const pkg of this.onlyBuiltDependencies) {
21486
21589
  mergedAllowBuilds[pkg] = true;
@@ -21488,6 +21591,9 @@ var PnpmWorkspace = class _PnpmWorkspace extends import_projen.Component {
21488
21591
  for (const pkg of this.ignoredBuiltDependencies) {
21489
21592
  mergedAllowBuilds[pkg] = false;
21490
21593
  }
21594
+ for (const pkg of neverBuiltDependencies) {
21595
+ mergedAllowBuilds[pkg] = false;
21596
+ }
21491
21597
  for (const [pkg, allowed] of Object.entries(this.allowBuilds)) {
21492
21598
  mergedAllowBuilds[pkg] = allowed;
21493
21599
  }
@@ -21508,6 +21614,9 @@ var PnpmWorkspace = class _PnpmWorkspace extends import_projen.Component {
21508
21614
  if (denyList.length > 0) {
21509
21615
  pnpmConfig.ignoredBuiltDependencies = denyList;
21510
21616
  }
21617
+ if (neverBuiltDependencies.length > 0) {
21618
+ pnpmConfig.neverBuiltDependencies = neverBuiltDependencies;
21619
+ }
21511
21620
  if (Object.keys(mergedAllowBuilds).length > 0) {
21512
21621
  pnpmConfig.allowBuilds = mergedAllowBuilds;
21513
21622
  }
@@ -21529,7 +21638,10 @@ var PnpmWorkspace = class _PnpmWorkspace extends import_projen.Component {
21529
21638
  if (this.catalogMode !== void 0) {
21530
21639
  pnpmConfig.catalogMode = this.catalogMode;
21531
21640
  }
21532
- if (this.cleanupUnusedCatalogs !== void 0) {
21641
+ const catalogPrune = this.curatedSettings.catalogPrune;
21642
+ if (catalogPrune !== void 0) {
21643
+ pnpmConfig.catalogPrune = catalogPrune;
21644
+ } else if (this.cleanupUnusedCatalogs !== void 0) {
21533
21645
  pnpmConfig.cleanupUnusedCatalogs = this.cleanupUnusedCatalogs;
21534
21646
  }
21535
21647
  if (this.minimumReleaseAgeStrict !== void 0) {
@@ -21538,6 +21650,24 @@ var PnpmWorkspace = class _PnpmWorkspace extends import_projen.Component {
21538
21650
  if (this.minimumReleaseAgeIgnoreMissingTime !== void 0) {
21539
21651
  pnpmConfig.minimumReleaseAgeIgnoreMissingTime = this.minimumReleaseAgeIgnoreMissingTime;
21540
21652
  }
21653
+ for (const settingName of CURATED_SETTING_KEYS) {
21654
+ const value = this.curatedSettings[settingName];
21655
+ if (value !== void 0) {
21656
+ pnpmConfig[settingName] = value;
21657
+ }
21658
+ }
21659
+ const update = this.curatedSettings.update;
21660
+ const updateConfig = this.curatedSettings.updateConfig;
21661
+ if (update !== void 0) {
21662
+ pnpmConfig.update = update;
21663
+ } else if (updateConfig !== void 0) {
21664
+ pnpmConfig.updateConfig = updateConfig;
21665
+ }
21666
+ for (const [settingName, value] of Object.entries(
21667
+ this.additionalSettings
21668
+ )) {
21669
+ pnpmConfig[settingName] = value;
21670
+ }
21541
21671
  return {
21542
21672
  ...packages.length > 0 ? { packages } : {},
21543
21673
  ...pnpmConfig ? { ...pnpmConfig } : {}
@@ -21545,6 +21675,27 @@ var PnpmWorkspace = class _PnpmWorkspace extends import_projen.Component {
21545
21675
  }
21546
21676
  });
21547
21677
  }
21678
+ /**
21679
+ * Read back a configured pnpm setting by name.
21680
+ *
21681
+ * Covers both tiers: curated settings added since the original typed
21682
+ * surface, and verbatim `additionalSettings` passthrough keys. Returns
21683
+ * `undefined` when the setting was not configured, which is the same
21684
+ * signal the emitter uses to omit the key from the generated YAML.
21685
+ *
21686
+ * The fifteen original options (`minimumReleaseAge`, `allowBuilds`,
21687
+ * `defaultCatalog`, and friends) remain available as public fields and are
21688
+ * not served by this accessor.
21689
+ *
21690
+ * @param settingName - The pnpm setting name, e.g. `"overrides"`.
21691
+ * @returns The configured value, or `undefined` when unset.
21692
+ */
21693
+ setting(settingName) {
21694
+ if (settingName in this.curatedSettings) {
21695
+ return this.curatedSettings[settingName];
21696
+ }
21697
+ return this.additionalSettings[settingName];
21698
+ }
21548
21699
  };
21549
21700
  var MIMIMUM_RELEASE_AGE = MINIMUM_RELEASE_AGE;
21550
21701
 
@@ -38855,6 +39006,42 @@ var AwsDeploymentTarget = class _AwsDeploymentTarget extends import_projen13.Com
38855
39006
  );
38856
39007
  }
38857
39008
  };
39009
+ /*****************************************************************************
39010
+ *
39011
+ * Destroy Tasks
39012
+ *
39013
+ * - If local deploy, add a destroy task.
39014
+ *
39015
+ * Mirrors the deploy task family so `destroyDefaults`, per-account
39016
+ * `destroy` overrides, and a target's `cdkOptions.destroy` all reach a
39017
+ * rendered command. Projen's generic `destroy` passthrough is deliberately
39018
+ * left intact as an ad-hoc escape hatch — unlike the generic `deploy` and
39019
+ * `watch` tasks, it is not reset to a disabled stub.
39020
+ *
39021
+ ****************************************************************************/
39022
+ this.configureDestroyTask = () => {
39023
+ if (this.localDeployment) {
39024
+ const taskName = [
39025
+ "destroy",
39026
+ this.awsStageType,
39027
+ this.account,
39028
+ this.region
39029
+ ].join(":");
39030
+ const destroyTask = this.project.tasks.addTask(taskName, {
39031
+ env: this.awsDeploymentConfig.env
39032
+ });
39033
+ const destroyOpts = this.awsDeploymentConfig.cdkCli.destroyOptionsFor(this);
39034
+ destroyTask.exec(
39035
+ `cdk ${renderCdkDestroy({
39036
+ ...destroyOpts,
39037
+ lookups: false,
39038
+ profile: this.localDeploymentConfig?.profile,
39039
+ app: this.awsDeploymentConfig.cdkOut,
39040
+ stackPatterns: this.localDeploymentConfig?.stackPattern ? [this.localDeploymentConfig.stackPattern] : void 0
39041
+ })}`
39042
+ );
39043
+ }
39044
+ };
38858
39045
  this.account = options.account;
38859
39046
  this.region = options.region;
38860
39047
  this.cdkOptions = options.cdkOptions;
@@ -38897,6 +39084,7 @@ var AwsDeploymentTarget = class _AwsDeploymentTarget extends import_projen13.Com
38897
39084
  this.awsDeploymentConfig.awsDeploymentTargets.push(this);
38898
39085
  this.configureDeployTask();
38899
39086
  this.configureWatchTask();
39087
+ this.configureDestroyTask();
38900
39088
  }
38901
39089
  /**
38902
39090
  * Static method to discovert targets in a project.