Write a single component's source code to the ``sources/`` dir.
(
self,
component_id: str,
source: str,
language: str = "",
)
| 71 | p.write_text(json.dumps(data, indent=2, ensure_ascii=False), encoding="utf-8") |
| 72 | return p |
| 73 | |
| 74 | def write_component_source( |
| 75 | self, |
| 76 | component_id: str, |
| 77 | source: str, |
| 78 | language: str = "", |
| 79 | ) -> Path: |
| 80 | """Write a single component's source code to the ``sources/`` dir.""" |
| 81 | p = self.root / "sources" / _safe_filename(component_id) |
| 82 | header = f"// Component: {component_id}\n// Language: {language}\n" |
| 83 | p.write_text(header + source, encoding="utf-8") |
| 84 | return p |
| 85 | |
| 86 | # -- readers ---------------------------------------------------------- |
no test coverage detected