Skip to content

Commit 3d4d49c

Browse files
author
codegen-bot
committed
.
1 parent bf4161f commit 3d4d49c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

remove_default_exports/run.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from codegen import Codebase
2+
from codegen.sdk.typescript.file import TSFile
3+
4+
codebase = Codebase("./")
5+
6+
for file in codebase.files:
7+
target_file = file.filepath
8+
if not target_file:
9+
print(f"⚠️ Target file not found: {target_file} in codebase")
10+
continue
11+
12+
# Get corresponding non-shared file
13+
non_shared_path = file.filepath.replace('/shared/', '/')
14+
if not codebase.has_file(non_shared_path):
15+
print(f"⚠️ No matching non-shared file for: {non_shared_path}")
16+
continue
17+
18+
non_shared_file = codebase.get_file(non_shared_path)
19+
20+
# Process individual exports
21+
if isinstance(file, TSFile):
22+
print(f"📄 Processing {file.filepath}")
23+
24+
for export in file.exports:
25+
# Handle default exports
26+
if export.is_reexport() and export.is_default_export():
27+
print(f" 🔄 Converting default export '{export.name}'")
28+
default_export = next((e for e in non_shared_file.default_exports), None)
29+
if default_export:
30+
default_export.make_non_default()
31+
32+
print(f"✨ Fixed exports in {file.filepath}")

0 commit comments

Comments
 (0)