@codedrifters/configulator 0.0.296 → 0.0.297

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
@@ -15508,6 +15508,7 @@ var PnpmWorkspace = class _PnpmWorkspace extends Component {
15508
15508
  this.minimumReleaseAgeExclude = options.minimumReleaseAgeExclude ? ["@codedrifters/*", ...options.minimumReleaseAgeExclude] : ["@codedrifters/*"];
15509
15509
  this.onlyBuiltDependencies = options.onlyBuiltDependencies ? options.onlyBuiltDependencies : [];
15510
15510
  this.ignoredBuiltDependencies = options.ignoredBuiltDependencies ? options.ignoredBuiltDependencies : [];
15511
+ this.allowBuilds = options.allowBuilds ?? {};
15511
15512
  this.subprojects = options.subprojects ?? [];
15512
15513
  this.defaultCatalog = options.defaultCatalog;
15513
15514
  this.namedCatalogs = options.namedCatalogs;
@@ -15531,11 +15532,35 @@ var PnpmWorkspace = class _PnpmWorkspace extends Component {
15531
15532
  if (this.minimumReleaseAgeExclude.length > 0) {
15532
15533
  pnpmConfig.minimumReleaseAgeExclude = this.minimumReleaseAgeExclude;
15533
15534
  }
15534
- if (this.onlyBuiltDependencies.length > 0) {
15535
- pnpmConfig.onlyBuiltDependencies = this.onlyBuiltDependencies;
15535
+ const mergedAllowBuilds = {};
15536
+ for (const pkg of this.onlyBuiltDependencies) {
15537
+ mergedAllowBuilds[pkg] = true;
15536
15538
  }
15537
- if (this.ignoredBuiltDependencies.length > 0) {
15538
- pnpmConfig.ignoreBuiltDependencies = this.ignoredBuiltDependencies;
15539
+ for (const pkg of this.ignoredBuiltDependencies) {
15540
+ mergedAllowBuilds[pkg] = false;
15541
+ }
15542
+ for (const [pkg, allowed] of Object.entries(this.allowBuilds)) {
15543
+ mergedAllowBuilds[pkg] = allowed;
15544
+ }
15545
+ const allowList = [];
15546
+ const denyList = [];
15547
+ for (const [pkg, allowed] of Object.entries(mergedAllowBuilds)) {
15548
+ if (allowed) {
15549
+ allowList.push(pkg);
15550
+ } else {
15551
+ denyList.push(pkg);
15552
+ }
15553
+ }
15554
+ allowList.sort();
15555
+ denyList.sort();
15556
+ if (allowList.length > 0) {
15557
+ pnpmConfig.onlyBuiltDependencies = allowList;
15558
+ }
15559
+ if (denyList.length > 0) {
15560
+ pnpmConfig.ignoredBuiltDependencies = denyList;
15561
+ }
15562
+ if (Object.keys(mergedAllowBuilds).length > 0) {
15563
+ pnpmConfig.allowBuilds = mergedAllowBuilds;
15539
15564
  }
15540
15565
  if (this.defaultCatalog && Object.keys(this.defaultCatalog).length > 0) {
15541
15566
  pnpmConfig.catalog = this.defaultCatalog;
@@ -26816,11 +26841,11 @@ var VERSION = {
26816
26841
  * Version of `pnpm/action-setup` to use in GitHub workflows.
26817
26842
  * Tracks the version projen currently emits (see node_modules/projen/lib/javascript/node-project.js).
26818
26843
  */
26819
- PNPM_ACTION_SETUP_VERSION: "v5",
26844
+ PNPM_ACTION_SETUP_VERSION: "v6.0.5",
26820
26845
  /**
26821
26846
  * Version of PNPM to use in workflows at github actions.
26822
26847
  */
26823
- PNPM_VERSION: "10.33.3",
26848
+ PNPM_VERSION: "11.0.8",
26824
26849
  /**
26825
26850
  * Version of Projen to use.
26826
26851
  */
@@ -31178,9 +31203,24 @@ import {
31178
31203
  } from "projen/lib/typescript";
31179
31204
  import { merge } from "ts-deepmerge";
31180
31205
 
31181
- // src/tasks/reset-task.ts
31206
+ // src/projects/nvmrc.ts
31182
31207
  import { Component as Component14 } from "projen";
31183
- var ResetTask = class _ResetTask extends Component14 {
31208
+ import { TextFile as TextFile6 } from "projen/lib/textfile";
31209
+ var Nvmrc = class extends Component14 {
31210
+ constructor(project) {
31211
+ super(project);
31212
+ new TextFile6(project, ".nvmrc", {
31213
+ // `lines` is joined with `\n` — adding an empty trailing entry
31214
+ // produces a POSIX-friendly trailing newline (`24\n`).
31215
+ lines: [VERSION.NODE_WORKFLOWS, ""],
31216
+ readonly: true
31217
+ });
31218
+ }
31219
+ };
31220
+
31221
+ // src/tasks/reset-task.ts
31222
+ import { Component as Component15 } from "projen";
31223
+ var ResetTask = class _ResetTask extends Component15 {
31184
31224
  constructor(project, options = {}) {
31185
31225
  super(project);
31186
31226
  this.project = project;
@@ -31253,8 +31293,8 @@ var ResetTask = class _ResetTask extends Component14 {
31253
31293
  };
31254
31294
 
31255
31295
  // src/vscode/vscode.ts
31256
- import { Component as Component15, vscode } from "projen";
31257
- var VSCodeConfig = class extends Component15 {
31296
+ import { Component as Component16, vscode } from "projen";
31297
+ var VSCodeConfig = class extends Component16 {
31258
31298
  constructor(project) {
31259
31299
  super(project);
31260
31300
  const vsConfig = new vscode.VsCode(project);
@@ -31399,8 +31439,146 @@ function addBuildCompleteJob(buildWorkflow) {
31399
31439
  });
31400
31440
  }
31401
31441
 
31442
+ // src/workflows/pin-pnpm-action-setup.ts
31443
+ import { GitHub as GitHub2 } from "projen/lib/github";
31444
+ var PNPM_ACTION_SETUP_PREFIX = "pnpm/action-setup@";
31445
+ var STEP_ARRAY_FIELDS = ["preBuildSteps", "postBuildSteps"];
31446
+ function pinPnpmActionSetup(project) {
31447
+ const pinned = `${PNPM_ACTION_SETUP_PREFIX}${VERSION.PNPM_ACTION_SETUP_VERSION}`;
31448
+ patchComponentStepArrays(project, pinned);
31449
+ for (const sub of project.subprojects) {
31450
+ patchComponentStepArrays(sub, pinned);
31451
+ }
31452
+ const github = GitHub2.of(project);
31453
+ if (!github) {
31454
+ return;
31455
+ }
31456
+ for (const workflow of github.workflows) {
31457
+ for (const job of Object.values(workflow.jobs)) {
31458
+ patchStepArray(getEagerSteps(job), pinned);
31459
+ }
31460
+ }
31461
+ }
31462
+ function patchComponentStepArrays(project, pinned) {
31463
+ for (const component of project.components) {
31464
+ for (const field of STEP_ARRAY_FIELDS) {
31465
+ const steps = readStepArray(component, field);
31466
+ if (steps !== void 0) {
31467
+ patchStepArray(steps, pinned);
31468
+ }
31469
+ }
31470
+ }
31471
+ }
31472
+ function readStepArray(component, field) {
31473
+ const value = component[field];
31474
+ return Array.isArray(value) ? value : void 0;
31475
+ }
31476
+ function getEagerSteps(job) {
31477
+ if (typeof job !== "object" || job === null) {
31478
+ return void 0;
31479
+ }
31480
+ const steps = job.steps;
31481
+ return Array.isArray(steps) ? steps : void 0;
31482
+ }
31483
+ function patchStepArray(steps, pinned) {
31484
+ if (!steps) {
31485
+ return;
31486
+ }
31487
+ for (const step of steps) {
31488
+ if (typeof step.uses === "string" && step.uses.startsWith(PNPM_ACTION_SETUP_PREFIX)) {
31489
+ step.uses = pinned;
31490
+ }
31491
+ }
31492
+ }
31493
+
31494
+ // src/workflows/pin-setup-node-version.ts
31495
+ import { GitHub as GitHub3 } from "projen/lib/github";
31496
+ var SETUP_NODE_PREFIX = "actions/setup-node@";
31497
+ var STEP_ARRAY_FIELDS2 = ["preBuildSteps", "postBuildSteps"];
31498
+ var NODE_VERSION_FIELDS = ["workflowNodeVersion"];
31499
+ function pinSetupNodeVersion(project) {
31500
+ const pinned = VERSION.NODE_WORKFLOWS;
31501
+ patchComponentNodeVersionFields(project, pinned);
31502
+ patchComponentStepArrays2(project, pinned);
31503
+ for (const sub of project.subprojects) {
31504
+ patchComponentNodeVersionFields(sub, pinned);
31505
+ patchComponentStepArrays2(sub, pinned);
31506
+ }
31507
+ const github = GitHub3.of(project);
31508
+ if (!github) {
31509
+ return;
31510
+ }
31511
+ for (const workflow of github.workflows) {
31512
+ for (const job of Object.values(workflow.jobs)) {
31513
+ patchJobToolsNode(job, pinned);
31514
+ patchStepArray2(getEagerSteps2(job), pinned);
31515
+ }
31516
+ }
31517
+ }
31518
+ function patchComponentNodeVersionFields(project, pinned) {
31519
+ for (const component of project.components) {
31520
+ for (const field of NODE_VERSION_FIELDS) {
31521
+ const record = component;
31522
+ const value = record[field];
31523
+ if (typeof value === "string") {
31524
+ record[field] = pinned;
31525
+ }
31526
+ }
31527
+ }
31528
+ }
31529
+ function patchComponentStepArrays2(project, pinned) {
31530
+ for (const component of project.components) {
31531
+ for (const field of STEP_ARRAY_FIELDS2) {
31532
+ const steps = readStepArray2(component, field);
31533
+ if (steps !== void 0) {
31534
+ patchStepArray2(steps, pinned);
31535
+ }
31536
+ }
31537
+ }
31538
+ }
31539
+ function readStepArray2(component, field) {
31540
+ const value = component[field];
31541
+ return Array.isArray(value) ? value : void 0;
31542
+ }
31543
+ function getEagerSteps2(job) {
31544
+ if (typeof job !== "object" || job === null) {
31545
+ return void 0;
31546
+ }
31547
+ const steps = job.steps;
31548
+ return Array.isArray(steps) ? steps : void 0;
31549
+ }
31550
+ function patchJobToolsNode(job, pinned) {
31551
+ if (typeof job !== "object" || job === null) {
31552
+ return;
31553
+ }
31554
+ const tools = job.tools;
31555
+ if (typeof tools !== "object" || tools === null) {
31556
+ return;
31557
+ }
31558
+ const node = tools.node;
31559
+ if (typeof node !== "object" || node === null) {
31560
+ return;
31561
+ }
31562
+ if (typeof node.version === "string") {
31563
+ node.version = pinned;
31564
+ }
31565
+ }
31566
+ function patchStepArray2(steps, pinned) {
31567
+ if (!steps) {
31568
+ return;
31569
+ }
31570
+ for (const step of steps) {
31571
+ if (typeof step.uses === "string" && step.uses.startsWith(SETUP_NODE_PREFIX)) {
31572
+ if (!step.with || typeof step.with !== "object") {
31573
+ step.with = {};
31574
+ }
31575
+ step.with["node-version"] = pinned;
31576
+ }
31577
+ }
31578
+ }
31579
+
31402
31580
  // src/workflows/sync-labels.ts
31403
- import { Component as Component16, YamlFile as YamlFile2 } from "projen";
31581
+ import { Component as Component17, YamlFile as YamlFile2 } from "projen";
31404
31582
  import { JobPermission as JobPermission4 } from "projen/lib/github/workflows-model";
31405
31583
  var DEFAULT_STATUS_LABELS = [
31406
31584
  {
@@ -31608,7 +31786,7 @@ ${offenders}`
31608
31786
  }
31609
31787
  });
31610
31788
  }
31611
- var LabelsFile = class extends Component16 {
31789
+ var LabelsFile = class extends Component17 {
31612
31790
  constructor(project, labels) {
31613
31791
  super(project);
31614
31792
  new YamlFile2(project, LABELS_CONFIG_PATH, {
@@ -31829,6 +32007,7 @@ var MonorepoProject = class extends TypeScriptAppProject {
31829
32007
  this.configulatorRegistryConsumer = options.configulatorRegistryConsumer ?? true;
31830
32008
  this.layoutEnforcement = options.layoutEnforcement ?? LAYOUT_ENFORCEMENT.WARN;
31831
32009
  new VSCodeConfig(this);
32010
+ new Nvmrc(this);
31832
32011
  new PnpmWorkspace(this, options.pnpmOptions?.pnpmWorkspaceOptions);
31833
32012
  if (options.turbo) {
31834
32013
  new TurboRepo(this, options.turboOptions);
@@ -31947,6 +32126,8 @@ var MonorepoProject = class extends TypeScriptAppProject {
31947
32126
  */
31948
32127
  preSynthesize() {
31949
32128
  super.preSynthesize();
32129
+ pinPnpmActionSetup(this);
32130
+ pinSetupNodeVersion(this);
31950
32131
  if (this.layoutEnforcement === LAYOUT_ENFORCEMENT.OFF) {
31951
32132
  return;
31952
32133
  }
@@ -32350,12 +32531,12 @@ import { merge as merge4 } from "ts-deepmerge";
32350
32531
 
32351
32532
  // src/workflows/aws-deploy-workflow.ts
32352
32533
  var import_utils11 = __toESM(require_lib());
32353
- import { Component as Component17 } from "projen";
32534
+ import { Component as Component18 } from "projen";
32354
32535
  import { BuildWorkflow } from "projen/lib/build";
32355
- import { GitHub as GitHub2, WorkflowSteps as WorkflowSteps2 } from "projen/lib/github";
32536
+ import { GitHub as GitHub4, WorkflowSteps as WorkflowSteps2 } from "projen/lib/github";
32356
32537
  import { JobPermission as JobPermission5 } from "projen/lib/github/workflows-model";
32357
32538
  var PROD_DEPLOY_NAME = "prod-deploy";
32358
- var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component17 {
32539
+ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component18 {
32359
32540
  constructor(project, options = {}) {
32360
32541
  super(project);
32361
32542
  this.project = project;
@@ -32468,7 +32649,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component17 {
32468
32649
  );
32469
32650
  }
32470
32651
  this.rootProject = project.root;
32471
- const github = GitHub2.of(this.rootProject);
32652
+ const github = GitHub4.of(this.rootProject);
32472
32653
  if (!github) {
32473
32654
  throw new Error(
32474
32655
  "AwsDeployWorkflow requires a GitHub component in the root project"
@@ -32619,8 +32800,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component17 {
32619
32800
  };
32620
32801
 
32621
32802
  // src/workflows/aws-teardown-workflow.ts
32622
- import { Component as Component18 } from "projen";
32623
- import { GitHub as GitHub3, GithubWorkflow } from "projen/lib/github";
32803
+ import { Component as Component19 } from "projen";
32804
+ import { GitHub as GitHub5, GithubWorkflow } from "projen/lib/github";
32624
32805
  import { JobPermission as JobPermission6 } from "projen/lib/github/workflows-model";
32625
32806
  var DEFAULT_TEARDOWN_BRANCH_PATTERNS = [
32626
32807
  "feat/*",
@@ -32641,7 +32822,7 @@ var resolveBranchPatterns = (explicit, targets) => {
32641
32822
  }
32642
32823
  return [...DEFAULT_TEARDOWN_BRANCH_PATTERNS];
32643
32824
  };
32644
- var AwsTeardownWorkflow = class extends Component18 {
32825
+ var AwsTeardownWorkflow = class extends Component19 {
32645
32826
  constructor(rootProject, options) {
32646
32827
  super(rootProject);
32647
32828
  this.rootProject = rootProject;
@@ -32670,7 +32851,7 @@ var AwsTeardownWorkflow = class extends Component18 {
32670
32851
  "AwsTeardownWorkflow requires the root project to be a MonorepoProject"
32671
32852
  );
32672
32853
  }
32673
- const github = GitHub3.of(this.rootProject);
32854
+ const github = GitHub5.of(this.rootProject);
32674
32855
  if (!github) {
32675
32856
  throw new Error(
32676
32857
  "AwsTeardownWorkflow requires a GitHub component in the root project"
@@ -33115,9 +33296,9 @@ export const collections = {
33115
33296
 
33116
33297
  // src/typescript/typescript-config.ts
33117
33298
  import { relative as relative7 } from "path";
33118
- import { Component as Component19 } from "projen";
33299
+ import { Component as Component20 } from "projen";
33119
33300
  import { ensureRelativePathStartsWithDot } from "projen/lib/util/path";
33120
- var TypeScriptConfig = class extends Component19 {
33301
+ var TypeScriptConfig = class extends Component20 {
33121
33302
  constructor(project) {
33122
33303
  super(project);
33123
33304
  let tsPaths = {};
@@ -33228,6 +33409,7 @@ export {
33228
33409
  MINIMUM_RELEASE_AGE,
33229
33410
  MONOREPO_LAYOUT,
33230
33411
  MonorepoProject,
33412
+ Nvmrc,
33231
33413
  PROD_DEPLOY_NAME,
33232
33414
  PROGRESS_FILES_FORMAT_VALUES,
33233
33415
  PnpmWorkspace,
@@ -33321,6 +33503,8 @@ export {
33321
33503
  parseApiRollup,
33322
33504
  peopleProfileBundle,
33323
33505
  persistAuditReport,
33506
+ pinPnpmActionSetup,
33507
+ pinSetupNodeVersion,
33324
33508
  pnpmBundle,
33325
33509
  prReviewBundle,
33326
33510
  projenBundle,