File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 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 } " )
You can’t perform that action at this time.
0 commit comments