@codedrifters/configulator 0.0.387 → 0.0.388

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
@@ -12473,6 +12473,15 @@ declare class TurboRepo extends Component$1 {
12473
12473
  * not match a task on this TurboRepo, so typos surface immediately.
12474
12474
  */
12475
12475
  activateBranchNameEnvVar(options: ActivateBranchNameEnvVarOptions): void;
12476
+ /**
12477
+ * Paths of all generated files in the project, deduped, for use as task
12478
+ * inputs so the compile cache invalidates when they change. Includes
12479
+ * projen-managed `FileBase` files plus generated-once `SampleFile` /
12480
+ * `SampleDir` — whose paths projen keeps private, so they are read defensively
12481
+ * and skipped if that internal shape ever changes. Computed at synth time so
12482
+ * files added after this component (e.g. a subclass's SampleFiles) are seen.
12483
+ */
12484
+ private generatedFileInputs;
12476
12485
  preSynthesize(): void;
12477
12486
  }
12478
12487
 
package/lib/index.d.ts CHANGED
@@ -12522,6 +12522,15 @@ declare class TurboRepo extends Component$1 {
12522
12522
  * not match a task on this TurboRepo, so typos surface immediately.
12523
12523
  */
12524
12524
  activateBranchNameEnvVar(options: ActivateBranchNameEnvVarOptions): void;
12525
+ /**
12526
+ * Paths of all generated files in the project, deduped, for use as task
12527
+ * inputs so the compile cache invalidates when they change. Includes
12528
+ * projen-managed `FileBase` files plus generated-once `SampleFile` /
12529
+ * `SampleDir` — whose paths projen keeps private, so they are read defensively
12530
+ * and skipped if that internal shape ever changes. Computed at synth time so
12531
+ * files added after this component (e.g. a subclass's SampleFiles) are seen.
12532
+ */
12533
+ private generatedFileInputs;
12525
12534
  preSynthesize(): void;
12526
12535
  }
12527
12536
 
package/lib/index.js CHANGED
@@ -31113,11 +31113,9 @@ var _TurboRepo = class _TurboRepo extends import_lib2.Component {
31113
31113
  };
31114
31114
  this.remoteCacheOptions = options.remoteCacheOptions;
31115
31115
  this.buildAllTaskEnvVars = options.buildAllTaskEnvVars ?? {};
31116
- const rootGeneratedFiles = this.isRootProject ? this.project.components.filter((c) => c instanceof import_lib2.FileBase).map((c) => c.path) : [];
31117
31116
  this.buildTask = new TurboRepoTask(this.project, {
31118
31117
  name: ROOT_TURBO_TASK_NAME,
31119
- dependsOn: this.isRootProject ? [`^${ROOT_TURBO_TASK_NAME}`] : [],
31120
- ...rootGeneratedFiles.length > 0 && { inputs: rootGeneratedFiles }
31118
+ dependsOn: this.isRootProject ? [`^${ROOT_TURBO_TASK_NAME}`] : []
31121
31119
  });
31122
31120
  if (this.isRootProject) {
31123
31121
  this.buildAllTask = this.project.tasks.addTask(ROOT_CI_TASK_NAME, {
@@ -31157,18 +31155,17 @@ var _TurboRepo = class _TurboRepo extends import_lib2.Component {
31157
31155
  }
31158
31156
  }
31159
31157
  if (!this.isRootProject) {
31160
- const generatedFiles = this.project.components.filter((c) => c instanceof import_lib2.FileBase).map((c) => c.path);
31161
31158
  this.preCompileTask = new TurboRepoTask(project, {
31162
31159
  name: options.preCompileTask?.name ?? "pre-compile",
31163
- inputs: ["src/**", ...generatedFiles]
31160
+ inputs: ["src/**"]
31164
31161
  });
31165
31162
  this.compileTask = new TurboRepoTask(project, {
31166
31163
  name: options.compileTask?.name ?? "compile",
31167
- inputs: ["src/**", ...generatedFiles]
31164
+ inputs: ["src/**"]
31168
31165
  });
31169
31166
  this.postCompileTask = new TurboRepoTask(project, {
31170
31167
  name: options.postCompileTask?.name ?? "post-compile",
31171
- inputs: ["src/**", ...generatedFiles]
31168
+ inputs: ["src/**"]
31172
31169
  });
31173
31170
  this.testTask = new TurboRepoTask(project, {
31174
31171
  name: options.testTask?.name ?? "test"
@@ -31299,6 +31296,33 @@ var _TurboRepo = class _TurboRepo extends import_lib2.Component {
31299
31296
  }
31300
31297
  }
31301
31298
  }
31299
+ /**
31300
+ * Paths of all generated files in the project, deduped, for use as task
31301
+ * inputs so the compile cache invalidates when they change. Includes
31302
+ * projen-managed `FileBase` files plus generated-once `SampleFile` /
31303
+ * `SampleDir` — whose paths projen keeps private, so they are read defensively
31304
+ * and skipped if that internal shape ever changes. Computed at synth time so
31305
+ * files added after this component (e.g. a subclass's SampleFiles) are seen.
31306
+ */
31307
+ generatedFileInputs() {
31308
+ const inputs = /* @__PURE__ */ new Set();
31309
+ for (const component of this.project.components) {
31310
+ if (component instanceof import_lib2.FileBase) {
31311
+ inputs.add(component.path);
31312
+ } else if (component instanceof import_lib2.SampleFile) {
31313
+ const filePath = component.filePath;
31314
+ if (typeof filePath === "string") {
31315
+ inputs.add(filePath);
31316
+ }
31317
+ } else if (component instanceof import_lib2.SampleDir) {
31318
+ const dir = component.dir;
31319
+ if (typeof dir === "string") {
31320
+ inputs.add(`${dir}/**`);
31321
+ }
31322
+ }
31323
+ }
31324
+ return Array.from(inputs);
31325
+ }
31302
31326
  preSynthesize() {
31303
31327
  let nextDependsOn = this.project.deps.all.filter((d) => d.version === "workspace:*").map((d) => [d.name, ROOT_TURBO_TASK_NAME].join("#"));
31304
31328
  if (!this.isRootProject) {
@@ -31320,6 +31344,24 @@ var _TurboRepo = class _TurboRepo extends import_lib2.Component {
31320
31344
  });
31321
31345
  this.buildTask.dependsOn.push(...nextDependsOn);
31322
31346
  }
31347
+ const generatedInputs = this.generatedFileInputs();
31348
+ const appendGeneratedInputs = (task) => {
31349
+ if (!task) {
31350
+ return;
31351
+ }
31352
+ for (const input of generatedInputs) {
31353
+ if (!task.inputs.includes(input)) {
31354
+ task.inputs.push(input);
31355
+ }
31356
+ }
31357
+ };
31358
+ if (this.isRootProject) {
31359
+ appendGeneratedInputs(this.buildTask);
31360
+ } else {
31361
+ appendGeneratedInputs(this.preCompileTask);
31362
+ appendGeneratedInputs(this.compileTask);
31363
+ appendGeneratedInputs(this.postCompileTask);
31364
+ }
31323
31365
  const fileName = "turbo.json";
31324
31366
  this.project.addPackageIgnore(fileName);
31325
31367
  new import_lib2.JsonFile(this.project, fileName, {