(root: string)
| 27 | } |
| 28 | |
| 29 | function writeViewModule(root: string): string { |
| 30 | mkdirSync(root, { recursive: true }); |
| 31 | const viewFile = join(root, "view.mjs"); |
| 32 | writeFileSync( |
| 33 | viewFile, |
| 34 | [ |
| 35 | 'import { widgetLabel } from "./widget.mjs";', |
| 36 | "export function view(state) {", |
| 37 | ' return { kind: "text", text: `${widgetLabel()}:${String(state.count)}`, props: {} };', |
| 38 | "}", |
| 39 | "", |
| 40 | ].join("\n"), |
| 41 | "utf8", |
| 42 | ); |
| 43 | return viewFile; |
| 44 | } |
| 45 | |
| 46 | function writeViewModuleWithBareImport(root: string): string { |
| 47 | mkdirSync(root, { recursive: true }); |
no outgoing calls
no test coverage detected