@codedrifters/configulator 0.0.314 → 0.0.315

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
@@ -27576,16 +27576,32 @@ var _TurboRepo = class _TurboRepo extends Component4 {
27576
27576
  this.globalEnv.push(name);
27577
27577
  }
27578
27578
  }
27579
- /**
27580
- * Sets GIT_BRANCH_NAME so root tasks (e.g. build:all) pass the current branch.
27581
- * Value must be exactly $(...) so Projen's task runtime expands it; the shell
27582
- * then expands ${GIT_BRANCH_NAME:-$(git rev-parse --abbrev-ref HEAD)}.
27583
- */
27584
- activateBranchNameEnvVar() {
27585
- this.addGlobalEnvVar(
27586
- "GIT_BRANCH_NAME",
27587
- '$(echo "${GIT_BRANCH_NAME:-$(git rev-parse --abbrev-ref HEAD)}")'
27579
+ activateBranchNameEnvVar(options) {
27580
+ const value = '$(echo "${GIT_BRANCH_NAME:-$(git rev-parse --abbrev-ref HEAD)}")';
27581
+ if (options === void 0) {
27582
+ this.project.logger.warn(
27583
+ "TurboRepo.activateBranchNameEnvVar() with no arguments is deprecated. It writes GIT_BRANCH_NAME to the root `globalEnv`, which forces every task in the monorepo to miss cache on every branch switch. Pass `{ tasks: [...] }` and name only the tasks that actually consume the branch (e.g. CDK synth/package) to preserve cross-branch cache hits for everything else."
27584
+ );
27585
+ this.addGlobalEnvVar("GIT_BRANCH_NAME", value);
27586
+ return;
27587
+ }
27588
+ const knownTaskNames = this.tasks.map((task) => task.name);
27589
+ const unknown = options.tasks.filter(
27590
+ (name) => !knownTaskNames.includes(name)
27588
27591
  );
27592
+ if (unknown.length > 0) {
27593
+ throw new Error(
27594
+ `TurboRepo.activateBranchNameEnvVar: unknown task name(s) ${JSON.stringify(
27595
+ unknown
27596
+ )}. Known tasks on this TurboRepo: ${JSON.stringify(knownTaskNames)}.`
27597
+ );
27598
+ }
27599
+ for (const name of options.tasks) {
27600
+ const task = this.tasks.find((t) => t.name === name);
27601
+ if (task && !task.env.includes("GIT_BRANCH_NAME")) {
27602
+ task.env.push("GIT_BRANCH_NAME");
27603
+ }
27604
+ }
27589
27605
  }
27590
27606
  preSynthesize() {
27591
27607
  let nextDependsOn = this.project.deps.all.filter((d) => d.version === "workspace:*").map((d) => [d.name, ROOT_TURBO_TASK_NAME].join("#"));