@workos/oagen 0.17.1 → 0.17.3

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.
@@ -4511,6 +4511,7 @@ async function writeFiles(files, outputDir, options) {
4511
4511
  const header = options?.header ?? "";
4512
4512
  for (const file of sorted) {
4513
4513
  const fullPath = path$1.join(outputDir, file.path);
4514
+ await renameMismatchedCasing(fullPath);
4514
4515
  let existingContent = null;
4515
4516
  try {
4516
4517
  existingContent = await fs.readFile(fullPath, "utf-8");
@@ -4583,6 +4584,30 @@ async function writeFiles(files, outputDir, options) {
4583
4584
  }
4584
4585
  return result;
4585
4586
  }
4587
+ /**
4588
+ * If a sibling exists with the same name except for letter case, rename it to
4589
+ * the requested casing. Uses a two-step rename via a temporary unique name so
4590
+ * case-insensitive filesystems (APFS on macOS, NTFS on Windows) actually
4591
+ * update the entry — `rename('Foo', 'FOO')` is a no-op on those systems.
4592
+ */
4593
+ async function renameMismatchedCasing(fullPath) {
4594
+ const dir = path$1.dirname(fullPath);
4595
+ const target = path$1.basename(fullPath);
4596
+ let entries;
4597
+ try {
4598
+ entries = await fs.readdir(dir);
4599
+ } catch {
4600
+ return;
4601
+ }
4602
+ if (entries.includes(target)) return;
4603
+ const targetLower = target.toLowerCase();
4604
+ const mismatch = entries.find((e) => e.toLowerCase() === targetLower);
4605
+ if (!mismatch) return;
4606
+ const oldPath = path$1.join(dir, mismatch);
4607
+ const tempPath = path$1.join(dir, `.oagen-case-${process.pid}-${Date.now()}-${target}`);
4608
+ await fs.rename(oldPath, tempPath);
4609
+ await fs.rename(tempPath, fullPath);
4610
+ }
4586
4611
  /** Comprehensive fallback when no adapter is available. */
4587
4612
  function isDefaultTestFile(filePath) {
4588
4613
  return /\.(spec|test)\.[jt]sx?$/.test(filePath) || filePath.endsWith("_test.go") || filePath.endsWith("_test.rb") || filePath.endsWith("_spec.rb") || /(?:^|\/)test_.*\.py$/.test(filePath) || filePath.endsWith("_test.py") || filePath.endsWith("Test.php") || filePath.endsWith("_test.rs") || /(?:^|\/)tests\/.*\.rs$/.test(filePath);