(mdxPath: string, srcPath: string, lines: string[])
| 90 | } |
| 91 | |
| 92 | function syncCodeSandbox(mdxPath: string, srcPath: string, lines: string[]) { |
| 93 | console.log('SYNCING', mdxPath, srcPath); |
| 94 | const first = lines[0]; |
| 95 | const newContent = readFile(join('.', srcPath)); |
| 96 | while (newContent.length && newContent[newContent.length - 1] == '') { |
| 97 | newContent.pop(); |
| 98 | } |
| 99 | const last = lines[lines.length - 1]; |
| 100 | return [first, ...newContent, last]; |
| 101 | } |
| 102 | |
| 103 | scanFiles('src/routes', mdxFiles, syncCodeSandboxes); |